Require `bbdb' here, and not during compilation.
* packages/gnorb/gnorb-utils.el: Don't require `cl'.
Don't require `bbdb', in case it's not installed.
* packages/gnorb/gnorb-registry.el: Require cl-lib. Use cl-lib names.
* packages/gnorb/gnorb-org.el: Require cl-lib. Use cl-lib names.
* packages/gnorb: Fix up copyright and compilation.
* packages/gnorb/gnorb-bbdb.el: Require `cl-lib'. Use cl-lib names.
(bbdb-separator-alist, bbdb-xfield-label-list): Check before use.
;;; 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))
;;; gnorb-gnus.el --- The gnus-centric fuctions of gnorb
-;; Copyright (C) 2014 Eric Abrahamsen
+;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
;; Keywords:
(defun gnorb-gnus-capture-abort-cleanup ()
(when (and org-note-abort
(org-capture-get :gnus-attachments))
- (condition-case error
+ ;; FIXME: Yuck: setting `abort-note' will fail as soon as org-capture.el is
+ ;; compiled with lexical-binding!
+ (condition-case nil
(progn (org-attach-delete-all)
(setq abort-note 'clean)
;; remove any gnorb-mail-header values here
"Message will trigger TODO state-changes after sending"
"A TODO will be made from this message after it's sent")))))
+(defvar org-capture-link-is-already-stored)
+
(defun gnorb-gnus-outgoing-make-todo-1 ()
(unless gnorb-gnus-new-todo-capture-key
(error "No capture template key set, customize gnorb-gnus-new-todo-capture-key"))
;;; gnorb-org.el --- The Org-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-org nil
"The Org bits of Gnorb."
strings)
((numberp gnorb-org-mail-scan-scope)
(delq nil
- (subseq
+ (cl-subseq
strings 0 (1+ gnorb-org-mail-scan-scope))))
;; We could provide more options here. 'tree vs
;; 'subtree, for instance.
(when assoc-msg-ids
(car
(sort
- (remove-if
+ (cl-remove-if
(lambda (m)
(let ((from (car (gnus-registry-get-id-key m 'sender))))
(or (null from)
(latest-msg-id
`(:gnus ,(list (gnorb-msg-id-to-link latest-msg-id)))))))
+(defvar message-beginning-of-line)
+
(defun gnorb-org-setup-message
(&optional messages mails from cc bcc attachments text ids)
"Common message setup routine for other gnorb-org commands.
(org-attach-file-list attach-dir))))
files)))
+(defvar message-mode-hook)
+
;;;###autoload
(defun gnorb-org-handle-mail (&optional arg text file)
"Handle current headline as a mail TODO.
the hey..."
:group 'gnorb-org)
+(defvar org-export-show-temporary-export-buffer)
+
;;;###autoload
(defun gnorb-org-email-subtree (&optional arg)
"Call on a subtree to export it either to a text string or a file,
"Export backend: "
(mapcar (lambda (b)
(symbol-name (org-export-backend-name b)))
- org-export--registered-backends) nil t))
+ org-export--registered-backends)
+ nil t))
(backend-symbol (intern backend-string))
(f-or-t (org-completing-read "Export as file or text? "
'("file" "text") nil t))
(setq tag-clause (cdr (org-make-tags-matcher str)))
(unless (equal str "")
(setq recs
- (remove-if-not
+ (cl-remove-if-not
(lambda (r)
(let ((rec-tags (bbdb-record-xfield
r gnorb-bbdb-org-tag-field)))
;;; gnorb-registry.el --- Registry implementation for Gnorb
-;; This file is in the public domain.
+;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net.>
;;; Code:
(require 'gnus-registry)
+(require 'cl-lib)
(defgroup gnorb-registry nil
"Gnorb's use of the Gnus registry."
(defun gnorb-registry-capture-abort-cleanup ()
(when (and (org-capture-get :gnorb-id)
org-note-abort)
- (condition-case error
+ (condition-case nil
(let* ((msg-id (format "<%s>" (plist-get org-store-link-plist :message-id)))
(existing-org-ids (gnus-registry-get-id-key msg-id 'gnorb-ids))
(org-id (org-capture-get :gnorb-id)))
(when (member org-id existing-org-ids)
(gnus-registry-set-id-key msg-id 'gnorb-ids
(remove org-id existing-org-ids)))
+ ;; FIXME: Yuck! This will fail as soon as org-capture.el is compiled
+ ;; with lexical-binding.
(setq abort-note 'clean))
(error
(setq abort-note 'dirty)))))
'gnus))
(dolist (l (plist-get links :gnus))
(gnorb-registry-make-entry
- (second (split-string l "#")) nil nil
- id (first (split-string l "#"))))
+ (cl-second (split-string l "#")) nil nil
+ id (cl-first (split-string l "#"))))
(dolist (p props)
(setq id )
(gnorb-registry-make-entry p nil nil id nil)
;; it.
(unless (gnus-registry-get-id-key p 'group)
(gnorb-msg-id-to-group p))
- (incf count)))))
+ (cl-incf count)))))
gnorb-org-find-candidates-match
'agenda 'archive 'comment)
(message "Collecting all relevant Org headings, this could take a while... done")
;;; gnorb-utils.el --- Common utilities for all gnorb stuff.
-;; Copyright (C) 2014 Eric Abrahamsen
+;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
;; Keywords:
;;; Code:
-(require 'cl)
(require 'mailcap)
(require 'gnus)
;(require 'message)
-(require 'bbdb)
+;; (require 'bbdb) ;Avoid compilation failure if BBDB is not available.
(require 'org)
(require 'org-bbdb)
(require 'org-gnus)
;;; gnorb.el --- Glue code between Gnus, Org, and BBDB
-;; Copyright (C) 2014 Eric Abrahamsen
+;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Version: 1
+;; Package-Requires: ((cl-lib "0.5"))
;; Maintainer: Eric Abrahamsen <eric@ericabrahamsen.net>
;;; Code:
+(if t (require 'bbdb)) ;`if'-trick avoids loading bbdb during compilation!
(require 'gnorb-utils)
(require 'nngnorb)
(require 'gnorb-gnus)
;;; nngnorb.el --- Gnorb backend for Gnus
-;; This file is in the public domain.
+;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Eric Abrahamsen <eric@ericabrahamsen.net.>