1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-26 07:11:34 -08:00

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.
This commit is contained in:
Noam Postavsky 2017-07-06 08:52:24 -04:00
parent 20e9a00fb5
commit 386918f0b8
2 changed files with 34 additions and 6 deletions

View file

@ -738,12 +738,14 @@ or to switch back to an existing one."
(defun lisp-comment-indent () (defun lisp-comment-indent ()
"Like `comment-indent-default', but don't put space after open paren." "Like `comment-indent-default', but don't put space after open paren."
(let ((pt (point))) (or (when (looking-at "\\s<\\s<")
(skip-syntax-backward " ") (let ((pt (point)))
(if (eq (preceding-char) ?\() (skip-syntax-backward " ")
(cons (current-column) (current-column)) (if (eq (preceding-char) ?\()
(goto-char pt) (cons (current-column) (current-column))
(comment-indent-default)))) (goto-char pt)
nil)))
(comment-indent-default)))
(define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1") (define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1")

View file

@ -198,6 +198,32 @@ Expected initialization file: `%s'\"
(indent-region (point-min) (point-max)) (indent-region (point-min) (point-max))
(should (equal (buffer-string) correct))))) (should (equal (buffer-string) correct)))))
(ert-deftest lisp-comment-indent-1 ()
(with-temp-buffer
(insert "\
\(let ( ;sf
(x 3))
4)")
(let ((indent-tabs-mode nil)
(correct (buffer-string)))
(emacs-lisp-mode)
(goto-char (point-min))
(comment-indent)
(should (equal (buffer-string) correct)))))
(ert-deftest lisp-comment-indent-2 ()
(with-temp-buffer
(insert "\
\(let (;;sf
(x 3))
4)")
(let ((indent-tabs-mode nil)
(correct (buffer-string)))
(emacs-lisp-mode)
(goto-char (point-min))
(comment-indent)
(should (equal (buffer-string) correct)))))
(provide 'lisp-mode-tests) (provide 'lisp-mode-tests)
;;; lisp-mode-tests.el ends here ;;; lisp-mode-tests.el ends here