1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-13 09:32:47 +00:00

Don't leave `C-h N' in a text-mode derived mode

* 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.
This commit is contained in:
Lars Ingebrigtsen 2022-04-16 19:42:33 +02:00
parent 10c48b7080
commit 1a339d6ba5
2 changed files with 18 additions and 11 deletions

View 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

View File

@ -50,18 +50,26 @@
`(("^---$" 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