[Mail] Move advice to attach at end-of-buffer to init.el

This commit is contained in:
Daniel - 2019-02-10 19:58:06 +01:00
parent b8912ae08d
commit f69abd6ec6
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
2 changed files with 23 additions and 26 deletions

13
init.el
View File

@ -1209,8 +1209,7 @@
db/gnus-save-newsrc-with-whitespace-1
db/gnus-summary-open-Link
db/gnus-html-mime-part-to-org
db/gnus-demon-scan-news-on-level-2
db/mml-attach-file--go-to-eob))
db/gnus-demon-scan-news-on-level-2))
(use-package bbdb
:commands (bbdb-search-name bbab-initialize bbdb-mua-auto-update-init bbdb-save)
@ -1581,6 +1580,16 @@
:defer t
:config (progn
;; Move to end of message buffer before attaching a file
;; http://mbork.pl/2015-11-28_Fixing_mml-attach-file_using_advice
(defun db/mml-attach-file--go-to-eob (orig-fun &rest args)
"Go to the end of buffer before attaching files."
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(apply orig-fun args))))
(advice-add 'mml-attach-file
:around #'db/mml-attach-file--go-to-eob)))

View File

@ -3,18 +3,18 @@
;;; Commentary:
;; This package consists mostly of utility functions for sending and editing
;; mail, fixing some issues, and extending Gnus in the way I like it. However,
;; the most important feature of is an abstract way to hande remote mail
;; accounts. Theses are stored in the variable `db/mail-accounts and consist
;; of various entries denoting how to read mail via IMAP (POP not supported) and
;; how to send mail via SMTP (server, port, protocol, …). Based on the entries
;; in this variable, appropriate settings of `gnus-secondary-select-methods are
;; derived automatically by the custom setter of `db/mail-accounts. Then when
;; inside Gnus, the mail can be read without further configuration. Note that
;; when the "IMAP address" of an entry in `db/mail-accounts is empty, it will
;; not be included as an IMAP account in `gnus-secondary-select-methods. This
;; lets you specify mail accounts that can be used for sending mail, but that
;; are read not directly via IMAP, but by other means (POP, offlineimap, …).
;; mail and extending Gnus in the way I like it. However, the most important
;; feature of is an abstract way to hande remote mail accounts. Theses are
;; stored in the variable `db/mail-accounts and consist of various entries
;; denoting how to read mail via IMAP (POP not supported) and how to send mail
;; via SMTP (server, port, protocol, …). Based on the entries in this variable,
;; appropriate settings of `gnus-secondary-select-methods are derived
;; automatically by the custom setter of `db/mail-accounts. Then when inside
;; Gnus, the mail can be read without further configuration. Note that when the
;; "IMAP address" of an entry in `db/mail-accounts is empty, it will not be
;; included as an IMAP account in `gnus-secondary-select-methods. This lets
;; you specify mail accounts that can be used for sending mail, but that are
;; read not directly via IMAP, but by other means (POP, offlineimap, …).
;; When sending mail, `db/mail-accounts is used to determine settings of the
;; relevant variables from `smtpmail based on the current value of the "From: "
@ -300,18 +300,6 @@ METHOD specifies the encrypt method used. Can be either
(gnus-group-get-new-news level))))
(set-window-configuration win)))))
;; Fixes
;; http://mbork.pl/2015-11-28_Fixing_mml-attach-file_using_advice
(defun db/mml-attach-file--go-to-eob (orig-fun &rest args)
"Go to the end of buffer before attaching files."
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(apply orig-fun args))))
(provide 'db-mail)
;;; db-mail ends here