aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2008-01-26 17:07:59 +0000
committerMartin Rudalics2008-01-26 17:07:59 +0000
commit9db3bfaeaf0fb657f5caffd1d5e1977e432f5555 (patch)
tree8e1db659780517780764c7bc5c520da72da62b94
parent248c21c5f20f60961cb18de1f90b995dd6ce8b18 (diff)
downloademacs-9db3bfaeaf0fb657f5caffd1d5e1977e432f5555.tar.gz
emacs-9db3bfaeaf0fb657f5caffd1d5e1977e432f5555.zip
(find-tag-default): Simplify using exclusively
skip-syntax-backward/-forward.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/subr.el43
2 files changed, 28 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0673f5cb357..0b0a7dca4de 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-01-26 Martin Rudalics <rudalics@gmx.at>
2
3 * subr.el (find-tag-default): Simplify using exclusively
4 skip-syntax-backward/-forward.
5
12008-01-26 Michael Albinus <michael.albinus@gmx.de> 62008-01-26 Michael Albinus <michael.albinus@gmx.de>
2 7
3 * vc.el (vc-directory, vc-update-change-log): Remove check for 8 * vc.el (vc-directory, vc-update-change-log): Remove check for
diff --git a/lisp/subr.el b/lisp/subr.el
index 5a7f88f76dd..f3579cc1fa6 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2127,26 +2127,29 @@ Note that this should end with a directory separator.")
2127(defun find-tag-default () 2127(defun find-tag-default ()
2128 "Determine default tag to search for, based on text at point. 2128 "Determine default tag to search for, based on text at point.
2129If there is no plausible default, return nil." 2129If there is no plausible default, return nil."
2130 (save-excursion 2130 (let (from to bound)
2131 (while (looking-at "\\sw\\|\\s_") 2131 (when (or (progn
2132 (forward-char 1)) 2132 ;; Look at text around `point'.
2133 (if (or (re-search-backward "\\sw\\|\\s_" 2133 (save-excursion
2134 (save-excursion (beginning-of-line) (point)) 2134 (skip-syntax-backward "w_") (setq from (point)))
2135 t) 2135 (save-excursion
2136 (re-search-forward "\\(\\sw\\|\\s_\\)+" 2136 (skip-syntax-forward "w_") (setq to (point)))
2137 (save-excursion (end-of-line) (point)) 2137 (> to from))
2138 t)) 2138 ;; Look between `line-beginning-position' and `point'.
2139 (progn 2139 (save-excursion
2140 (goto-char (match-end 0)) 2140 (and (setq bound (line-beginning-position))
2141 (condition-case nil 2141 (skip-syntax-backward "^w_" bound)
2142 (buffer-substring-no-properties 2142 (> (setq to (point)) bound)
2143 (point) 2143 (skip-syntax-backward "w_")
2144 (progn (forward-sexp -1) 2144 (setq from (point))))
2145 (while (looking-at "\\s'") 2145 ;; Look between `point' and `line-end-position'.
2146 (forward-char 1)) 2146 (save-excursion
2147 (point))) 2147 (and (setq bound (line-end-position))
2148 (error nil))) 2148 (skip-syntax-forward "^w_" bound)
2149 nil))) 2149 (< (setq from (point)) bound)
2150 (skip-syntax-forward "w_")
2151 (setq to (point)))))
2152 (buffer-substring-no-properties from to))))
2150 2153
2151(defun play-sound (sound) 2154(defun play-sound (sound)
2152 "SOUND is a list of the form `(sound KEYWORD VALUE...)'. 2155 "SOUND is a list of the form `(sound KEYWORD VALUE...)'.