emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111053: Fix last change.


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111053: Fix last change.
Date: Sat, 01 Dec 2012 13:09:12 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111053
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-12-01 13:09:12 +0800
message:
  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.
modified:
  lisp/emacs-lisp/lisp-mode.el
  lisp/progmodes/cperl-mode.el
  lisp/progmodes/m4-mode.el
  lisp/progmodes/perl-mode.el
  lisp/textmodes/tex-mode.el
  lisp/textmodes/texinfo.el
=== modified file 'lisp/emacs-lisp/lisp-mode.el'
--- a/lisp/emacs-lisp/lisp-mode.el      2012-12-01 04:57:07 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el      2012-12-01 05:09:12 +0000
@@ -240,28 +240,29 @@
 
 (defun lisp-current-defun-name ()
   "Return the name of the defun at point, or nil."
-  (let ((location (point)))
-    ;; If we are now precisely at the beginning of a defun, make sure
-    ;; beginning-of-defun finds that one rather than the previous one.
-    (or (eobp) (forward-char 1))
-    (beginning-of-defun)
-    ;; Make sure we are really inside the defun found, not after it.
-    (when (and (looking-at "\\s(")
-              (progn (end-of-defun)
-                     (< location (point)))
-              (progn (forward-sexp -1)
-                     (>= location (point))))
-      (if (looking-at "\\s(")
-         (forward-char 1))
-      ;; Skip the defining construct name, typically "defun" or
-      ;; "defvar".
-      (forward-sexp 1)
-      ;; The second element is usually a symbol being defined.  If it
-      ;; is not, use the first symbol in it.
-      (skip-chars-forward " \t\n'(")
-      (buffer-substring-no-properties (point)
-                                     (progn (forward-sexp 1)
-                                            (point))))))
+  (save-excursion
+    (let ((location (point)))
+      ;; If we are now precisely at the beginning of a defun, make sure
+      ;; beginning-of-defun finds that one rather than the previous one.
+      (or (eobp) (forward-char 1))
+      (beginning-of-defun)
+      ;; Make sure we are really inside the defun found, not after it.
+      (when (and (looking-at "\\s(")
+                (progn (end-of-defun)
+                       (< location (point)))
+                (progn (forward-sexp -1)
+                       (>= location (point))))
+       (if (looking-at "\\s(")
+           (forward-char 1))
+       ;; Skip the defining construct name, typically "defun" or
+       ;; "defvar".
+       (forward-sexp 1)
+       ;; The second element is usually a symbol being defined.  If it
+       ;; is not, use the first symbol in it.
+       (skip-chars-forward " \t\n'(")
+       (buffer-substring-no-properties (point)
+                                       (progn (forward-sexp 1)
+                                              (point)))))))
 
 (defvar lisp-mode-shared-map
   (let ((map (make-sparse-keymap)))

=== modified file 'lisp/progmodes/cperl-mode.el'
--- a/lisp/progmodes/cperl-mode.el      2012-12-01 04:57:07 +0000
+++ b/lisp/progmodes/cperl-mode.el      2012-12-01 05:09:12 +0000
@@ -1745,8 +1745,9 @@
   (make-local-variable 'add-log-current-defun-function)
   (setq add-log-current-defun-function
        (lambda ()
-         (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
-             (match-string-no-properties 1))))
+         (save-excursion
+           (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
+               (match-string-no-properties 1)))))
 
   (make-local-variable 'paragraph-start)
   (setq paragraph-start (concat "^$\\|" page-delimiter))

=== modified file 'lisp/progmodes/m4-mode.el'
--- a/lisp/progmodes/m4-mode.el 2012-12-01 04:57:07 +0000
+++ b/lisp/progmodes/m4-mode.el 2012-12-01 05:09:12 +0000
@@ -143,9 +143,10 @@
 
 (defun m4-current-defun-name ()
   "Return the name of the M4 function at point, or nil."
-  (if (re-search-backward
-       "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t)
-      (match-string-no-properties 3)))
+  (save-excursion
+    (if (re-search-backward
+        "^\\(\\(m4_\\)?define\\|A._DEFUN\\)(\\[?\\([A-Za-z0-9_]+\\)" nil t)
+       (match-string-no-properties 3))))
 
 ;;;###autoload
 (define-derived-mode m4-mode prog-mode "m4"

=== modified file 'lisp/progmodes/perl-mode.el'
--- a/lisp/progmodes/perl-mode.el       2012-12-01 04:57:07 +0000
+++ b/lisp/progmodes/perl-mode.el       2012-12-01 05:09:12 +0000
@@ -581,8 +581,10 @@
 
 (defun perl-current-defun-name ()
   "The `add-log-current-defun' function in Perl mode."
-  (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
-      (match-string-no-properties 1)))
+  (save-excursion
+    (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
+       (match-string-no-properties 1))))
+
 
 (defvar perl-mode-hook nil
   "Normal hook to run when entering Perl mode.")

=== modified file 'lisp/textmodes/tex-mode.el'
--- a/lisp/textmodes/tex-mode.el        2012-12-01 04:57:07 +0000
+++ b/lisp/textmodes/tex-mode.el        2012-12-01 05:09:12 +0000
@@ -424,13 +424,14 @@
 
 (defun tex-current-defun-name ()
   "Return the name of the TeX section/paragraph/chapter at point, or nil."
-  (when (re-search-backward
-        "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)"
-        nil t)
-    (goto-char (match-beginning 0))
-    (buffer-substring-no-properties
-     (1+ (point))      ; without initial backslash
-     (line-end-position))))
+  (save-excursion
+    (when (re-search-backward
+          "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)"
+          nil t)
+      (goto-char (match-beginning 0))
+      (buffer-substring-no-properties
+       (1+ (point))    ; without initial backslash
+       (line-end-position)))))
 
 ;;;;
 ;;;; Font-Lock support

=== modified file 'lisp/textmodes/texinfo.el'
--- a/lisp/textmodes/texinfo.el 2012-12-01 04:57:07 +0000
+++ b/lisp/textmodes/texinfo.el 2012-12-01 05:09:12 +0000
@@ -513,8 +513,9 @@
 
 (defun texinfo-current-defun-name ()
   "Return the name of the Texinfo node at point, or nil."
-  (if (re-search-backward "address@hidden \t]+\\([^,\n]+\\)" nil t)
-      (match-string-no-properties 1)))
+  (save-excursion
+    (if (re-search-backward "address@hidden \t]+\\([^,\n]+\\)" nil t)
+       (match-string-no-properties 1))))
 
 ;;; Texinfo mode
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]