=== modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-10 22:01:18 +0000 +++ lisp/ChangeLog 2012-10-11 20:39:05 +0000 @@ -1,3 +1,15 @@ +2012-10-11 Jambunathan K + + * replace.el (read-regexp): Tighten the regexp that matches tag. + When tag is retrieved with `find-tag-default', use regexp that + matches symbol at point. Also update docstring. + * hi-lock.el (hi-lock-line-face-buffer, hi-lock-face-buffer) + (hi-lock-face-phrase-buffer): Don't provide a default to + `read-regexp'. Effectively the default regexp matches tag at + point. + (hi-lock-read-face-name): Return face as a symbol. Fix earlier + commit. + 2012-10-10 Jambunathan K * hi-lock.el (hi-lock-auto-select-face): New user variable. === modified file 'lisp/hi-lock.el' --- lisp/hi-lock.el 2012-10-10 22:01:18 +0000 +++ lisp/hi-lock.el 2012-10-11 20:39:05 +0000 @@ -433,7 +433,7 @@ (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight line" (car regexp-history))) + (read-regexp "Regexp to highlight line")) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-lock-1)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -458,7 +458,7 @@ (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight" (car regexp-history))) + (read-regexp "Regexp to highlight")) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-lock-1)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -480,7 +480,7 @@ (list (hi-lock-regexp-okay (hi-lock-process-phrase - (read-regexp "Phrase to highlight" (car regexp-history)))) + (read-regexp "Phrase to highlight"))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-lock-1)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -598,7 +598,7 @@ from minibuffer with completion and history." (if hi-lock-auto-select-face ;; Return current head and rotate the face list. - (prog1 (car hi-lock-auto-select-face-defaults) + (prog1 (intern (car hi-lock-auto-select-face-defaults)) (setq hi-lock-auto-select-face-defaults (cdr hi-lock-auto-select-face-defaults))) (intern (completing-read === modified file 'lisp/replace.el' --- lisp/replace.el 2012-10-04 19:28:11 +0000 +++ lisp/replace.el 2012-10-11 20:39:05 +0000 @@ -585,27 +585,32 @@ When PROMPT doesn't end with a colon and space, it adds a final \": \". If DEFAULTS is non-nil, it displays the first default in the prompt. -Non-nil optional arg DEFAULTS is a string or a list of strings that -are prepended to a list of standard default values, which include the -string at point, the last isearch regexp, the last isearch string, and -the last replacement regexp. +Optional arg DEFAULTS is a string or a list of strings that are +prepended to a list of standard default values, which include the +tag at point, the last isearch regexp, the last isearch string, +and the last replacement regexp. Non-nil HISTORY is a symbol to use for the history list. If HISTORY is nil, `regexp-history' is used." - (let* ((default (if (consp defaults) (car defaults) defaults)) - (defaults + (let* ((defaults (append (if (listp defaults) defaults (list defaults)) - (list (regexp-quote - (or (funcall (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default)) - "")) - (car regexp-search-ring) - (regexp-quote (or (car search-ring) "")) - (car (symbol-value - query-replace-from-history-variable))))) + (list + ;; Regexp for tag at point. + (let* ((tagf (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + (tag (funcall tagf))) + (cond ((not tag) "") + ((eq tagf 'find-tag-default) + (format "\\_<%s\\_>" (regexp-quote tag))) + (t (regexp-quote tag)))) + (car regexp-search-ring) + (regexp-quote (or (car search-ring) "")) + (car (symbol-value + query-replace-from-history-variable))))) (defaults (delete-dups (delq nil (delete "" defaults)))) + (default (car defaults)) ;; Do not automatically add default to the history for empty input. (history-add-new-input nil) (input (read-from-minibuffer