[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 502e3ce: * lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix
From: |
Juri Linkov |
Subject: |
master 502e3ce: * lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers. |
Date: |
Tue, 18 May 2021 16:36:33 -0400 (EDT) |
branch: master
commit 502e3ce614ce9cec60a9f8fb9b6beb216131e362
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers.
(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 | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 67b7546..59325d6 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 502e3ce: * lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers.,
Juri Linkov <=