[emacs] remove shell-toggle
[~bandali/configs] / lisp / bbdb / bbdb-gnus.el
... / ...
CommitLineData
1;;; bbdb-gnus.el --- BBDB interface to Gnus -*- lexical-binding: t -*-
2
3;; Copyright (C) 2010-2017 Free Software Foundation, Inc.
4
5;; This file is part of the Insidious Big Brother Database (aka BBDB),
6
7;; BBDB is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; BBDB is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with BBDB. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Commentary:
21;;; This file contains the BBDB interface to Gnus.
22;;; See the BBDB info manual for documentation.
23
24;;; Code:
25
26(require 'bbdb)
27(require 'bbdb-com)
28(require 'bbdb-mua)
29(require 'gnus)
30
31;;; Insinuation
32
33;;;###autoload
34(defun bbdb-insinuate-gnus ()
35 "Hook BBDB into Gnus.
36Do not call this in your init file. Use `bbdb-initialize'."
37 ;; `bbdb-mua-display-sender' fails in *Article* buffers, where
38 ;; `gnus-article-read-summary-keys' provides an additional wrapper
39 ;; that restores the window configuration.
40 (define-key gnus-summary-mode-map ":" 'bbdb-mua-display-sender)
41 (define-key gnus-article-mode-map ":" 'bbdb-mua-display-sender)
42 ;; For `bbdb-mua-edit-field-sender' it is probably OK if
43 ;;`gnus-article-read-summary-keys' restores the window configuration.
44 (define-key gnus-summary-mode-map ";" 'bbdb-mua-edit-field-sender)
45 (define-key gnus-article-mode-map ";" 'bbdb-mua-edit-field-sender)
46 ;; Do we need keybindings for more commands? Suggestions welcome.
47 ;; (define-key gnus-summary-mode-map ":" 'bbdb-mua-display-records)
48 ;; (define-key gnus-summary-mode-map "'" 'bbdb-mua-display-recipients)
49 ;; (define-key gnus-summary-mode-map ";" 'bbdb-mua-edit-field-recipients)
50
51 ;; Set up user field for use in `gnus-summary-line-format'
52 ;; (1) Big solution: use whole name
53 (if bbdb-mua-summary-unify-format-letter
54 (fset (intern (concat "gnus-user-format-function-"
55 bbdb-mua-summary-unify-format-letter))
56 (lambda (header)
57 (bbdb-mua-summary-unify (mail-header-from header)))))
58
59 ;; (2) Small solution: a mark for messages whos sender is in BBDB.
60 (if bbdb-mua-summary-mark-format-letter
61 (fset (intern (concat "gnus-user-format-function-"
62 bbdb-mua-summary-mark-format-letter))
63 (lambda (header)
64 (bbdb-mua-summary-mark (mail-header-from header))))))
65
66(provide 'bbdb-gnus)
67
68;;; bbdb-gnus.el ends here