emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111803: (read-regexp): Add regexp fo


From: Jambunathan K
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111803: (read-regexp): Add regexp for symbol at point to the defaults (Bug#13687).
Date: Sat, 16 Feb 2013 14:56:42 +0530
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111803
committer: Jambunathan K <address@hidden>
branch nick: trunk
timestamp: Sat 2013-02-16 14:56:42 +0530
message:
  (read-regexp): Add regexp for symbol at point to the defaults (Bug#13687).
  
  * lisp/replace.el (read-regexp): Tighten the regexp that matches tag.
  When tag is retrieved with `find-tag-default', use regexp that
  matches tag at point.  Also update docstring.
modified:
  lisp/ChangeLog
  lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-02-16 09:13:40 +0000
+++ b/lisp/ChangeLog    2013-02-16 09:26:42 +0000
@@ -1,3 +1,9 @@
+2013-02-16  Jambunathan K  <address@hidden>
+
+       * replace.el (read-regexp): Tighten the regexp that matches tag.
+       When tag is retrieved with `find-tag-default', use regexp that
+       matches tag at point.  Also update docstring (Bug#13687).
+
 2013-02-16  Eli Zaretskii  <address@hidden>
 
        * autorevert.el (auto-revert-notify-add-watch): With 'w32notify',

=== modified file 'lisp/replace.el'
--- a/lisp/replace.el   2013-02-01 23:38:41 +0000
+++ b/lisp/replace.el   2013-02-16 09:26:42 +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
+           (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]