/[emacs]/emacs/lisp/progmodes/cc-engine.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/cc-engine.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by mast, Tue Apr 30 23:00:54 2002 UTC revision 1.24 by mast, Sat May 25 16:17:27 2002 UTC
# Line 2333  Keywords are recognized and not consider Line 2333  Keywords are recognized and not consider
2333          (setq savepos (point)          (setq savepos (point)
2334                step-type step-tmp))                step-type step-tmp))
2335    
2336        ;; Skip over any comments that stands between the statement and        (catch 'done
       ;; boi.  If stop-at-boi-only is nil and we're not at boi after  
       ;; this, then we're done.  
       (while (and (/= (setq savepos (point)) boi)  
                   (c-forward-comment -1))  
         (setq at-comment t  
               boi (c-point 'boi)))  
       (goto-char savepos)  
   
       (when (or stop-at-boi-only  
                 (= (point) boi))  
         (catch 'done  
2337            ;; Loop if we have to back out of the containing block.            ;; Loop if we have to back out of the containing block.
2338            (while            (while
2339              (progn              (progn
2340                ;; Loop if we have to back up another statement.                ;; Loop if we have to back up another statement.
2341                (while                (while
2342                    (progn                    (progn
2343    
2344                      ;; Always start by skipping over any comments that                      ;; Always start by skipping over any comments that
2345                      ;; stands between the statement and boi.                      ;; stands between the statement and boi.
2346                      (while (and (/= (setq savepos (point)) boi)                      (while (and (/= (setq savepos (point)) boi)
# Line 2358  Keywords are recognized and not consider Line 2348  Keywords are recognized and not consider
2348                        (setq at-comment t                        (setq at-comment t
2349                              boi (c-point 'boi)))                              boi (c-point 'boi)))
2350                      (goto-char savepos)                      (goto-char savepos)
2351                      (and (or at-comment  
2352                               (eq step-type 'label)                      (and
2353                               (/= savepos boi))                       (or at-comment
2354                           (progn                           (eq step-type 'label)
2355                             ;; Current position not good enough; skip                           (/= savepos boi))
2356                             ;; backward another statement.  
2357                             (setq stop-at-boi-only t                       (progn
2358                                   step-type (c-beginning-of-statement-1                         ;; Current position might not be good enough;
2359                                              containing-sexp))                         ;; skip backward another statement.
2360                             ;; Record this a substatement if we skipped                         (setq step-type (c-beginning-of-statement-1
2361                             ;; up one level, but not if we're still on                                          containing-sexp))
2362                             ;; the same line.  This so e.g. a sequence  
2363                             ;; of "else if" clauses won't indent deeper                         (if (and (not stop-at-boi-only)
2364                             ;; and deeper.                                  (/= savepos boi)
2365                             (when (and (eq step-type 'up)                                  (memq step-type '(up previous)))
2366                                        (< (point) boi))                             ;; If stop-at-boi-only is nil, we shouldn't
2367                               (setcdr syms-tail (list 'substatement))                             ;; back up over previous or containing
2368                               (setq syms-tail (cdr syms-tail)))                             ;; statements to try to reach boi, so go
2369                             (setq boi (c-point 'boi))                             ;; back to the last position and exit.
2370                             (/= (point) savepos))))                             (progn
2371                                 (goto-char savepos)
2372                                 nil)
2373                             (if (and (not stop-at-boi-only)
2374                                      (memq step-type '(up previous beginning)))
2375                                 ;; If we've moved into another statement
2376                                 ;; then we should no longer try to stop
2377                                 ;; after boi.
2378                                 (setq stop-at-boi-only t))
2379    
2380                             ;; Record this a substatement if we skipped up
2381                             ;; one level, but not if we're still on the
2382                             ;; same line.  This so e.g. a sequence of "else
2383                             ;; if" clauses won't indent deeper and deeper.
2384                             (when (and (eq step-type 'up)
2385                                        (< (point) boi))
2386                               (setcdr syms-tail (list 'substatement))
2387                               (setq syms-tail (cdr syms-tail)))
2388    
2389                             (setq boi (c-point 'boi))
2390                             (/= (point) savepos)))))
2391    
2392                  (setq savepos (point)                  (setq savepos (point)
2393                        at-comment nil))                        at-comment nil))
2394                (setq at-comment nil)                (setq at-comment nil)
# Line 2389  Keywords are recognized and not consider Line 2400  Keywords are recognized and not consider
2400                                                         paren-state)                                                         paren-state)
2401                        containing-sexp (c-most-enclosing-brace paren-state))                        containing-sexp (c-most-enclosing-brace paren-state))
2402    
2403                  (when (and (prog1  
2404                                 (eq prev-paren ?{)                  (when (eq (setq prev-paren (char-after)) ?\()
                              (setq prev-paren (char-after)))  
                            (eq prev-paren ?\())  
2405                    (c-backward-syntactic-ws containing-sexp)                    (c-backward-syntactic-ws containing-sexp)
2406                    (when (c-on-identifier)                    (when (c-on-identifier)
2407                      ;; Arrived at a function arglist start.  Exit with                      ;; Arrived at a function arglist start.  Exit with
# Line 2433  Keywords are recognized and not consider Line 2442  Keywords are recognized and not consider
2442                          ;; we're at now is found to be good enough in                          ;; we're at now is found to be good enough in
2443                          ;; the loop above.                          ;; the loop above.
2444                          (setq step-type nil))                          (setq step-type nil))
2445                      (setq stop-at-boi-only t                      (if (and (not stop-at-boi-only)
2446                            boi (c-point 'boi)))))                               (memq step-type '(up previous beginning)))
2447                ))))                          (setq stop-at-boi-only t))
2448                        (setq boi (c-point 'boi)))))
2449                  )))
2450    
2451        (while syms        (while syms
2452          (c-add-syntax (car syms) (point))          (c-add-syntax (car syms) (point))

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26