diff options
| author | Richard M. Stallman | 1995-02-25 07:49:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-25 07:49:39 +0000 |
| commit | 5cff3cc1d9409b67f857c2c47c66fe4433255b89 (patch) | |
| tree | 25382ff72f25feecd58e494419efe8597534f2aa | |
| parent | ad93dad7b9e126301706c1f36158c4c0fab414cd (diff) | |
| download | emacs-5cff3cc1d9409b67f857c2c47c66fe4433255b89.tar.gz emacs-5cff3cc1d9409b67f857c2c47c66fe4433255b89.zip | |
(c++-backward-to-noncomment): Don't loop forever
if first line of buffer starts with ` #'.
| -rw-r--r-- | lisp/progmodes/cplus-md.el | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/progmodes/cplus-md.el b/lisp/progmodes/cplus-md.el index fd7f224969e..c88e299f7df 100644 --- a/lisp/progmodes/cplus-md.el +++ b/lisp/progmodes/cplus-md.el | |||
| @@ -586,12 +586,16 @@ Returns nil if line starts inside a string, t if in a comment." | |||
| 586 | ((and | 586 | ((and |
| 587 | (search-backward "//" (max (c++-point-bol) lim) 'move) | 587 | (search-backward "//" (max (c++-point-bol) lim) 'move) |
| 588 | (not (c++-within-string-p (point) opoint)))) | 588 | (not (c++-within-string-p (point) opoint)))) |
| 589 | (t (beginning-of-line) | 589 | ;; No comment to be found. |
| 590 | (skip-chars-forward " \t") | 590 | ;; If there's a # command on this line, |
| 591 | (if (looking-at "#") | 591 | ;; move back to it. |
| 592 | (setq stop (<= (point) lim)) | 592 | (t (beginning-of-line) |
| 593 | (setq stop t) | 593 | (skip-chars-forward " \t") |
| 594 | (goto-char opoint))))))) | 594 | ;; But don't get fooled if we are already before the #. |
| 595 | (if (and (looking-at "#") (< (point) opoint)) | ||
| 596 | (setq stop (<= (point) lim)) | ||
| 597 | (setq stop t) | ||
| 598 | (goto-char opoint))))))) | ||
| 595 | 599 | ||
| 596 | (defun indent-c++-exp () | 600 | (defun indent-c++-exp () |
| 597 | "Indent each line of the C++ grouping following point." | 601 | "Indent each line of the C++ grouping following point." |