diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2021-11-07 11:43:17 +0200 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2021-11-13 08:24:48 +0200 |
| commit | 6b3ee33b1a2028136b5c0001a0d9e7422c2f7231 (patch) | |
| tree | 3d160ec6d2aeb21d4368de949871fbff83a18c2d | |
| parent | 7345edc21d348f3d7d87692b106d1f7a372e0dd6 (diff) | |
mu4e-compose: make undo work across compose saves
Hide the header-separator change from the user-visible undo.
| -rw-r--r-- | mu4e/mu4e-compose.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index d7b1478..0a6c16e 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -360,8 +360,12 @@ Message-ID." #'mu4e~compose-after-save-hook-fn nil t)) +(defvar-local mu4e~compose-undo nil + "Remember the undo-state.") + (defun mu4e~compose-before-save-hook-fn () "Add the message-id if necessary and update the date." + (setq mu4e~compose-undo buffer-undo-list) (save-excursion (save-restriction (message-narrow-to-headers) @@ -381,7 +385,8 @@ Message-ID." (set-buffer-modified-p nil) (mu4e-message "Saved (%d lines)" (count-lines (point-min) (point-max))) ;; update the file on disk -- ie., without the separator - (mu4e~proc-add (buffer-file-name)))) + (mu4e~proc-add (buffer-file-name))) + (setq buffer-undo-list mu4e~compose-undo)) ;;; address completion |
