emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 669e01b: tags-completion-at-point-function: Don't t


From: Stefan Monnier
Subject: [Emacs-diffs] master 669e01b: tags-completion-at-point-function: Don't trust the find-tag function
Date: Sat, 23 May 2015 16:05:25 +0000

branch: master
commit 669e01b5f630b74f417f12ebebed76c9553dae9b
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    tags-completion-at-point-function: Don't trust the find-tag function
    
    * lisp/progmodes/etags.el (tags-completion-at-point-function):
    Don't trust the find-tag function.
---
 lisp/progmodes/etags.el |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 7a87377..60ea456 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -805,15 +805,16 @@ If no tags table is loaded, do nothing and return nil."
                                    case-fold-search))
          (pattern (funcall (or find-tag-default-function
                                (get major-mode 'find-tag-default-function)
-                               'find-tag-default)))
+                               #'find-tag-default)))
          beg)
       (when pattern
        (save-excursion
           (forward-char (1- (length pattern)))
-          (search-backward pattern)
-          (setq beg (point))
-          (forward-char (length pattern))
-          (list beg (point) (tags-lazy-completion-table) :exclusive 'no))))))
+          ;; The find-tag function might be overly optimistic.
+          (when (search-backward pattern nil t)
+            (setq beg (point))
+            (forward-char (length pattern))
+            (list beg (point) (tags-lazy-completion-table) :exclusive 
'no)))))))
 
 (defun find-tag-tag (string)
   "Read a tag name, with defaulting and completion."



reply via email to

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