aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-08-28 15:30:10 +0000
committerRichard M. Stallman2004-08-28 15:30:10 +0000
commita0d84262dce24db23d5c71869269469f61abdc5e (patch)
treeaad986fbe4221db6851d36a217dd4ba3da76b3a4
parent87fdf320e91ef0ed5c83f69ff40191d6ba936efc (diff)
downloademacs-a0d84262dce24db23d5c71869269469f61abdc5e.tar.gz
emacs-a0d84262dce24db23d5c71869269469f61abdc5e.zip
(find-tag-default): Moved from etags.el.
-rw-r--r--lisp/subr.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 4eb1f691ff4..49b85e18394 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1969,6 +1969,27 @@ Uses the `derived-mode-parent' property of the symbol to trace backwards."
1969 (setq parent (get parent 'derived-mode-parent)))) 1969 (setq parent (get parent 'derived-mode-parent))))
1970 parent)) 1970 parent))
1971 1971
1972(defun find-tag-default ()
1973 "Determine default tag to search for, based on text at point.
1974If there is no plausible default, return nil."
1975 (save-excursion
1976 (while (looking-at "\\sw\\|\\s_")
1977 (forward-char 1))
1978 (if (or (re-search-backward "\\sw\\|\\s_"
1979 (save-excursion (beginning-of-line) (point))
1980 t)
1981 (re-search-forward "\\(\\sw\\|\\s_\\)+"
1982 (save-excursion (end-of-line) (point))
1983 t))
1984 (progn (goto-char (match-end 0))
1985 (buffer-substring-no-properties
1986 (point)
1987 (progn (forward-sexp -1)
1988 (while (looking-at "\\s'")
1989 (forward-char 1))
1990 (point))))
1991 nil)))
1992
1972(defmacro with-syntax-table (table &rest body) 1993(defmacro with-syntax-table (table &rest body)
1973 "Evaluate BODY with syntax table of current buffer set to TABLE. 1994 "Evaluate BODY with syntax table of current buffer set to TABLE.
1974The syntax table of the current buffer is saved, BODY is evaluated, and the 1995The syntax table of the current buffer is saved, BODY is evaluated, and the