Fix and edit the "Reading news and outline files" section

This commit is contained in:
Gerard Vermeulen 2024-06-22 11:30:11 +02:00
parent 63cc752fed
commit 2f8d6e34ed

View File

@ -1868,14 +1868,17 @@ file.
| *pdf-view-fit-width-to-window* | {{{kbd(W)}}} | | *pdf-view-fit-width-to-window* | {{{kbd(W)}}} |
|---------------------------------+----------------| |---------------------------------+----------------|
** Reading outline files ** Reading news and outline files
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:reading-outline-files :CUSTOM_ID: sec:reading-news-outline-files
:END: :END:
#+caption[Enable ~read-only-mode~ for some files in ~outline-mode~]: Listing [[lst:maybe-read-only]] implements heuristics to enable =read-only-mode= for
#+caption: Enable ~read-only-mode~ for some files in ~outline-mode~. all =emacs-news-mode= and selected =outline-mode= files.
#+name: lst:maybe-read-only-in-outline-mode
#+caption[Enable =read-only-mode= for news and selected outline files]:
#+caption: Enable =read-only-mode= for news and selected outline files.
#+name: lst:maybe-read-only
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(defun maybe-read-only-in-outline-mode () (defun maybe-read-only-in-outline-mode ()
"Check whether to open a file in `outline-mode' with `read-only-mode' enabled." "Check whether to open a file in `outline-mode' with `read-only-mode' enabled."
@ -1884,12 +1887,19 @@ file.
;; GAV: `fnsd' is nil during Org export to LaTeX. ;; GAV: `fnsd' is nil during Org export to LaTeX.
(when fnsd (when fnsd
(setq fnsd (file-name-nondirectory fnsd)) (setq fnsd (file-name-nondirectory fnsd))
;; These are files from the EMACS and ORG git repositories. ;; GAV: Handle files that do not open in `emacs-news-mode' from
(when (member fnsd '("EGLOT-NEWS" "NEWS" "ORG-NEWS" "PROBLEMS" ;; the EMACS and ORG git repositories (`cl-member' works too).
"org.org" "org-guide.org" "org-manual.org")) (when (or (string= fnsd "EGLOT-NEWS")
(string= fnsd "ORG-NEWS")
(string= fnsd "PROBLEMS")
(string= fnsd "org.org")
(string= fnsd "org-guide.org")
(string= fnsd "org-manual.org"))
(message "Visit `%s' in `read-only-mode'" fnsd) (message "Visit `%s' in `read-only-mode'" fnsd)
(read-only-mode +1))))) (read-only-mode +1)))))
(add-hook 'outline-mode-hook #'maybe-read-only-in-outline-mode) (add-hook 'outline-mode-hook #'maybe-read-only-in-outline-mode)
(add-hook 'emacs-news-mode-hook (lambda () (read-only-mode +1)))
#+end_src #+end_src
* Writing * Writing