]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve C-x C-q in emacs-news-mode
authorPo Lu <luangruo@yahoo.com>
Fri, 5 Aug 2022 08:12:07 +0000 (16:12 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 5 Aug 2022 08:12:07 +0000 (16:12 +0800)
* 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

index af0aa2ddeab77de22a2d56d17b9b279c3f7b2613..c7fa9fa2b2c1d519bc3ae4dc59ab98abfebd0469 100644 (file)
   "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
   "<remap> <open-line>" #'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)
 ;;;###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))