X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/a4a72c07ec3abd4f6a7a6c8dafee1e6bbf118062..f10533854f4c7bb54247a11981191bf37b70cb36:/packages/gnorb/gnorb-bbdb.el diff --git a/packages/gnorb/gnorb-bbdb.el b/packages/gnorb/gnorb-bbdb.el index eb2f6eb02..6603a5ed8 100644 --- a/packages/gnorb/gnorb-bbdb.el +++ b/packages/gnorb/gnorb-bbdb.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2014 Free Software Foundation, Inc. ;; Author: Eric Abrahamsen -;; Keywords: +;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ ;;; Commentary: -;; +;; ;;; Code: @@ -66,7 +66,7 @@ Setting it to the symbol seen will collect the messages most recently opened and viewed. The symbol received means gnorb will collect the most recent messages by Date header. -In other words, if this variable is set to 'received, and a +In other words, if this variable is set to `received', and a record's messages field is already full of recently-received messages, opening a five-year-old message (for instance) from this record will not push a link to the message into the field." @@ -89,9 +89,9 @@ mentioned in the docstring of `format-time-string', which see." (defcustom gnorb-bbdb-message-link-format-one "%:count" "How a single message is formatted in the list of recent messages. This format string is used in single-line display -- note that by -default, no user-created xfields are displayed in the 'one-line +default, no user-created xfields are displayed in the `one-line' layout found in `bbdb-layout-alist'. If you want this field to -appear there, put its name in the \"order\" list of the 'one-line +appear there, put its name in the \"order\" list of the `one-line' layout. Available information for each message includes the subject, the @@ -255,24 +255,34 @@ is non-nil (as in interactive calls) be verbose." (unless (fboundp field) ;; what's the record's existing value for this field? (setq rec-val (bbdb-record-field r field))) - (when (cond - ((eq field 'address) - (dolist (a rec-val) - (unless (and label - (not (string-match label (car a)))) - (string-match val (bbdb-format-address-default a))))) - ((eq field 'phone) - (dolist (p rec-val) - (unless (and label - (not (string-match label (car p)))) - (string-match val (bbdb-phone-string p))))) - ((consp rec-val) - (dolist (f rec-val) - (string-match val f))) - ((fboundp field) - (funcall field r)) - ((stringp rec-val) - (string-match val rec-val))) + (when (catch 'match + (cond + ((eq field 'address) + (dolist (a rec-val) + (unless (and label + (not (string-match label (car a)))) + (when + (string-match-p + val + (bbdb-format-address-default a)) + (throw 'match t))))) + ((eq field 'phone) + (dolist (p rec-val) + (unless (and label + (not (string-match label (car p)))) + (when + (string-match-p val (bbdb-phone-string p)) + (throw 'match t))))) + ((consp rec-val) + (dolist (f rec-val) + (when (string-match-p val f) + (throw 'match t)))) + ((fboundp field) + (when (string-match-p (funcall field r)) + (throw 'match t))) + ((stringp rec-val) + (when (string-match-p val rec-val) + (throw 'match t))))) ;; there are matches, run through the field setters in last ;; element of the sexp (dolist (attribute style)