0f523d407fcf25eec16bce1096201c2f47e0783c
[~bandali/configs] / lisp / bbdb / bbdb-wl.el
1 ;;; bbdb-wl.el --- BBDB interface to Wanderlust -*- lexical-binding: t -*-
2
3 ;; Copyright (C) 2015-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 Wl.
22 ;; See the BBDB info manual for documentation.
23
24 ;;; Code:
25
26 (require 'bbdb)
27 (require 'bbdb-mua)
28
29 (defvar wl-summary-mode-map)
30 (defvar wl-draft-mode-map)
31 (defvar wl-summary-buffer-elmo-folder)
32 (eval-and-compile
33 (autoload 'wl-summary-message-number "wl-summary")
34 (autoload 'elmo-message-entity "elmo-msgdb")
35 (autoload 'elmo-message-entity-field "elmo-msgdb"))
36
37 ;;;###autoload
38 (defun bbdb/wl-header (header)
39 (elmo-message-entity-field
40 (elmo-message-entity wl-summary-buffer-elmo-folder
41 (wl-summary-message-number))
42 (intern (downcase header)) 'string))
43
44 ;;;###autoload
45 (defun bbdb-insinuate-wl ()
46 "Hook BBDB into Wanderlust."
47 (define-key wl-summary-mode-map (kbd ":") #'bbdb-mua-display-sender)
48 (define-key wl-summary-mode-map (kbd ";") #'bbdb-mua-edit-field-sender)
49 (when bbdb-complete-mail
50 (define-key wl-draft-mode-map (kbd "M-;") #'bbdb-complete-mail)
51 (define-key wl-draft-mode-map (kbd "M-<tab>") #'bbdb-complete-mail)))
52
53 (provide 'bbdb-wl)
54
55 ;;; bbdb-wl.el ends here