aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorChong Yidong2012-12-01 13:09:12 +0800
committerChong Yidong2012-12-01 13:09:12 +0800
commit9dffb5b69353cd041027b334a9c5aadf4163ec2d (patch)
tree36e5d76ed7301e1c5e757ecac62682e8619239e8 /lisp/textmodes
parentba03d0d932888f687ae9c9fb12e20908c6b0620f (diff)
downloademacs-9dffb5b69353cd041027b334a9c5aadf4163ec2d.tar.gz
emacs-9dffb5b69353cd041027b334a9c5aadf4163ec2d.zip
Fix last change.
* emacs-lisp/lisp-mode.el (lisp-current-defun-name): * progmodes/m4-mode.el (m4-current-defun-name): * progmodes/perl-mode.el (perl-current-defun-name): * textmodes/tex-mode.el (tex-current-defun-name): * textmodes/texinfo.el (texinfo-current-defun-name): Use save-excursion.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/tex-mode.el15
-rw-r--r--lisp/textmodes/texinfo.el5
2 files changed, 11 insertions, 9 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 966fa60e6de..16689b1ad02 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -424,13 +424,14 @@ An alternative value is \" . \", if you use a font with a narrow period."
424 424
425(defun tex-current-defun-name () 425(defun tex-current-defun-name ()
426 "Return the name of the TeX section/paragraph/chapter at point, or nil." 426 "Return the name of the TeX section/paragraph/chapter at point, or nil."
427 (when (re-search-backward 427 (save-excursion
428 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)" 428 (when (re-search-backward
429 nil t) 429 "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)"
430 (goto-char (match-beginning 0)) 430 nil t)
431 (buffer-substring-no-properties 431 (goto-char (match-beginning 0))
432 (1+ (point)) ; without initial backslash 432 (buffer-substring-no-properties
433 (line-end-position)))) 433 (1+ (point)) ; without initial backslash
434 (line-end-position)))))
434 435
435;;;; 436;;;;
436;;;; Font-Lock support 437;;;; Font-Lock support
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 0e45b603c1a..253b56f09b1 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -513,8 +513,9 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
513 513
514(defun texinfo-current-defun-name () 514(defun texinfo-current-defun-name ()
515 "Return the name of the Texinfo node at point, or nil." 515 "Return the name of the Texinfo node at point, or nil."
516 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) 516 (save-excursion
517 (match-string-no-properties 1))) 517 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
518 (match-string-no-properties 1))))
518 519
519;;; Texinfo mode 520;;; Texinfo mode
520 521