Merge pull request #430 from taurgal/master
* mu4e: Add revert-buffer support to the mu4e main buffer
This commit is contained in:
@ -301,9 +301,14 @@ You can append flags."
|
|||||||
(format-time-string "%Y%m%d" (current-time))
|
(format-time-string "%Y%m%d" (current-time))
|
||||||
(random 255) (random 65535) hostname (or flagstr ""))))
|
(random 255) (random 65535) hostname (or flagstr ""))))
|
||||||
|
|
||||||
|
;; New
|
||||||
|
;; Automatically add a date to new drafts, so one can
|
||||||
|
;; sort drafts by date.
|
||||||
(defun mu4e~draft-common-construct ()
|
(defun mu4e~draft-common-construct ()
|
||||||
"Construct the common headers for each message."
|
"Construct the common headers for each message."
|
||||||
(mu4e~draft-header "User-agent" (mu4e~draft-user-agent-construct)))
|
(mu4e~draft-header "User-agent" (mu4e~draft-user-agent-construct))
|
||||||
|
(mu4e~draft-header "Date" (message-make-date)))
|
||||||
|
|
||||||
|
|
||||||
(defconst mu4e~draft-reply-prefix "Re: "
|
(defconst mu4e~draft-reply-prefix "Re: "
|
||||||
"String to prefix replies with.")
|
"String to prefix replies with.")
|
||||||
|
|||||||
@ -66,7 +66,9 @@
|
|||||||
(use-local-map mu4e-main-mode-map)
|
(use-local-map mu4e-main-mode-map)
|
||||||
(setq
|
(setq
|
||||||
truncate-lines t
|
truncate-lines t
|
||||||
overwrite-mode 'overwrite-mode-binary))
|
overwrite-mode 'overwrite-mode-binary
|
||||||
|
revert-buffer-function 'mu4e:main-revert-buffer
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~main-action-str (str &optional func-or-shortcut)
|
(defun mu4e~main-action-str (str &optional func-or-shortcut)
|
||||||
@ -95,9 +97,10 @@ clicked."
|
|||||||
(put-text-property (string-match "\\[.+$" newstr)
|
(put-text-property (string-match "\\[.+$" newstr)
|
||||||
(- (length newstr) 1) 'mouse-face 'highlight newstr) newstr))
|
(- (length newstr) 1) 'mouse-face 'highlight newstr) newstr))
|
||||||
|
|
||||||
|
;; NEW
|
||||||
(defun mu4e~main-view ()
|
;; This is the old `mu4e~main-view' function but without
|
||||||
"Show the mu4e main view."
|
;; buffer switching at the end.
|
||||||
|
(defun mu4e:main-revert-buffer (ignore-auto noconfirm)
|
||||||
(let ((buf (get-buffer-create mu4e~main-buffer-name))
|
(let ((buf (get-buffer-create mu4e~main-buffer-name))
|
||||||
(inhibit-read-only t))
|
(inhibit-read-only t))
|
||||||
(with-current-buffer buf
|
(with-current-buffer buf
|
||||||
@ -151,10 +154,19 @@ clicked."
|
|||||||
(mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual)
|
(mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual)
|
||||||
(mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit))
|
(mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit))
|
||||||
(mu4e-main-mode)
|
(mu4e-main-mode)
|
||||||
(switch-to-buffer buf))))
|
)))
|
||||||
|
|
||||||
|
;; NEW
|
||||||
|
;; Revert mu main buffer then switch to it
|
||||||
|
(defun mu4e~main-view ()
|
||||||
|
"Show the mu4e main view."
|
||||||
|
(mu4e:main-revert-buffer nil nil)
|
||||||
|
(switch-to-buffer mu4e~main-buffer-name))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Interactive functions
|
;; Interactive functions
|
||||||
|
;; NEW
|
||||||
|
;; Toggle mail sending mode without switching
|
||||||
(defun mu4e~main-toggle-mail-sending-mode ()
|
(defun mu4e~main-toggle-mail-sending-mode ()
|
||||||
"Toggle sending mail mode, either queued or direct."
|
"Toggle sending mail mode, either queued or direct."
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -165,8 +177,15 @@ clicked."
|
|||||||
(message
|
(message
|
||||||
(concat "Outgoing mail will now be "
|
(concat "Outgoing mail will now be "
|
||||||
(if smtpmail-queue-mail "queued" "sent directly")))
|
(if smtpmail-queue-mail "queued" "sent directly")))
|
||||||
(mu4e~main-view)
|
(mu4e:main-revert-buffer nil nil)
|
||||||
;; "queued" and "direct" have same length.
|
|
||||||
(goto-char curpos)))
|
(goto-char curpos)))
|
||||||
|
|
||||||
|
|
||||||
|
;; (progn
|
||||||
|
;; (define-key mu4e-compose-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
|
||||||
|
;; (define-key mu4e-view-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
|
||||||
|
;; (define-key mu4e-compose-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
|
||||||
|
;; (define-key mu4e-headers-mode-map (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)
|
||||||
|
;; )
|
||||||
|
|
||||||
(provide 'mu4e-main)
|
(provide 'mu4e-main)
|
||||||
|
|||||||
Reference in New Issue
Block a user