emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ba0e989c11: Support imenu in emacs-news-mode


From: Stefan Kangas
Subject: master ba0e989c11: Support imenu in emacs-news-mode
Date: Mon, 19 Sep 2022 10:02:36 -0400 (EDT)

branch: master
commit ba0e989c11ebe05bb519845a6d3ab5af1e2715d8
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Support imenu in emacs-news-mode
    
    * lisp/outline.el (outline-imenu-generic-expression): New variable
    broken out from...
    (outline-mode): ...here.
    * lisp/textmodes/emacs-news-mode.el (emacs-news--mode-common): Use
    above new variable to add imenu support.
---
 lisp/outline.el                   | 7 +++++--
 lisp/textmodes/emacs-news-mode.el | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/outline.el b/lisp/outline.el
index 25ef1616b9..e3fbd8b327 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -341,6 +341,10 @@ data reflects the `outline-regexp'.")
   :safe #'booleanp
   :version "22.1")
 
+(defvar outline-imenu-generic-expression
+  (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))
+  "Value for `imenu-generic-expression' in Outline mode.")
+
 ;;;###autoload
 (define-derived-mode outline-mode text-mode "Outline"
   "Set major mode for editing outlines with selective display.
@@ -375,8 +379,7 @@ Turning on outline mode calls the value of `text-mode-hook' 
and then of
               (concat paragraph-separate "\\|\\(?:" outline-regexp "\\)"))
   (setq-local font-lock-defaults
               '(outline-font-lock-keywords t nil nil backward-paragraph))
-  (setq-local imenu-generic-expression
-             (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0)))
+  (setq-local imenu-generic-expression outline-imenu-generic-expression)
   (add-hook 'change-major-mode-hook #'outline-show-all nil t)
   (add-hook 'hack-local-variables-hook #'outline-apply-default-state nil t))
 
diff --git a/lisp/textmodes/emacs-news-mode.el 
b/lisp/textmodes/emacs-news-mode.el
index 88e8948060..d9decae4df 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -80,6 +80,7 @@
               outline-minor-mode-cycle t
               outline-minor-mode-highlight 'append)
   (outline-minor-mode)
+  (setq-local imenu-generic-expression outline-imenu-generic-expression)
   (emacs-etc--hide-local-variables))
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]