Merge pull request #345 from DamienCassou/goto-begin-end-of-message

* better `M-<` and `M->` when composing a message.
This commit is contained in:
Dirk-Jan C. Binnema 2014-01-24 16:28:14 -08:00
commit d6890a7d42
1 changed files with 30 additions and 0 deletions

View File

@ -589,6 +589,36 @@ Ie. either 'name <email>' 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-signature-separator 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