diff options
| author | Noam Postavsky | 2017-07-06 08:52:24 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-07-06 08:59:32 -0400 |
| commit | 386918f0b807116051facbe51a2bee342de37841 (patch) | |
| tree | d4cd72365995b96cba6af47b5d3720dcda668077 | |
| parent | 20e9a00fb5d12ad408f9dd15adcfcd205783c1b0 (diff) | |
| download | emacs-386918f0b807116051facbe51a2bee342de37841.tar.gz emacs-386918f0b807116051facbe51a2bee342de37841.zip | |
Fix lisp-comment-indent for single-semicolon case
* lisp/emacs-lisp/lisp-mode.el (lisp-comment-indent): Only check for
open paren if we're looking at multiple comment characters.
* test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-comment-indent-1)
(lisp-comment-indent-2): New tests.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 14 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/lisp-mode-tests.el | 26 |
2 files changed, 34 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 985b7513a3b..fa25a0c3975 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -738,12 +738,14 @@ or to switch back to an existing one." | |||
| 738 | 738 | ||
| 739 | (defun lisp-comment-indent () | 739 | (defun lisp-comment-indent () |
| 740 | "Like `comment-indent-default', but don't put space after open paren." | 740 | "Like `comment-indent-default', but don't put space after open paren." |
| 741 | (let ((pt (point))) | 741 | (or (when (looking-at "\\s<\\s<") |
| 742 | (skip-syntax-backward " ") | 742 | (let ((pt (point))) |
| 743 | (if (eq (preceding-char) ?\() | 743 | (skip-syntax-backward " ") |
| 744 | (cons (current-column) (current-column)) | 744 | (if (eq (preceding-char) ?\() |
| 745 | (goto-char pt) | 745 | (cons (current-column) (current-column)) |
| 746 | (comment-indent-default)))) | 746 | (goto-char pt) |
| 747 | nil))) | ||
| 748 | (comment-indent-default))) | ||
| 747 | 749 | ||
| 748 | (define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1") | 750 | (define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1") |
| 749 | 751 | ||
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 582041cfc2d..cc196beea23 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el | |||
| @@ -198,6 +198,32 @@ Expected initialization file: `%s'\" | |||
| 198 | (indent-region (point-min) (point-max)) | 198 | (indent-region (point-min) (point-max)) |
| 199 | (should (equal (buffer-string) correct))))) | 199 | (should (equal (buffer-string) correct))))) |
| 200 | 200 | ||
| 201 | (ert-deftest lisp-comment-indent-1 () | ||
| 202 | (with-temp-buffer | ||
| 203 | (insert "\ | ||
| 204 | \(let ( ;sf | ||
| 205 | (x 3)) | ||
| 206 | 4)") | ||
| 207 | (let ((indent-tabs-mode nil) | ||
| 208 | (correct (buffer-string))) | ||
| 209 | (emacs-lisp-mode) | ||
| 210 | (goto-char (point-min)) | ||
| 211 | (comment-indent) | ||
| 212 | (should (equal (buffer-string) correct))))) | ||
| 213 | |||
| 214 | (ert-deftest lisp-comment-indent-2 () | ||
| 215 | (with-temp-buffer | ||
| 216 | (insert "\ | ||
| 217 | \(let (;;sf | ||
| 218 | (x 3)) | ||
| 219 | 4)") | ||
| 220 | (let ((indent-tabs-mode nil) | ||
| 221 | (correct (buffer-string))) | ||
| 222 | (emacs-lisp-mode) | ||
| 223 | (goto-char (point-min)) | ||
| 224 | (comment-indent) | ||
| 225 | (should (equal (buffer-string) correct))))) | ||
| 226 | |||
| 201 | 227 | ||
| 202 | (provide 'lisp-mode-tests) | 228 | (provide 'lisp-mode-tests) |
| 203 | ;;; lisp-mode-tests.el ends here | 229 | ;;; lisp-mode-tests.el ends here |