diff --git a/README.org b/README.org index dbcc361..f8bd3f6 100644 --- a/README.org +++ b/README.org @@ -2036,6 +2036,27 @@ file. | *pdf-view-fit-width-to-window* | {{{kbd(W)}}} | |---------------------------------+----------------| +** Reading outline files +:PROPERTIES: +:CUSTOM_ID: sec:reading-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 +#+begin_src emacs-lisp -n :results silent +(defun maybe-read-only-in-outline-mode () + ;; GAV: Should be a toplevel function to call `message' here. + (let ((fnsd (buffer-file-name))) + ;; GAV: `fnsd' is nil during Org export to LaTeX. + (when fnsd + (setq fnsd (file-name-nondirectory fnsd)) + (when (member fnsd '("NEWS" "ORG-NEWS" "PROBLEMS")) + (message "Visit `%s' in `read-only-mode'" fnsd) + (read-only-mode +1))))) +(add-hook 'outline-mode-hook #'maybe-read-only-in-outline-mode) +#+end_src + * Writing :PROPERTIES: :CUSTOM_ID: sec:writing