From: Alan M. <ac...@mu...> - 2010-12-16 21:52:48
|
Hi again, Daniel! On Wed, Dec 08, 2010 at 03:08:33PM -0800, Daniel Colascione wrote: > In a c-mode buf, > press pound, then back, then M-e > See eternal loop > Would you try out the following patch, please, which I hope fixes the problem. (The line numbers will be a little different, but don't worry about that.) Let me know how well it works! Thanks. *** orig/cc-cmds.el 2010-12-12 21:08:40.000000000 +0000 --- cc-cmds.el 2010-12-16 20:55:30.778431600 +0000 *************** *** 2422,2434 **** (goto-char last) (throw 'done '(nil . nil))) ! ;; Stop if we encounter a preprocessor line. ! ((and (not macro-end) (eq (char-after) ?#) (= (point) (c-point 'boi))) ! (goto-char last) ! ;(throw 'done (cons (eq (point) here) 'macro-boundary))) ; Changed 2003/3/26 ! (throw 'done '(t . macro-boundary))) ;; Stop after a ';', '}', or "};" ((looking-at ";\\|};?") --- 2422,2435 ---- (goto-char last) (throw 'done '(nil . nil))) ! ;; Stop if we encounter a preprocessor line. Continue if we hit a naked # ! ((and c-opt-cpp-prefix ! (not macro-end) (eq (char-after) ?#) (= (point) (c-point 'boi))) ! (if (= (point) here) ; Not a macro, therefore naked #. ! (forward-char) ! (throw 'done '(t . macro-boundary)))) ;; Stop after a ';', '}', or "};" ((looking-at ";\\|};?") *************** *** 2627,2640 **** ;; Are we about to move forward into or out of a ;; preprocessor command? (when (eq (cdr res) 'macro-boundary) ! (save-excursion ! (end-of-line) ! (setq macro-fence ! (and (not (eobp)) ! (progn (c-skip-ws-forward) ! (c-beginning-of-macro)) ! (progn (c-end-of-macro) ! (point)))))) ;; Are we about to move forward into a literal? (when (memq (cdr res) '(macro-boundary literal)) (setq range (c-ascertain-following-literal))) --- 2628,2646 ---- ;; Are we about to move forward into or out of a ;; preprocessor command? (when (eq (cdr res) 'macro-boundary) ! (setq macro-fence ! (save-excursion ! (if macro-fence ! (progn ! (end-of-line) ! (and (not (eobp)) ! (progn (c-skip-ws-forward) ! (c-beginning-of-macro)) ! (progn (c-end-of-macro) ! (point)))) ! (and (not (eobp)) ! (c-beginning-of-macro) ! (progn (c-end-of-macro) (point))))))) ;; Are we about to move forward into a literal? (when (memq (cdr res) '(macro-boundary literal)) (setq range (c-ascertain-following-literal))) All the best! -- Alan Mackenzie (Nuremberg, Germany). |