;;; gnorb-bbdb.el --- The BBDB-centric functions of gnorb
-;; Copyright (C) 2014 Eric Abrahamsen
+;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
;; Keywords:
;;; Code:
(require 'gnorb-utils)
+(require 'cl-lib)
(defgroup gnorb-bbdb nil
"The BBDB bits of gnorb."
:group 'gnorb-bbdb
:type 'symbol)
-(unless (assoc gnorb-bbdb-org-tag-field bbdb-separator-alist)
- (push `(,gnorb-bbdb-org-tag-field ":" ":") bbdb-separator-alist))
+(when (boundp 'bbdb-separator-alist) ;Allow compilation if BBDB is absent!
+ (unless (assoc gnorb-bbdb-org-tag-field bbdb-separator-alist)
+ (push `(,gnorb-bbdb-org-tag-field ":" ":") bbdb-separator-alist)))
(defcustom gnorb-bbdb-messages-field 'messages
"The name (as a symbol) of the field where links to recent gnus
Defaults to org-link."
:group 'gnorb-bbdb)
-(defstruct gnorb-bbdb-link
+(cl-defstruct gnorb-bbdb-link
subject date group id)
(defcustom gnorb-bbdb-posting-styles nil
An example value might look like:"
:group 'gnorb-bbdb)
+(defvar message-mode-hook)
+
;;;###autoload
(defun gnorb-bbdb-mail (records &optional subject n verbose)
"\\<bbdb-mode-map>Acts just like `bbdb-mail', except runs
(mapconcat
'identity
(delete-dups
- (mapcan (lambda (r)
+ (cl-mapcan (lambda (r)
(bbdb-record-xfield-split r gnorb-bbdb-org-tag-field))
records))
"|")))
(if tag-string
;; C-u = all headings, not just todos
- (if (equal current-prefix-arg '(4))
- (org-tags-view nil tag-string)
- (org-tags-view t tag-string))
+ (org-tags-view (not (equal current-prefix-arg '(4)))
+ tag-string)
(error "No org-tags field present"))))
;;;###autoload
gnorb-gnus-mail-search-backends)
(error "No search backend specified")))
(search-string
- (funcall (second backend)
+ (funcall (cl-second backend)
(cl-mapcan 'bbdb-record-mail records))))
(when (equal current-prefix-arg '(4))
(setq search-string
(read-from-minibuffer
- (format "%s search string: " (first backend)) search-string)))
- (funcall (third backend) search-string)
+ (format "%s search string: " (cl-first backend)) search-string)))
+ (funcall (cl-third backend) search-string)
(delete-other-windows)))
;;;###autoload
;;; Field containing links to recent messages
-(add-to-list 'bbdb-xfield-label-list gnorb-bbdb-messages-field nil 'eq)
+(when (boundp 'bbdb-xfield-label-list)
+ (add-to-list 'bbdb-xfield-label-list gnorb-bbdb-messages-field nil 'eq))
(defun gnorb-bbdb-display-messages (record format)
"Show links to the messages collected in the
'mouse-face 'highlight
'gnorb-bbdb-link-count count
'keymap map)
- (incf count)))
+ (cl-incf count)))
val (if (eq format 'multi)
"\n" ", "))
indent)
(time-less-p
(gnorb-bbdb-link-date b)
(gnorb-bbdb-link-date a))))))
- (setq val (subseq val 0 gnorb-bbdb-collect-N-messages))
+ (setq val (cl-subseq val 0 gnorb-bbdb-collect-N-messages))
(bbdb-record-set-xfield record
gnorb-bbdb-messages-field
(delq nil val))