>From 97e6adcdd8813d9f857972f0e5f5ba5bbb2fc406 Mon Sep 17 00:00:00 2001
Date: Fri, 29 Apr 2011 14:41:51 +0800
Subject: [PATCH] Default to current record in bbdb-completing-read-records

For example, this is useful for `/ 1' to quickly limit to current
record.
---
 lisp/bbdb-com.el |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lisp/bbdb-com.el b/lisp/bbdb-com.el
index e663f944..7ce8898d 100644
--- a/lisp/bbdb-com.el
+++ b/lisp/bbdb-com.el
@@ -1933,16 +1933,19 @@ (defun bbdb-completing-read-records (prompt &optional 
omit-records)
 Completion is done according to `bbdb-completion-list'.  If the user
 just hits return, nil is returned.  Otherwise, a valid response is forced."
   (let* ((completion-ignore-case t)
+         (default (ignore-errors
+                    (downcase (bbdb-record-name (bbdb-current-record)))))
          (string (completing-read prompt bbdb-hashtable
-                                  'bbdb-completion-predicate t))
+                                  'bbdb-completion-predicate t nil nil
+                                  default))
          symbol ret)
-  (unless (string= "" string)
-    (setq symbol (intern-soft string bbdb-hashtable))
-    (if (and (boundp symbol) (symbol-value symbol))
-        (dolist (record (symbol-value symbol) (delete-dups ret))
-          (if (not (memq record omit-records))
-              (push record ret)))
-      (error "Selecting deleted (unhashed) record \"%s\"" symbol)))))
+    (unless (string= "" string)
+      (setq symbol (intern-soft string bbdb-hashtable))
+      (if (and (boundp symbol) (symbol-value symbol))
+          (dolist (record (symbol-value symbol) (delete-dups ret))
+            (if (not (memq record omit-records))
+                (push record ret)))
+        (error "Selecting deleted (unhashed) record \"%s\"" symbol)))))
 
 (defun bbdb-completing-read-record (prompt &optional omit-records)
   "Prompt for and return a single record from the bbdb;
-- 
1.7.5-rc2



------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to