diff options
author | Stefan Kangas <stefan@marxist.se> | 2022-08-12 22:22:17 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2022-08-12 22:28:17 +0200 |
commit | c4505fed538455a3637a293f10655d31c57ecff7 (patch) | |
tree | e2cf28eae658307fede6f52d3eb54205c2d3281f /lisp/emacs-lisp | |
parent | 316d3111a3666237caf86808d53765c8c77a3f53 (diff) | |
download | emacs-c4505fed538455a3637a293f10655d31c57ecff7.tar.gz emacs-c4505fed538455a3637a293f10655d31c57ecff7.tar.bz2 emacs-c4505fed538455a3637a293f10655d31c57ecff7.zip |
Hide local variable section in emacs-news-modes
* lisp/textmodes/emacs-authors-mode.el
(emacs-authors-mode--hide-local-variables): Move from here...
* lisp/emacs-lisp/subr-x.el (emacs-etc--hide-local-variables):
...to here.
* lisp/textmodes/emacs-authors-mode.el (subr-x): Require.
(emacs-authors-mode): Use above renamed function.
* lisp/textmodes/emacs-news-mode.el (subr-x): Require.
(emacs-news--mode-common): Call 'emacs-etc--hide-local-variables'
to hide local variables section.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 1cce97cdb10..bd7c3c82f97 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -467,6 +467,18 @@ be marked unmodified, effectively ignoring those changes." (equal ,hash (buffer-hash))) (restore-buffer-modified-p nil)))))))) +(defun emacs-etc--hide-local-variables () + "Hide local variables. +Used by `emacs-authors-mode' and `emacs-news-mode'." + (narrow-to-region (point-min) + (save-excursion + (goto-char (point-max)) + ;; Obfuscate to avoid this being interpreted + ;; as a local variable section itself. + (if (re-search-backward "^Local\sVariables:$" nil t) + (progn (forward-line -1) (point)) + (point-max))))) + (provide 'subr-x) ;;; subr-x.el ends here |