Alex Schroeder <[EMAIL PROTECTED]> writes:
> Alex Schroeder <[EMAIL PROTECTED]> writes:
>
>> There is, however, no way to search for people without phone numbers,
>> or all people without an address matching "gnu". Do you think this is
>> important?
Ok, so I was bored. Now you can also search for stuff *not* matching
something, for example for all people whose name do not contain the
letter a. I'm still not sure such a thing is actually needed,
though. Plus I think the user interface is bad. At the moment you
have to call M-x bbdb-search-invert-set to invert the meaning of the
next search.
I'll leave it up to other people to decide wether such code is worth
having in the BBDB.
Alex.
*** bbdb-com.el.~1.136.~ Mon Jan 21 23:02:54 2002
--- bbdb-com.el Mon Jan 21 23:35:09 2002
***************
*** 77,85 ****
'bbdb-display-layout))
(defmacro bbdb-search (records &optional name company net notes phone)
! ;; this macro only emits code for those things being searched for;
! ;; literal nils at compile-time cause no code to be emitted.
(let (clauses)
;; I didn't protect these vars from multiple evaluation because that
;; actually generates *less efficient code* in elisp, because the extra
--- 77,109 ----
'bbdb-display-layout))
+ (defvar bbdb-search-invert nil
+ "Bind this variable to t in order to invert the result of `bbdb-search'.
+
+ \(let ((bbdb-search-invert t))
+ \(bbdb-search records foo foo))")
+
+ (defun bbdb-search-invert-get ()
+ "Return `bbdb-search-invert' and set it to nil.
+ To set it on again, use `bbdb-search-invert-set'."
+ (let ((result bbdb-search-invert))
+ (setq bbdb-search-invert nil)
+ result))
+
+ (defun bbdb-search-invert-set ()
+ "Set `bbdb-search-invert' to t.
+ This will invert the meaning of the next search command.
+ You will have to call this function again, if you want to
+ do repeated inverted searches."
+ (interactive)
+ (setq bbdb-search-invert t))
+
(defmacro bbdb-search (records &optional name company net notes phone)
! "Search RECORDS for optional arguments NAME, COMPANY, NET, NOTES, PHONE.
! This macro only emits code for those things being searched for;
! literal nils at compile-time cause no code to be emitted.
!
! If you want to reverse the search, bind `bbdb-search-invert' to t."
(let (clauses)
;; I didn't protect these vars from multiple evaluation because that
;; actually generates *less efficient code* in elisp, because the extra
***************
*** 170,183 ****
nil))
(case-fold-search bbdb-case-fold-search)
(records (, records))
record)
(while records
(setq record (car records))
! (if (or (,@ clauses))
! (setq matches (cons record matches)))
! (setq records (cdr records)))
(nreverse matches)))))
-
;;;###autoload
(defun bbdb (string elidep)
--- 194,210 ----
nil))
(case-fold-search bbdb-case-fold-search)
(records (, records))
+ (invert (bbdb-search-invert-get))
record)
(while records
(setq record (car records))
! (if (or (and invert
! (not (or (,@ clauses))))
! (and (not invert)
! (or (,@ clauses))))
! (setq matches (cons record matches)))
! (setq records (cdr records)))
(nreverse matches)))))
;;;###autoload
(defun bbdb (string elidep)
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/