summaryrefslogtreecommitdiff
path: root/lisp/textmodes/emacs-authors-mode.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-08-12 22:22:17 +0200
committerStefan Kangas <stefan@marxist.se>2022-08-12 22:28:17 +0200
commitc4505fed538455a3637a293f10655d31c57ecff7 (patch)
treee2cf28eae658307fede6f52d3eb54205c2d3281f /lisp/textmodes/emacs-authors-mode.el
parent316d3111a3666237caf86808d53765c8c77a3f53 (diff)
downloademacs-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/textmodes/emacs-authors-mode.el')
-rw-r--r--lisp/textmodes/emacs-authors-mode.el17
1 files changed, 4 insertions, 13 deletions
diff --git a/lisp/textmodes/emacs-authors-mode.el b/lisp/textmodes/emacs-authors-mode.el
index ffb713fd682..af78ab605e9 100644
--- a/lisp/textmodes/emacs-authors-mode.el
+++ b/lisp/textmodes/emacs-authors-mode.el
@@ -27,6 +27,8 @@
;;; Code:
+(require 'subr-x) ; `emacs-etc--hide-local-variables'
+
(defgroup emacs-authors-mode nil
"Display the \"etc/AUTHORS\" file from the Emacs distribution."
:version "29.1"
@@ -88,17 +90,6 @@ See also `emacs-authors-mode'."
(,(rx bol (not space) (+ not-newline) eol)
0 'emacs-authors-default)))
-(defun emacs-authors-mode--hide-local-variables ()
- "Hide local variables in \"etc/AUTHORS\". Used by `emacs-authors-mode'."
- (narrow-to-region (point-min)
- (save-excursion
- (goto-char (point-min))
- ;; Obfuscate to avoid this being interpreted
- ;; as a local variable section itself.
- (if (re-search-forward "^Local\sVariables:$" nil t)
- (progn (forward-line -1) (point))
- (point-max)))))
-
(defun emacs-authors-next-author (&optional arg)
"Move point to the next author in \"etc/AUTHORS\".
With a prefix arg ARG, move point that many authors forward."
@@ -109,7 +100,7 @@ With a prefix arg ARG, move point that many authors forward."
(forward-line 1))
(re-search-forward emacs-authors--author-re nil t arg))
(when (looking-at emacs-authors--author-re)
- (forward-line -1))
+ (forward-line -1))
(re-search-backward emacs-authors--author-re nil t (abs arg)))
(goto-char (line-beginning-position)))
@@ -139,7 +130,7 @@ Provides some basic font locking and not much else."
'(emacs-authors-mode-font-lock-keywords nil nil ((?_ . "w"))))
(setq font-lock-multiline nil)
(setq imenu-generic-expression emacs-authors-imenu-generic-expression)
- (emacs-authors-mode--hide-local-variables))
+ (emacs-etc--hide-local-variables))
(define-obsolete-face-alias 'etc-authors-default 'emacs-authors-default "29.1")
(define-obsolete-face-alias 'etc-authors-author 'emacs-authors-author "29.1")