summaryrefslogtreecommitdiff
path: root/lisp/textmodes/texinfo.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-12-01 12:57:07 +0800
committerChong Yidong <cyd@gnu.org>2012-12-01 12:57:07 +0800
commitba03d0d932888f687ae9c9fb12e20908c6b0620f (patch)
tree7acf98ce6c8fa50bbe21266b29ace526e19f13b2 /lisp/textmodes/texinfo.el
parent92eadba57fe86a49d67a7e3d797e3180ca0f6ae7 (diff)
downloademacs-ba03d0d932888f687ae9c9fb12e20908c6b0620f.tar.gz
Modularize add-log-current-defun.
Suggested by Jari Aalto. * lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): New. (lisp-mode-variables): Use it. * lisp/progmodes/cc-mode.el (c-common-init): * lisp/progmodes/cperl-mode.el (cperl-mode): Set a value for add-log-current-defun-function. * lisp/progmodes/m4-mode.el (m4-current-defun-name): New function. (m4-mode): Use it. * lisp/progmodes/perl-mode.el (perl-current-defun-name): New. (perl-mode): Use it. * lisp/progmodes/scheme.el (scheme-mode-variables, dsssl-mode): Use lisp-current-defun-name. * lisp/textmodes/tex-mode.el (tex-current-defun-name): New. (tex-common-initialization): Use it. * lisp/textmodes/texinfo.el (texinfo-current-defun-name): New. (texinfo-mode): Use it. * lisp/vc/add-log.el (add-log-current-defun-function): Doc fix. (add-log-current-defun): Move mode-specific code to other files. (add-log-lisp-like-modes, add-log-c-like-modes) (add-log-tex-like-modes): Variables deleted. Fixes: debbugs:2224
Diffstat (limited to 'lisp/textmodes/texinfo.el')
-rw-r--r--lisp/textmodes/texinfo.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 91405ba0744..0e45b603c1a 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -511,6 +511,11 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
(regexp-opt (texinfo-filter 2 texinfo-section-list))
"Regular expression matching just the Texinfo chapter level headings.")
+(defun texinfo-current-defun-name ()
+ "Return the name of the Texinfo node at point, or nil."
+ (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
+ (match-string-no-properties 1)))
+
;;; Texinfo mode
;;;###autoload
@@ -587,8 +592,10 @@ value of `texinfo-mode-hook'."
(setq-local require-final-newline mode-require-final-newline)
(setq-local indent-tabs-mode nil)
(setq-local paragraph-separate
- (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
- (setq-local paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
+ (concat "\b\\|@[a-zA-Z]*[ \n]\\|"
+ paragraph-separate))
+ (setq-local paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|"
+ paragraph-start))
(setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
(setq-local fill-column 70)
(setq-local comment-start "@c ")
@@ -600,6 +607,7 @@ value of `texinfo-mode-hook'."
'(texinfo-font-lock-keywords nil nil nil backward-paragraph))
(setq-local syntax-propertize-function texinfo-syntax-propertize-function)
(setq-local parse-sexp-lookup-properties t)
+ (setq-local add-log-current-defun-function #'texinfo-current-defun-name)
;; Outline settings.
(setq-local outline-heading-alist