]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't leave `C-h N' in a text-mode derived mode
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 16 Apr 2022 17:42:33 +0000 (19:42 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 16 Apr 2022 17:42:33 +0000 (19:42 +0200)
* lisp/help.el (view-emacs-news): Use emacs-news-view-mode.
* lisp/textmodes/emacs-news-mode.el (emacs-news-view-mode): Split
into own mode to avoid confusion.

lisp/help.el
lisp/textmodes/emacs-news-mode.el

index e326ea5d00281591b983a8cb2080a514c71cc290..9cde65f797571d94ec64d2eb2f5aa99c02a597c1 100644 (file)
@@ -453,10 +453,9 @@ With argument, display info only for the selected version."
                ((< vn 18) "NEWS.1-17")
                (t (format "NEWS.%d" vn))))
         res)
-    (find-file (expand-file-name file data-directory))
-    (setq buffer-read-only t)
-    (emacs-news-mode)
-    (widen)
+    (let ((inhibit-local-variables-regexps '(".*")))
+      (find-file (expand-file-name file data-directory))
+      (emacs-news-view-mode))
     (goto-char (point-min))
     (when (stringp version)
       (when (re-search-forward
index a766352917ef2f7eaa4d911cbf3df30819b0f222..e31a7105b8063bd4b55a96a46de9b8fa37412764 100644 (file)
   `(("^---$" 0 'emacs-news-does-not-need-documentation)
     ("^\\+\\+\\+$" 0 'emacs-news-is-documented)))
 
-;;;###autoload
-(define-derived-mode emacs-news-mode text-mode "NEWS"
-  "Major mode for editing and viewind the Emacs NEWS file."
+(defun emacs-news--mode-common ()
   (setq-local font-lock-defaults '(emacs-news-mode-font-lock-keywords t))
   (setq-local outline-regexp "^\\*+ "
               outline-minor-mode-cycle t
               outline-minor-mode-highlight 'append)
+  (outline-minor-mode))
+
+;;;###autoload
+(define-derived-mode emacs-news-mode text-mode "NEWS"
+  "Major mode for editing the Emacs NEWS file."
   (setq-local fill-paragraph-function #'emacs-news--fill-paragraph)
-  (outline-minor-mode 1)
-  (when buffer-read-only
-    (emacs-news--buttonize)
-    (button-mode)))
+  (emacs-news--mode-common))
+
+;;;###autoload
+(define-derived-mode emacs-news-view-mode special-mode "NEWS"
+  "Major mode for viewing the Emacs NEWS file."
+  (setq buffer-read-only t)
+  (emacs-news--buttonize)
+  (button-mode)
+  (emacs-news--mode-common))
 
 (defun emacs-news--fill-paragraph (&optional justify)
   (cond