]> git.eshelyaron.com Git - emacs.git/commitdiff
Make find-tag-default-bounds more strict
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 22 Feb 2016 22:56:51 +0000 (00:56 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 23 Feb 2016 00:28:40 +0000 (02:28 +0200)
* lisp/subr.el (find-tag-default-bounds): Delegate to
bounds-of-thing-at-point (bug#22692).

lisp/subr.el

index cf26fe384ba0c1cf0259883e2bcba4b84417df95..dde76916230a1cdc0cc7135ebcbf9b6884b53be4 100644 (file)
@@ -2626,29 +2626,7 @@ See also `locate-user-emacs-file'.")
   "Determine the boundaries of the default tag, based on text at point.
 Return a cons cell with the beginning and end of the found tag.
 If there is no plausible default, return nil."
-  (let (from to bound)
-    (when (or (progn
-               ;; Look at text around `point'.
-               (save-excursion
-                 (skip-syntax-backward "w_") (setq from (point)))
-               (save-excursion
-                 (skip-syntax-forward "w_") (setq to (point)))
-               (> to from))
-             ;; Look between `line-beginning-position' and `point'.
-             (save-excursion
-               (and (setq bound (line-beginning-position))
-                    (skip-syntax-backward "^w_" bound)
-                    (> (setq to (point)) bound)
-                    (skip-syntax-backward "w_")
-                    (setq from (point))))
-             ;; Look between `point' and `line-end-position'.
-             (save-excursion
-               (and (setq bound (line-end-position))
-                    (skip-syntax-forward "^w_" bound)
-                    (< (setq from (point)) bound)
-                    (skip-syntax-forward "w_")
-                    (setq to (point)))))
-      (cons from to))))
+  (bounds-of-thing-at-point 'symbol))
 
 (defun find-tag-default ()
   "Determine default tag to search for, based on text at point.