Fix and edit the "Reading news and outline files" section
This commit is contained in:
parent
63cc752fed
commit
2f8d6e34ed
26
README.org
26
README.org
@ -1868,14 +1868,17 @@ file.
|
||||
| *pdf-view-fit-width-to-window* | {{{kbd(W)}}} |
|
||||
|---------------------------------+----------------|
|
||||
|
||||
** Reading outline files
|
||||
** Reading news and outline files
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:reading-outline-files
|
||||
:CUSTOM_ID: sec:reading-news-outline-files
|
||||
:END:
|
||||
|
||||
#+caption[Enable ~read-only-mode~ for some files in ~outline-mode~]:
|
||||
#+caption: Enable ~read-only-mode~ for some files in ~outline-mode~.
|
||||
#+name: lst:maybe-read-only-in-outline-mode
|
||||
Listing [[lst:maybe-read-only]] implements heuristics to enable =read-only-mode= for
|
||||
all =emacs-news-mode= and selected =outline-mode= files.
|
||||
|
||||
#+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
|
||||
(defun maybe-read-only-in-outline-mode ()
|
||||
"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.
|
||||
(when fnsd
|
||||
(setq fnsd (file-name-nondirectory fnsd))
|
||||
;; These are files from the EMACS and ORG git repositories.
|
||||
(when (member fnsd '("EGLOT-NEWS" "NEWS" "ORG-NEWS" "PROBLEMS"
|
||||
"org.org" "org-guide.org" "org-manual.org"))
|
||||
;; GAV: Handle files that do not open in `emacs-news-mode' from
|
||||
;; the EMACS and ORG git repositories (`cl-member' works too).
|
||||
(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)
|
||||
(read-only-mode +1)))))
|
||||
|
||||
(add-hook 'outline-mode-hook #'maybe-read-only-in-outline-mode)
|
||||
(add-hook 'emacs-news-mode-hook (lambda () (read-only-mode +1)))
|
||||
#+end_src
|
||||
|
||||
* Writing
|
||||
|
Loading…
Reference in New Issue
Block a user