]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers.
authorJuri Linkov <juri@linkov.net>
Tue, 18 May 2021 20:35:57 +0000 (23:35 +0300)
committerJuri Linkov <juri@linkov.net>
Tue, 18 May 2021 20:35:57 +0000 (23:35 +0300)
(lisp-outline-level): Return right levels starting from 1 instead of 5.
Suggested by Howard Melman <hmelman@gmail.com> in bug#46878.

lisp/emacs-lisp/lisp-mode.el

index 67b754609416a744e537c5529deea15d9e8aece3..59325d647d8f860d68b6c32da78c09108ca76ce0 100644 (file)
@@ -682,10 +682,16 @@ font-lock keywords will not be case sensitive."
 
 (defun lisp-outline-level ()
   "Lisp mode `outline-level' function."
+  ;; Expects outline-regexp is ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|("
+  ;; and point is at the beginning of a matching line.
   (let ((len (- (match-end 0) (match-beginning 0))))
-    (if (looking-at "(\\|;;;###autoload")
-       1000
-      len)))
+    (cond ((looking-at "(\\|;;;###autoload")
+           1000)
+          ((looking-at ";;\\(;+\\) ")
+           (- (match-end 1) (match-beginning 1)))
+          ;; Above should match everything but just in case.
+          (t
+           len))))
 
 (defun lisp-current-defun-name ()
   "Return the name of the defun at point, or nil."