From faf1f037987ccef81b3f1a18bfc5ea4de867983e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 5 Aug 2022 16:12:07 +0800 Subject: [PATCH] Improve C-x C-q in emacs-news-mode * lisp/textmodes/emacs-news-mode.el (emacs-news-mode-map) (emacs-news-view-mode-map): Make C-x C-q switch to the appropriate mode for editing, and vice versa. (emacs-news-mode): Disable button-mode and make buffer read-write. --- lisp/textmodes/emacs-news-mode.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el index af0aa2ddeab..c7fa9fa2b2c 100644 --- a/lisp/textmodes/emacs-news-mode.el +++ b/lisp/textmodes/emacs-news-mode.el @@ -56,10 +56,12 @@ "C-c C-g" #'emacs-news-goto-section "C-c C-j" #'emacs-news-find-heading "C-c C-e" #'emacs-news-count-untagged-entries + "C-x C-q" #'emacs-news-view-mode " " #'emacs-news-open-line) (defvar-keymap emacs-news-view-mode-map - :parent emacs-news-common-map) + :parent emacs-news-common-map + "C-x C-q" #'emacs-news-mode) (defvar emacs-news-mode-font-lock-keywords `(("^---$" 0 'emacs-news-does-not-need-documentation) @@ -78,6 +80,11 @@ ;;;###autoload (define-derived-mode emacs-news-mode text-mode "NEWS" "Major mode for editing the Emacs NEWS file." + ;; Disable buttons. + (button-mode nil) + ;; And make the buffer writable. This is used when toggling + ;; emacs-news-mode. + (setq buffer-read-only nil) (setq-local fill-paragraph-function #'emacs-news--fill-paragraph) (emacs-news--mode-common)) -- 2.39.2