# HG changeset patch # User Richard M. Stallman # Date 793698579 0 # Node ID 135ef978d71102fac23584570db378a0170ad069 # Parent 0ecc478ed3050f0dad74313979a0019883d56110 (c++-backward-to-noncomment): Don't loop forever if first line of buffer starts with ` #'. diff -r 0ecc478ed305 -r 135ef978d711 lisp/progmodes/cplus-md.el --- a/lisp/progmodes/cplus-md.el Sat Feb 25 07:35:09 1995 +0000 +++ b/lisp/progmodes/cplus-md.el Sat Feb 25 07:49:39 1995 +0000 @@ -586,12 +586,16 @@ ((and (search-backward "//" (max (c++-point-bol) lim) 'move) (not (c++-within-string-p (point) opoint)))) - (t (beginning-of-line) - (skip-chars-forward " \t") - (if (looking-at "#") - (setq stop (<= (point) lim)) - (setq stop t) - (goto-char opoint))))))) + ;; No comment to be found. + ;; If there's a # command on this line, + ;; move back to it. + (t (beginning-of-line) + (skip-chars-forward " \t") + ;; But don't get fooled if we are already before the #. + (if (and (looking-at "#") (< (point) opoint)) + (setq stop (<= (point) lim)) + (setq stop t) + (goto-char opoint))))))) (defun indent-c++-exp () "Indent each line of the C++ grouping following point."