emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/bbdb c6082d6 2/2: Add files bbdb-gnus.el and bbdb-vm.el


From: Roland Winkler
Subject: [elpa] externals/bbdb c6082d6 2/2: Add files bbdb-gnus.el and bbdb-vm.el.
Date: Wed, 20 Dec 2017 01:38:30 -0500 (EST)

branch: externals/bbdb
commit c6082d6f3e7d136b8f13cec4e20c1129ca15691e
Author: Roland Winkler <address@hidden>
Commit: Roland Winkler <address@hidden>

    Add files bbdb-gnus.el and bbdb-vm.el.
---
 bbdb-gnus.el | 68 +++++++++++++++++++++++++++++++++++++++++++++++
 bbdb-vm.el   | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 154 insertions(+)

diff --git a/bbdb-gnus.el b/bbdb-gnus.el
new file mode 100644
index 0000000..c279c58
--- /dev/null
+++ b/bbdb-gnus.el
@@ -0,0 +1,68 @@
+;;; bbdb-gnus.el --- BBDB interface to Gnus -*- lexical-binding: t -*-
+
+;; Copyright (C) 2010-2017  Free Software Foundation, Inc.
+
+;; This file is part of the Insidious Big Brother Database (aka BBDB),
+
+;; BBDB is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; BBDB is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with BBDB.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;; This file contains the BBDB interface to Gnus.
+;;; See the BBDB info manual for documentation.
+
+;;; Code:
+
+(require 'bbdb)
+(require 'bbdb-com)
+(require 'bbdb-mua)
+(require 'gnus)
+
+;;; Insinuation
+
+;;;###autoload
+(defun bbdb-insinuate-gnus ()
+  "Hook BBDB into Gnus.
+Do not call this in your init file.  Use `bbdb-initialize'."
+  ;; `bbdb-mua-display-sender' fails in *Article* buffers, where
+  ;; `gnus-article-read-summary-keys' provides an additional wrapper
+  ;; that restores the window configuration.
+  (define-key gnus-summary-mode-map ":" 'bbdb-mua-display-sender)
+  (define-key gnus-article-mode-map ":" 'bbdb-mua-display-sender)
+  ;; For `bbdb-mua-edit-field-sender' it is probably OK if
+  ;;`gnus-article-read-summary-keys' restores the window configuration.
+  (define-key gnus-summary-mode-map ";" 'bbdb-mua-edit-field-sender)
+  (define-key gnus-article-mode-map ";" 'bbdb-mua-edit-field-sender)
+  ;; Do we need keybindings for more commands?  Suggestions welcome.
+  ;; (define-key gnus-summary-mode-map ":" 'bbdb-mua-display-records)
+  ;; (define-key gnus-summary-mode-map "'" 'bbdb-mua-display-recipients)
+  ;; (define-key gnus-summary-mode-map ";" 'bbdb-mua-edit-field-recipients)
+
+  ;; Set up user field for use in `gnus-summary-line-format'
+  ;; (1) Big solution: use whole name
+  (if bbdb-mua-summary-unify-format-letter
+      (fset (intern (concat "gnus-user-format-function-"
+                            bbdb-mua-summary-unify-format-letter))
+            (lambda (header)
+              (bbdb-mua-summary-unify (mail-header-from header)))))
+
+  ;; (2) Small solution: a mark for messages whos sender is in BBDB.
+  (if bbdb-mua-summary-mark-format-letter
+      (fset (intern (concat "gnus-user-format-function-"
+                            bbdb-mua-summary-mark-format-letter))
+            (lambda (header)
+              (bbdb-mua-summary-mark (mail-header-from header))))))
+
+(provide 'bbdb-gnus)
+
+;;; bbdb-gnus.el ends here
diff --git a/bbdb-vm.el b/bbdb-vm.el
new file mode 100644
index 0000000..07f158f
--- /dev/null
+++ b/bbdb-vm.el
@@ -0,0 +1,86 @@
+;;; bbdb-vm.el --- BBDB interface to VM -*- lexical-binding: t -*-
+
+;; Copyright (C) 2010-2017  Free Software Foundation, Inc.
+
+;; This file is part of the Insidious Big Brother Database (aka BBDB),
+
+;; BBDB is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; BBDB is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with BBDB.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;; This file contains the BBDB interface to VM.
+;;; See the BBDB info manual for documentation.
+
+;;; Code:
+
+(require 'bbdb)
+(require 'bbdb-com)
+(require 'bbdb-mua)
+(require 'vm-autoloads)
+(require 'vm-motion)
+(require 'vm-summary)
+(require 'vm-mime)
+(require 'vm-vars)
+(require 'vm-macro)
+(require 'vm-message)
+(require 'vm-misc)
+
+;;;###autoload
+(defun bbdb/vm-header (header)
+  (save-current-buffer
+    (vm-select-folder-buffer)
+    (vm-get-header-contents (car vm-message-pointer)
+                            (concat header ":"))))
+
+;;;###autoload
+(defun bbdb-insinuate-vm ()
+  "Hook BBDB into VM.
+Do not call this in your init file.  Use `bbdb-initialize'."
+  (define-key vm-mode-map ":" 'bbdb-mua-display-records)
+  (define-key vm-mode-map "`" 'bbdb-mua-display-sender)
+  (define-key vm-mode-map "'" 'bbdb-mua-display-recipients)
+  (define-key vm-mode-map ";" 'bbdb-mua-edit-field-sender)
+  ;; Do we need keybindings for more commands?  Suggestions welcome.
+  ;; (define-key vm-mode-map "'" 'bbdb-mua-edit-field-recipients)
+  (define-key vm-mode-map "/" 'bbdb)
+  ;; `mail-mode-map' is the parent of `vm-mail-mode-map'.
+  ;; So the following is also done by `bbdb-insinuate-mail'.
+  (if (and bbdb-complete-mail (boundp 'vm-mail-mode-map))
+      (define-key vm-mail-mode-map "\M-\t" 'bbdb-complete-mail))
+
+  ;; Set up user field for use in `vm-summary-format'
+  ;; (1) Big solution: use whole name
+  (if bbdb-mua-summary-unify-format-letter
+      (fset (intern (concat "vm-summary-function-"
+                            bbdb-mua-summary-unify-format-letter))
+            (lambda (m) (bbdb-mua-summary-unify
+                         ;; VM does not give us the original From header.
+                         ;; So we have to work backwards.
+                         (let ((name (vm-decode-mime-encoded-words-in-string
+                                      (vm-su-interesting-full-name m)))
+                               (mail (vm-su-from m)))
+                           (if (string= name mail) mail
+                             (format "\"%s\" <%s>" name mail)))))))
+
+  ;; (2) Small solution: a mark for messages whos sender is in BBDB.
+  (if bbdb-mua-summary-mark-format-letter
+      (fset (intern (concat "vm-summary-function-"
+                            bbdb-mua-summary-mark-format-letter))
+            ;; VM does not give us the original From header.
+            ;; So we assume that the mail address is sufficient to identify
+            ;; the BBDB record of the sender.
+            (lambda (m) (bbdb-mua-summary-mark (vm-su-from m))))))
+
+(provide 'bbdb-vm)
+
+;;; bbdb-vm.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]