emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/bbdb d703cea: * bbdb-com.el (bbdb-search-read): Make ac


From: Roland Winkler
Subject: [elpa] externals/bbdb d703cea: * bbdb-com.el (bbdb-search-read): Make active region the default.
Date: Sat, 8 Jun 2019 23:38:24 -0400 (EDT)

branch: externals/bbdb
commit d703cea6e3ef054bc3ff0e8914c6602c10ebf0b9
Author: Roland Winkler <address@hidden>
Commit: Roland Winkler <address@hidden>

    * bbdb-com.el (bbdb-search-read): Make active region the default.
---
 bbdb-com.el | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/bbdb-com.el b/bbdb-com.el
index d0e9879..7396557 100644
--- a/bbdb-com.el
+++ b/bbdb-com.el
@@ -410,10 +410,19 @@ This usage is discouraged."
        (nreverse ,matches))))
 
 (defun bbdb-search-read (&optional field)
-  "Read regexp to search FIELD values of records."
-  (read-string (format "Search records%s %smatching regexp: "
-                       (if field (concat " with " field) "")
-                       (if bbdb-search-invert "not " ""))))
+  "Read regexp to search FIELD values of records.
+When region is active make it the default string to match."
+  (let ((default (if (and (region-active-p)
+                          (< (region-beginning) (region-end)))
+                     (regexp-quote
+                      (buffer-substring-no-properties
+                       (region-beginning) (region-end))))))
+    (prog1 (read-string (format "Search records%s %smatching regexp: %s"
+                                (if field (concat " with " field) "")
+                                (if bbdb-search-invert "not " "")
+                                (if default (format "(default %s) " default) 
""))
+                        nil nil default)
+      (if default (deactivate-mark)))))
 
 ;;;###autoload
 (defun bbdb (regexp &optional layout)
@@ -570,7 +579,9 @@ which is probably more suited for your needs."
   "Search all records that have duplicate entries for FIELDS.
 The list FIELDS may contain the symbols `name', `mail', and `aka'.
 If FIELDS is nil use all these fields.  With prefix, query for FIELDS.
-The search results are displayed in the BBDB buffer."
+The search results are displayed in the BBDB buffer.
+The command `bbdb-merge-records' may come handy for merging duplicate
+records."
   (interactive (list (if current-prefix-arg
                          (list (intern (completing-read "Field: "
                                                         '("name" "mail" "aka")



reply via email to

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