mu4e: context: integrate with the views

Show the current context in headers, view and main mode; add
keybindings.
This commit is contained in:
djcb 2015-12-13 17:42:27 +02:00
parent 47f7f1b85a
commit f621003658
4 changed files with 31 additions and 18 deletions

View File

@ -625,7 +625,8 @@ after the end of the search results."
(define-key map (kbd "<C-kp-add>") 'mu4e-headers-split-view-grow)
(define-key map (kbd "<C-kp-subtract>") 'mu4e-headers-split-view-shrink)
(define-key map ";" 'mu4e-context-switch)
;; switching to view mode (if it's visible)
(define-key map "y" 'mu4e-select-other-view)
@ -946,8 +947,6 @@ docid is not found."
(unless ignore-missing
(mu4e-error "Cannot find message with docid %S" docid)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun mu4e~headers-search-execute (expr ignore-history)
"Search in the mu database for EXPR, and switch to the output
@ -969,8 +968,13 @@ the query history stack."
mu4e~headers-buffer buf
mode-name "mu4e-headers"
mu4e~headers-last-query expr
global-mode-string (propertize mu4e~headers-last-query
'face 'mu4e-modeline-face)))
global-mode-string
'(:eval
(concat
(propertize mu4e~headers-last-query 'face 'mu4e-modeline-face)
" "
(mu4e-context-label)))))
(switch-to-buffer buf)
(mu4e~proc-find
expr

View File

@ -26,6 +26,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'smtpmail) ;; the queing stuff (silence elint)
(require 'mu4e-utils) ;; utility functions
(require 'mu4e-context) ;; the context
(defconst mu4e~main-buffer-name " *mu4e-main*"
@ -53,7 +54,7 @@
(define-key map "S" 'mu4e-interrupt-update-mail)
(define-key map (kbd "C-S-u") 'mu4e-update-mail-and-index)
(define-key map ";" 'mu4e-context-switch)
(define-key map "$" 'mu4e-show-log)
(define-key map "A" 'mu4e-about)
@ -110,8 +111,8 @@ clicked."
(erase-buffer)
(insert
"* "
(propertize "mu4e - mu for emacs version " 'face 'mu4e-title-face)
(propertize mu4e-mu-version 'face 'mu4e-header-key-face)
(propertize "mu4e - mu for emacs version " 'face 'mu4e-title-face)
(propertize mu4e-mu-version 'face 'mu4e-header-key-face)
;; show some server properties; in this case; a big C when there's
;; crypto support, a big G when there's Guile support
@ -120,7 +121,8 @@ clicked."
(concat
(when (plist-get mu4e~server-props :crypto) "C")
(when (plist-get mu4e~server-props :guile) "G"))
'face 'mu4e-title-face)
'face 'mu4e-title-face)
"\n\n"
(propertize " Basics\n\n" 'face 'mu4e-title-face)
(mu4e~main-action-str "\t* [j]ump to some maildir\n" 'mu4e-jump-to-maildir)
@ -139,12 +141,14 @@ clicked."
"\n\n"
(propertize " Misc\n\n" 'face 'mu4e-title-face)
(mu4e~main-action-str "\t* [U]pdate email & database\n"
'mu4e-update-mail-and-index)
(mu4e~main-action-str "\t* [;]Switch focus\n" 'mu4e-context-switch)
(mu4e~main-action-str "\t* [U]pdate email & database\n"
'mu4e-update-mail-and-index)
;; show the queue functions if `smtpmail-queue-dir' is defined
(if (file-directory-p smtpmail-queue-dir)
(mu4e~main-view-queue)
(if (file-directory-p smtpmail-queue-dir)
(mu4e~main-view-queue)
"")
"\n"
(mu4e~main-action-str "\t* [N]ews\n" 'mu4e-news)
@ -186,7 +190,9 @@ clicked."
"Create the mu4e main-view, and switch to it."
(mu4e~main-view-real nil nil)
(switch-to-buffer mu4e~main-buffer-name)
(goto-char (point-min)))
(goto-char (point-min))
(setq global-mode-string '(:eval (mu4e-context-label))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Interactive functions
;; NEW

View File

@ -576,6 +576,8 @@ FUNC should be a function taking two arguments:
(define-key map "|" 'mu4e-view-pipe)
(define-key map "a" 'mu4e-view-action)
(define-key map ";" 'mu4e-context-switch)
;; toggle header settings
(define-key map "O" 'mu4e-headers-change-sorting)
(define-key map "P" 'mu4e-headers-toggle-threading)
@ -707,7 +709,6 @@ FUNC should be a function taking two arguments:
(define-key menumap [search]
'("Search" . mu4e-headers-search))
(define-key menumap [sepa4] '("--"))
(define-key menumap [next] '("Next" . mu4e-view-headers-next))
(define-key menumap [previous] '("Previous" . mu4e-view-headers-prev)))
@ -733,8 +734,10 @@ FUNC should be a function taking two arguments:
(make-local-variable 'mu4e~view-attach-map)
(make-local-variable 'mu4e~view-cited-hidden)
(setq buffer-undo-list t) ;; don't record undo info
(setq buffer-undo-list t ;; don't record undo info
global-mode-string ;; show context in mode-line
'(:eval (mu4e-context-label)))
;; autopair mode gives error when pressing RET
;; turn it off
(when (boundp 'autopair-dont-activate)

View File

@ -35,9 +35,9 @@
(require 'mu4e-compose) ;; message composition / sending
(require 'mu4e-proc) ;; communication with backend
(require 'mu4e-utils) ;; utility functions
(require 'mu4e-context) ;; support for contexts
(require 'mu4e-speedbar) ;; support for speedbar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; register our handler functions; these connect server messages to functions