=== modified file 'lisp/subr.el' --- lisp/subr.el 2013-02-09 16:20:29 +0000 +++ lisp/subr.el 2013-03-06 17:51:43 +0000 @@ -2670,9 +2670,12 @@ directory if it does not exist." "Return non-nil if the current buffer is narrowed." (/= (- (point-max) (point-min)) (buffer-size))) -(defun find-tag-default () +(defun find-tag-default (&optional regexp-p) "Determine default tag to search for, based on text at point. -If there is no plausible default, return nil." +If there is no plausible default, return nil. + +When optional argument REGEXP-P is nil, return a regexp that +matches tag as a symbol." (let (from to bound) (when (or (progn ;; Look at text around `point'. @@ -2695,7 +2698,9 @@ If there is no plausible default, return (< (setq from (point)) bound) (skip-syntax-forward "w_") (setq to (point))))) - (buffer-substring-no-properties from to)))) + (let ((tag (buffer-substring-no-properties from to))) + (if (not regexp-p) tag + (format "\\_<%s\\_>" (regexp-quote tag))))))) (defun play-sound (sound) "SOUND is a list of the form `(sound KEYWORD VALUE...)'.