From b3ab20634c2c965227769e27cb4aa01dc9a7728c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Wed, 21 May 2014 20:38:19 +0200 Subject: [PATCH 1/9] Various little changes --- mu4e/mu4e-main.el | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 1f608b72..1d71d3f9 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -95,9 +95,10 @@ clicked." (put-text-property (string-match "\\[.+$" newstr) (- (length newstr) 1) 'mouse-face 'highlight newstr) newstr)) - -(defun mu4e~main-view () - "Show the mu4e main view." +;; NEW +;; This is the old `mu4e~main-view' function but without +;; buffer switching at the end. +(defun mu4e:main-revert-buffer (ignore-auto noconfirm) (let ((buf (get-buffer-create mu4e~main-buffer-name)) (inhibit-read-only t)) (with-current-buffer buf @@ -150,13 +151,23 @@ clicked." (mu4e~main-action-str "\t* [A]bout mu4e\n" 'mu4e-about) (mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual) (mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit)) - (mu4e-main-mode) - (switch-to-buffer buf)))) + ))) + +(setq revert-buffer-function 'mu4e:main-revert-buffer) + +;; 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 +;; NEW +;; Toggle mail sending mode without switching (defun mu4e~main-toggle-mail-sending-mode () - "Toggle sending mail mode, either queued or direct." + "Toggle sending mail mode, either queued or direct (redefined)." (interactive) (let ((curpos (point))) (unless (file-directory-p smtpmail-queue-dir) @@ -165,8 +176,14 @@ clicked." (message (concat "Outgoing mail will now be " (if smtpmail-queue-mail "queued" "sent directly"))) - (mu4e~main-view) - ;; "queued" and "direct" have same length. + (mu4e:main-revert-buffer nil nil) (goto-char curpos))) +;; NEW +;; Toggle queuing in any mu4e menu +(dolist (keymap '(mu4e-main-mode-map mu4e-view-mode-map mu4e-compose-mode-map mu4e-headers-mode-map)) + (progn + (define-key (symbol-value keymap) (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)) + ) + (provide 'mu4e-main) From 118ce389a5e65f3a795ab7110eef735e21a33474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Wed, 21 May 2014 20:38:19 +0200 Subject: [PATCH 2/9] Various little changes --- mu4e/.#mu4e-actions.el | 1 + mu4e/mu4e-main.el | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) create mode 120000 mu4e/.#mu4e-actions.el diff --git a/mu4e/.#mu4e-actions.el b/mu4e/.#mu4e-actions.el new file mode 120000 index 00000000..b94b1c1c --- /dev/null +++ b/mu4e/.#mu4e-actions.el @@ -0,0 +1 @@ +taurgal@freeme.1182:1400696277 \ No newline at end of file diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 1f608b72..9bf889ed 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -95,9 +95,10 @@ clicked." (put-text-property (string-match "\\[.+$" newstr) (- (length newstr) 1) 'mouse-face 'highlight newstr) newstr)) - -(defun mu4e~main-view () - "Show the mu4e main view." +;; NEW +;; This is the old `mu4e~main-view' function but without +;; buffer switching at the end. +(defun mu4e:main-revert-buffer (ignore-auto noconfirm) (let ((buf (get-buffer-create mu4e~main-buffer-name)) (inhibit-read-only t)) (with-current-buffer buf @@ -150,13 +151,23 @@ clicked." (mu4e~main-action-str "\t* [A]bout mu4e\n" 'mu4e-about) (mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual) (mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit)) - (mu4e-main-mode) - (switch-to-buffer buf)))) + ))) + +(setq revert-buffer-function 'mu4e:main-revert-buffer) + +;; 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 +;; NEW +;; Toggle mail sending mode without switching (defun mu4e~main-toggle-mail-sending-mode () - "Toggle sending mail mode, either queued or direct." + "Toggle sending mail mode, either queued or direct (redefined)." (interactive) (let ((curpos (point))) (unless (file-directory-p smtpmail-queue-dir) @@ -165,8 +176,14 @@ clicked." (message (concat "Outgoing mail will now be " (if smtpmail-queue-mail "queued" "sent directly"))) - (mu4e~main-view) - ;; "queued" and "direct" have same length. + (mu4e:main-revert-buffer nil nil) (goto-char curpos))) +;; NEW +;; Toggle queuing in any mu4e menu +;; (dolist (keymap '(mu4e-main-mode-map mu4e-view-mode-map mu4e-compose-mode-map mu4e-headers-mode-map)) +;; (progn +;; (define-key (symbol-value keymap) (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)) +;; ) + (provide 'mu4e-main) From a02947b975cdacc993462a890999309c11f375b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Wed, 21 May 2014 21:33:02 +0200 Subject: [PATCH 3/9] revert-buffer support complete --- mu4e/.#mu4e-actions.el | 1 - mu4e/mu4e-main.el | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 120000 mu4e/.#mu4e-actions.el diff --git a/mu4e/.#mu4e-actions.el b/mu4e/.#mu4e-actions.el deleted file mode 120000 index b94b1c1c..00000000 --- a/mu4e/.#mu4e-actions.el +++ /dev/null @@ -1 +0,0 @@ -taurgal@freeme.1182:1400696277 \ No newline at end of file diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 9bf889ed..0272820a 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -167,7 +167,7 @@ clicked." ;; NEW ;; Toggle mail sending mode without switching (defun mu4e~main-toggle-mail-sending-mode () - "Toggle sending mail mode, either queued or direct (redefined)." + "Toggle sending mail mode, either queued or direct." (interactive) (let ((curpos (point))) (unless (file-directory-p smtpmail-queue-dir) From edfe1df20aae81dc910084af5131372d0fc00ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Wed, 21 May 2014 22:06:57 +0200 Subject: [PATCH 4/9] Set revert-buffer-function in the right place --- mu4e/mu4e-main.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 0272820a..6787d6ed 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -66,7 +66,9 @@ (use-local-map mu4e-main-mode-map) (setq truncate-lines t - overwrite-mode 'overwrite-mode-binary)) + overwrite-mode 'overwrite-mode-binary + (setq revert-buffer-function 'mu4e:main-revert-buffer) + )) (defun mu4e~main-action-str (str &optional func-or-shortcut) @@ -153,8 +155,6 @@ clicked." (mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit)) ))) -(setq revert-buffer-function 'mu4e:main-revert-buffer) - ;; NEW ;; Revert mu main buffer then switch to it (defun mu4e~main-view () From 20e8c9963ef2e3e4aeb3b396c025524913221dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Thu, 22 May 2014 22:49:02 +0200 Subject: [PATCH 5/9] Corrected a small bug --- mu4e/mu4e-main.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 6787d6ed..b4904723 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -67,7 +67,7 @@ (setq truncate-lines t overwrite-mode 'overwrite-mode-binary - (setq revert-buffer-function 'mu4e:main-revert-buffer) + revert-buffer-function 'mu4e:main-revert-buffer )) From 44d44f1a0ce1ffc03569789992b2858b36b4b97b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Sat, 24 May 2014 12:22:47 +0200 Subject: [PATCH 6/9] Added the forgotten (mu4e-main-mode) --- mu4e/mu4e-main.el | 1 + 1 file changed, 1 insertion(+) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index b4904723..b1e3a14a 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -153,6 +153,7 @@ clicked." (mu4e~main-action-str "\t* [A]bout mu4e\n" 'mu4e-about) (mu4e~main-action-str "\t* [H]elp\n" 'mu4e-display-manual) (mu4e~main-action-str "\t* [q]uit\n" 'mu4e-quit)) + (mu4e-main-mode) ))) ;; NEW From c426bc16211c1522d6351cfb73c6b61c1c96b57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Sat, 24 May 2014 14:44:39 +0200 Subject: [PATCH 7/9] Fixed the commented example at the end of the mu4e-main.el file. Now queuing/unqueuing should work fine in any mu4e mode if one executes those definitions. --- mu4e/mu4e-main.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index b1e3a14a..23fa4bdd 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -180,11 +180,12 @@ clicked." (mu4e:main-revert-buffer nil nil) (goto-char curpos))) -;; NEW -;; Toggle queuing in any mu4e menu -;; (dolist (keymap '(mu4e-main-mode-map mu4e-view-mode-map mu4e-compose-mode-map mu4e-headers-mode-map)) -;; (progn -;; (define-key (symbol-value keymap) (kbd "C-c m") 'mu4e~main-toggle-mail-sending-mode)) -;; ) + +;; (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) From fdbc1d6f9a7f82f422809af2942264f9c6a061b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Sat, 24 May 2014 19:30:13 +0200 Subject: [PATCH 8/9] Automatically insert a date field in the new drafts headers. So that one can see when a draft was composed when browsing the draft maildir (instead of getting "None" in the Date column). Then one can sort the drafts by date. --- mu4e/mu4e-draft.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index 0b622beb..9e17d05f 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -303,7 +303,9 @@ You can append flags." (defun mu4e~draft-common-construct () "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: " "String to prefix replies with.") From fe53c5a0f88ef238c718c74858ec43e60f44c087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bosch=C3=A9=20Aur=C3=A9lien?= Date: Sat, 24 May 2014 19:38:14 +0200 Subject: [PATCH 9/9] Added a missing ";; New" comment. --- mu4e/mu4e-draft.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index 9e17d05f..63c42867 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -301,6 +301,9 @@ You can append flags." (format-time-string "%Y%m%d" (current-time)) (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 () "Construct the common headers for each message." (mu4e~draft-header "User-agent" (mu4e~draft-user-agent-construct))