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

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

[elpa] externals/ebdb dbf980e 288/350: Create specific keymap for using


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb dbf980e 288/350: Create specific keymap for using EBDB in MUAs
Date: Mon, 14 Aug 2017 11:46:55 -0400 (EDT)

branch: externals/ebdb
commit dbf980e41d67c69b07ba788a69336a2bc80d48b2
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Create specific keymap for using EBDB in MUAs
    
    * ebdb-mua.el (ebdb-mua-keymap): New keymap, to be bound to a certain
      key (aiming for ";" in all cases) in the MUA. This means everything
      is now two keystrokes, but there's a lot more room for growth.
    * ebdb-rmail.el: Bind in rmail.
    * ebdb-mu4e.el: Bind in mu4e.
    * ebdb-mhe.el: Bind in mhe.
    * ebdb-gnus.el: Bind in Gnus.
    * ebdb-message.el: Do *not* bind in either mail-mode or message-mode.
      The keymap as it stands is pretty tied to message-reading MUAs.
      Consider something separate for message-sending MUAs.
---
 ebdb-gnus.el    | 28 ++++------------------------
 ebdb-message.el |  7 ++-----
 ebdb-mhe.el     | 10 ++--------
 ebdb-mu4e.el    |  9 ++-------
 ebdb-mua.el     | 17 +++++++++++++++++
 ebdb-rmail.el   | 12 ++----------
 ebdb-vm.el      | 10 ++--------
 7 files changed, 31 insertions(+), 62 deletions(-)

diff --git a/ebdb-gnus.el b/ebdb-gnus.el
index ae4e69d..78394ca 100644
--- a/ebdb-gnus.el
+++ b/ebdb-gnus.el
@@ -477,16 +477,8 @@ quoted replies."
   ;; `ebdb-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 ";" 'ebdb-mua-update-records)
-  (define-key gnus-article-mode-map ";" 'ebdb-mua-update-records)
-  ;; For `ebdb-mua-edit-field-sender' it is probably OK if
-  ;;`gnus-article-read-summary-keys' restores the window configuration.
-  (define-key gnus-summary-mode-map ":" 'ebdb-mua-edit-field-sender)
-  (define-key gnus-article-mode-map ":" 'ebdb-mua-edit-field-sender)
-  ;; Do we need keybindings for more commands?  Suggestions welcome.
-  ;; (define-key gnus-summary-mode-map ":" 'ebdb-mua-display-records)
-  ;; (define-key gnus-summary-mode-map "'" 'ebdb-mua-display-recipients)
-  ;; (define-key gnus-summary-mode-map ";" 'ebdb-mua-edit-field-recipients)
+  (define-key gnus-summary-mode-map ";" ebdb-mua-keymap)
+  (define-key gnus-article-mode-map ";" ebdb-mua-keymap)
 
   ;; Set up user field for use in `gnus-summary-line-format'
   ;; (1) Big solution: use whole name
@@ -524,20 +516,8 @@ quoted replies."
       (fset (intern (concat "gnus-user-format-function-"
                             ebdb-mua-summary-mark-format-letter))
             (lambda (header)
-              (ebdb-mua-summary-mark (mail-header-from header)))))
-
-  ;; Scoring
-;  (add-hook 'ebdb-after-change-hook 'ebdb/gnus-score-invalidate-alist)
-  )
-  ;; (setq gnus-score-find-score-files-function
-  ;;  (if (boundp 'gnus-score-find-score-files-function)
-  ;;      (cond ((functionp gnus-score-find-score-files-function)
-  ;;             (list gnus-score-find-score-files-function 'ebdb/gnus-score))
-  ;;            ((listp gnus-score-find-score-files-function)
-  ;;             (append gnus-score-find-score-files-function 
'ebdb/gnus-score))
-  ;;            (t 'ebdb/gnus-score))
-  ;;    'ebdb/gnus-score))
+              (ebdb-mua-summary-mark (mail-header-from header))))))
 
 (provide 'ebdb-gnus)
 ;;; ebdb-gnus.el ends here
-;;; 
+;;;
diff --git a/ebdb-message.el b/ebdb-message.el
index 6218af5..f0573d5 100644
--- a/ebdb-message.el
+++ b/ebdb-message.el
@@ -69,6 +69,7 @@
   (list (get-buffer-window) 0.4))
 
 (defun ebdb-insinuate-message ()
+  ;; We don't currently bind the `ebdb-mua-keymap'.
   (when ebdb-complete-mail
     (cl-pushnew 
'("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):"
 . ebdb-complete-mail)
                message-completion-alist
@@ -83,11 +84,7 @@
 
 (defun ebdb-insinuate-mail ()
   "Hook EBDB into Mail Mode."
-  ;; Suggestions welcome: What are good keybindings for the following
-  ;; commands that do not collide with existing bindings?
-  ;; (define-key mail-mode-map "'" 'ebdb-mua-display-recipients)
-  ;; (define-key mail-mode-map ";" 'ebdb-mua-edit-field-recipients)
-  ;; (define-key mail-mode-map "/" 'ebdb)
+  ;; We don't currently bind the `ebdb-mua-keymap'.
   (if ebdb-complete-mail
       (define-key mail-mode-map "\M-\t" 'ebdb-complete-mail))
   (ebdb-undisplay-records))
diff --git a/ebdb-mhe.el b/ebdb-mhe.el
index cc971b3..2d7e2bc 100644
--- a/ebdb-mhe.el
+++ b/ebdb-mhe.el
@@ -115,14 +115,8 @@ Returns the empty string if HEADER is not in the message."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun ebdb-insinuate-mh ()
-  "Call this function to hook EBDB into MH-E.
-Do not call this in your init file.  Use `ebdb-initialize'."
-  (define-key mh-folder-mode-map ":" 'ebdb-mua-display-sender)
-  (define-key mh-folder-mode-map ";" 'ebdb-mua-edit-field-sender)
-  ;; Do we need keybindings for more commands?  Suggestions welcome.
-  ;; (define-key mh-folder-mode-map ":" 'ebdb-mua-display-records)
-  ;; (define-key mh-folder-mode-map "'" 'ebdb-mua-display-recipients)
-  ;; (define-key mh-folder-mode-map ";" 'ebdb-mua-edit-field-recipients)
+  "Hook EBDB into MH-E."
+  (define-key mh-folder-mode-map ";" ebdb-mua-keymap)
   (when ebdb-complete-mail
       (define-key mh-letter-mode-map "\M-;" 'ebdb-complete-mail)
       (define-key mh-letter-mode-map "\e\t" 'ebdb-complete-mail)))
diff --git a/ebdb-mu4e.el b/ebdb-mu4e.el
index 19182be..f2fcf75 100644
--- a/ebdb-mu4e.el
+++ b/ebdb-mu4e.el
@@ -39,14 +39,9 @@
   (format "*%s-mu4e*" ebdb-buffer-name))
 
 (defun ebdb-insinuate-mu4e ()
-  "Hook EBDB into mu4e.
-Do not call this in your init file.  Use `ebdb-initialize'."
+  "Hook EBDB into mu4e."
   ;; Tackle headers later
-  ;; (define-key mu4e-headers-mode-map ":" 'ebdb-mua-display-sender)
-  ;; (define-key mu4e-headers-mode-map ";" 'ebdb-mua-edit-field-sender)
-  ;; Do we need keybindings for more commands?  Suggestions welcome.
-  (define-key mu4e-view-mode-map ":" 'ebdb-mua-display-sender)
-  (define-key mu4e-view-mode-map ";" 'ebdb-mua-edit-field-sender))
+  (define-key mu4e-view-mode-map ";" ebdb-mua-keymap))
 
 ;; Why wasn't `ebdb-mua-auto-update' ever hooked in to mu4e?
 
diff --git a/ebdb-mua.el b/ebdb-mua.el
index c36f033..e8d8583 100644
--- a/ebdb-mua.el
+++ b/ebdb-mua.el
@@ -1118,6 +1118,23 @@ See `ebdb-mua-display-records' and friends for 
interactive commands."
          (ebdb-undisplay-records)))
     records))
 
+;; This keymap is clearly aimed at mail-reading MUAs.  Currently we
+;; don't bind it in either message-mode or mail-mode; consider
+;; creating different keymaps for mail-sending and mail-reading MUAs,
+;; and binding them separately.
+(defvar ebdb-mua-keymap
+  (let ((km (make-sparse-keymap)))
+    (define-key km (kbd ";") #'ebdb-mua-display-all-records)
+    (define-key km (kbd ":") #'ebdb-mua-update-records)
+    (define-key km (kbd "'") #'ebdb-mua-edit-sender-notes)
+    (define-key km (kbd "\"") #'ebdb-mua-in-ebdb-buffer)
+    (define-key km (kbd "s") #'ebdb-mua-snarf-article)
+    km)
+  "Common keymap for calling EBDB commands in an MUA.
+
+Keys have been chosen assuming that the keymap will be bound to
+\";\" in the MUA.")
+
 ;;; Mark EBDB records in the MUA summary buffer
 
 (defun ebdb-mua-summary-unify (address)
diff --git a/ebdb-rmail.el b/ebdb-rmail.el
index 4fec067..dfa1672 100644
--- a/ebdb-rmail.el
+++ b/ebdb-rmail.el
@@ -58,16 +58,8 @@
   (format "*%s-Rmail*" ebdb-buffer-name))
 
 (defun ebdb-insinuate-rmail ()
-  "Hook EBDB into RMAIL.
-Do not call this in your init file.  Use `ebdb-initialize'."
-  ;; Do we need keybindings for more commands?  Suggestions welcome.
-  ;; (define-key rmail-mode-map ":" 'ebdb-mua-display-records)
-  ;; (define-key rmail-mode-map "'" 'ebdb-mua-display-recipients)
-  (define-key rmail-mode-map ":" 'ebdb-mua-display-sender)
-  (define-key rmail-mode-map ";" 'ebdb-mua-edit-field-sender)
-  ;; (define-key rmail-mode-map ";" 'ebdb-mua-edit-field-recipients)
-  (define-key rmail-summary-mode-map ":" 'ebdb-mua-display-sender)
-  (define-key rmail-summary-mode-map ";" 'ebdb-mua-edit-field-sender))
+  "Hook EBDB into RMAIL."
+  (define-key rmail-mode-map ";" ebdb-mua-keymap))
 
 (add-hook 'rmail-mode-hook 'ebdb-insinuate-rmail)
 
diff --git a/ebdb-vm.el b/ebdb-vm.el
index 093c4ac..88f911e 100644
--- a/ebdb-vm.el
+++ b/ebdb-vm.el
@@ -335,14 +335,8 @@ from different senders."
 
 ;;;###autoload
 (defun ebdb-insinuate-vm ()
-  "Hook EBDB into VM.
-Do not call this in your init file.  Use `ebdb-initialize'."
-  (define-key vm-mode-map ":" 'ebdb-mua-display-records)
-  (define-key vm-mode-map "`" 'ebdb-mua-display-sender)
-  (define-key vm-mode-map "'" 'ebdb-mua-display-recipients)
-  (define-key vm-mode-map ";" 'ebdb-mua-edit-field-sender)
-  ;; Do we need keybindings for more commands?  Suggestions welcome.
-  ;; (define-key vm-mode-map "'" 'ebdb-mua-edit-field-recipients)
+  "Hook EBDB into VM."
+  (define-key vm-mode-map ";" ebdb-mua-keymap)
   (define-key vm-mode-map "/" 'ebdb)
   ;; `mail-mode-map' is the parent of `vm-mail-mode-map'.
   ;; So the following is also done by `ebdb-insinuate-mail'.



reply via email to

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