diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 19b3e63a..8ccb97e2 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -589,6 +589,36 @@ Ie. either 'name ' or 'email')." (message-goto-body))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun mu4e-compose-goto-top () + "Go to the beginning of the message or buffer. +Go to the beginning of the message or, if already there, go to the +beginning of the buffer." + (interactive) + (let ((old-position (point))) + (message-goto-body) + (when (equal (point) old-position) + (beginning-of-buffer)))) + +(define-key mu4e-compose-mode-map + (vector 'remap 'beginning-of-buffer) 'mu4e-compose-goto-top) + +(defun mu4e-compose-goto-bottom () + "Go to the end of the message or buffer. +Go to the end of the message (before signature) or, if already there, go to the +end of the buffer." + (interactive) + (let ((old-position (point)) + (message-position (save-excursion (message-goto-body) (point)))) + (end-of-buffer) + (when (re-search-backward "^-- $" message-position t) + (previous-line)) + (when (equal (point) old-position) + (end-of-buffer)))) + +(define-key mu4e-compose-mode-map + (vector 'remap 'end-of-buffer) 'mu4e-compose-goto-bottom) + (provide 'mu4e-compose) ;; Load mu4e completely even when this file was loaded through