From f69abd6ec6197b038a1cce1e475b2bd13bd75c6a Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 10 Feb 2019 19:58:06 +0100 Subject: [PATCH] [Mail] Move advice to attach at end-of-buffer to init.el --- init.el | 13 +++++++++++-- site-lisp/db-mail.el | 36 ++++++++++++------------------------ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/init.el b/init.el index e783331..ad0d086 100644 --- a/init.el +++ b/init.el @@ -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))) diff --git a/site-lisp/db-mail.el b/site-lisp/db-mail.el index 937c73c..4bd5e67 100644 --- a/site-lisp/db-mail.el +++ b/site-lisp/db-mail.el @@ -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 -;; let’s 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 let’s +;; 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