* [PATCH] emacs: PATCH [1/2] mail user agent @ 2021-05-19 16:03 Tory S. Anderson 2021-05-22 12:16 ` David Bremner 0 siblings, 1 reply; 9+ messages in thread From: Tory S. Anderson @ 2021-05-19 16:03 UTC (permalink / raw) To: notmuch [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: patch --] [-- Type: text/x-patch, Size: 1054 bytes --] From 9a872e1b3b2b2231d1742fbc04cb366ab3b12b30 Mon Sep 17 00:00:00 2001 From: Tory Anderson <webdev@toryanderson.com> Date: Wed, 19 May 2021 07:39:45 -0600 Subject: [PATCH 1/2] mail user agent --- emacs/notmuch.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6d37c623..21a85656 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -121,6 +121,9 @@ there will be called at other points of notmuch execution." :group 'notmuch-search :group 'notmuch-hooks) +(defcustom notmuch-mail-user-agent 'notmuch-user-agent + "The mail user-agent to use when creating mail after using Notmuch. For historical purposes, the default is 'notmuch-user-agent" + :group 'notmuch) ;;; Mime Utilities (defun notmuch-foreach-mime-part (function mm-handle) @@ -1162,7 +1165,7 @@ Point should be at the beginning of the line." ;;; _ -(setq mail-user-agent 'notmuch-user-agent) +(setq mail-user-agent notmuch-mail-user-agent) (provide 'notmuch) -- 2.31.1 [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-05-19 16:03 [PATCH] emacs: PATCH [1/2] mail user agent Tory S. Anderson @ 2021-05-22 12:16 ` David Bremner 2021-05-22 13:28 ` Tomi Ollila 0 siblings, 1 reply; 9+ messages in thread From: David Bremner @ 2021-05-22 12:16 UTC (permalink / raw) To: Tory S. Anderson, notmuch webdev@toryanderson.com (Tory S. Anderson) writes: > > +(defcustom notmuch-mail-user-agent 'notmuch-user-agent > + "The mail user-agent to use when creating mail after using Notmuch. For historical purposes, the default is 'notmuch-user-agent" > + :group 'notmuch) > ;;; Mime Utilities > > (defun notmuch-foreach-mime-part (function mm-handle) > @@ -1162,7 +1165,7 @@ Point should be at the beginning of the line." > > ;;; _ > > -(setq mail-user-agent 'notmuch-user-agent) > +(setq mail-user-agent notmuch-mail-user-agent) OK, I appreciate idea of a smooth upgrade for existing notmuch users. I wonder though if other emacs MUAs do this? I did not see e.g. a gnus-mail-user-agent variable. I'm probably biased because I never use compose-mail to send mail, but I'm wondering if we're better off to just rip the bandage off and let users who want to use notmuch via generic emacs mail sending commands configure that. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-05-22 12:16 ` David Bremner @ 2021-05-22 13:28 ` Tomi Ollila 2021-05-22 15:38 ` Tory S. Anderson 2021-05-31 23:33 ` David Bremner 0 siblings, 2 replies; 9+ messages in thread From: Tomi Ollila @ 2021-05-22 13:28 UTC (permalink / raw) To: David Bremner, Tory S. Anderson, notmuch On Sat, May 22 2021, David Bremner wrote: > webdev@toryanderson.com (Tory S. Anderson) writes: > >> >> +(defcustom notmuch-mail-user-agent 'notmuch-user-agent >> + "The mail user-agent to use when creating mail after using Notmuch. For historical purposes, the default is 'notmuch-user-agent" >> + :group 'notmuch) >> ;;; Mime Utilities >> >> (defun notmuch-foreach-mime-part (function mm-handle) >> @@ -1162,7 +1165,7 @@ Point should be at the beginning of the line." >> >> ;;; _ >> >> -(setq mail-user-agent 'notmuch-user-agent) >> +(setq mail-user-agent notmuch-mail-user-agent) > > OK, I appreciate idea of a smooth upgrade for existing notmuch users. I > wonder though if other emacs MUAs do this? I did not see e.g. a > gnus-mail-user-agent variable. I'm probably biased because I never use > compose-mail to send mail, but I'm wondering if we're better off to just > rip the bandage off and let users who want to use notmuch via generic > emacs mail sending commands configure that. I am for 'ripping the bandage off' and not configure mail-user-agent outside of notmuch use (and just require 'notmuch would not set anything...) Could we have some 'compose-mail' variant (different name, of course; I had one in mind but then came off-by one problem... >;) which configures mail-user-agent just for that use (or something). Tomi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-05-22 13:28 ` Tomi Ollila @ 2021-05-22 15:38 ` Tory S. Anderson 2021-05-31 23:33 ` David Bremner 1 sibling, 0 replies; 9+ messages in thread From: Tory S. Anderson @ 2021-05-22 15:38 UTC (permalink / raw) To: Tomi Ollila; +Cc: notmuch I'm coming from very limited experience here -- gnus is the only MUA I've used -- but I'd be surprised if it's common practice to hijack a setting to set the MUA to something. As far as ripping the bandage off, I've followed that strategy many times in my professional life, but have come to dislike it; I'm in line with the Clojure paradigm to never break stuff. Sometimes that means namespacing, but in this case putting in the var with a default to preserve reverse compatibility is an easy thing, if a little kludgy. "Why was it ever doing this?" is a legitimate question, and it's no skin off my back if we simply chopped it out. But for a program as old and well-used as Notmuch, I would hate to break something that many users may not even realize they depended upon. Isn't it a good idea to make the fix available for those who want it, but non-breaking for those who have no idea? I suppose the docstring could be improved, and some options provided for those who don't know their MUAs. Trouble with options is, I don't know them, either -- only the notmuch MUA and 'gnus-user-agent. I'm not sure about others like mutt or muse or wanderlust or anything else. I'm not even sure if all of those have MUAs... - Tory Tomi Ollila <tomi.ollila@iki.fi> writes: > On Sat, May 22 2021, David Bremner wrote: > >> webdev@toryanderson.com (Tory S. Anderson) writes: >> >>> >>> +(defcustom notmuch-mail-user-agent 'notmuch-user-agent >>> + "The mail user-agent to use when creating mail after using Notmuch. For historical purposes, the default is 'notmuch-user-agent" >>> + :group 'notmuch) >>> ;;; Mime Utilities >>> >>> (defun notmuch-foreach-mime-part (function mm-handle) >>> @@ -1162,7 +1165,7 @@ Point should be at the beginning of the line." >>> >>> ;;; _ >>> >>> -(setq mail-user-agent 'notmuch-user-agent) >>> +(setq mail-user-agent notmuch-mail-user-agent) >> >> OK, I appreciate idea of a smooth upgrade for existing notmuch users. I >> wonder though if other emacs MUAs do this? I did not see e.g. a >> gnus-mail-user-agent variable. I'm probably biased because I never use >> compose-mail to send mail, but I'm wondering if we're better off to just >> rip the bandage off and let users who want to use notmuch via generic >> emacs mail sending commands configure that. > > I am for 'ripping the bandage off' and not configure mail-user-agent > outside of notmuch use (and just require 'notmuch would not set anything...) > > Could we have some 'compose-mail' variant (different name, of course; > I had one in mind but then came off-by one problem... >;) which > configures mail-user-agent just for that use (or something). > > Tomi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-05-22 13:28 ` Tomi Ollila 2021-05-22 15:38 ` Tory S. Anderson @ 2021-05-31 23:33 ` David Bremner 2021-06-02 19:10 ` Tomi Ollila 1 sibling, 1 reply; 9+ messages in thread From: David Bremner @ 2021-05-31 23:33 UTC (permalink / raw) To: Tomi Ollila, Tory S. Anderson, notmuch Tomi Ollila <tomi.ollila@iki.fi> writes: > > I am for 'ripping the bandage off' and not configure mail-user-agent > outside of notmuch use (and just require 'notmuch would not set anything...) > > Could we have some 'compose-mail' variant (different name, of course; > I had one in mind but then came off-by one problem... >;) which > configures mail-user-agent just for that use (or something). > Are you thinking about notmuch-mua-mail (which exists)? Tory, did you try the eval-after-load trick I mentioned btw? That seemed to work in my testing, and I'm just not sure that customizing a notmuch-* variable is much less annoying than adding an eval-after-load to reset the variable after notmuch messes with it. Still waiting for feedback from notmuch users that actually use M-x compose-mail or other similar generic entry points. d ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-05-31 23:33 ` David Bremner @ 2021-06-02 19:10 ` Tomi Ollila 2021-06-03 12:18 ` David Bremner 0 siblings, 1 reply; 9+ messages in thread From: Tomi Ollila @ 2021-06-02 19:10 UTC (permalink / raw) To: David Bremner, Tory S. Anderson, notmuch On Mon, May 31 2021, David Bremner wrote: > Tomi Ollila <tomi.ollila@iki.fi> writes: >> >> I am for 'ripping the bandage off' and not configure mail-user-agent >> outside of notmuch use (and just require 'notmuch would not set anything...) >> >> Could we have some 'compose-mail' variant (different name, of course; >> I had one in mind but then came off-by one problem... >;) which >> configures mail-user-agent just for that use (or something). >> > > Are you thinking about notmuch-mua-mail (which exists)? > > Tory, did you try the eval-after-load trick I mentioned btw? That seemed > to work in my testing, and I'm just not sure that customizing a > notmuch-* variable is much less annoying than adding an eval-after-load to > reset the variable after notmuch messes with it. > > Still waiting for feedback from notmuch users that actually use M-x > compose-mail or other similar generic entry points. Does anyone know how compose-mail behaves when one has loaded any other emacs mua (mh, vm, gnus, mu, ...) ? > > d Tomi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-06-02 19:10 ` Tomi Ollila @ 2021-06-03 12:18 ` David Bremner 2021-06-03 15:15 ` Tory S. Anderson 0 siblings, 1 reply; 9+ messages in thread From: David Bremner @ 2021-06-03 12:18 UTC (permalink / raw) To: Tomi Ollila, Tory S. Anderson, notmuch Tomi Ollila <tomi.ollila@iki.fi> writes: > On Mon, May 31 2021, David Bremner wrote: > >> Tomi Ollila <tomi.ollila@iki.fi> writes: >>> >>> I am for 'ripping the bandage off' and not configure mail-user-agent >>> outside of notmuch use (and just require 'notmuch would not set anything...) >>> >>> Could we have some 'compose-mail' variant (different name, of course; >>> I had one in mind but then came off-by one problem... >;) which >>> configures mail-user-agent just for that use (or something). >>> >> >> Are you thinking about notmuch-mua-mail (which exists)? >> >> Tory, did you try the eval-after-load trick I mentioned btw? That seemed >> to work in my testing, and I'm just not sure that customizing a >> notmuch-* variable is much less annoying than adding an eval-after-load to >> reset the variable after notmuch messes with it. >> >> Still waiting for feedback from notmuch users that actually use M-x >> compose-mail or other similar generic entry points. > > Does anyone know how compose-mail behaves when one has loaded any other > emacs mua (mh, vm, gnus, mu, ...) ? > As far as I can tell vm: only locally binds mail-user-agent mh-e: used to have a setq mail-user-agent, removed in 2003-ish mu4e: documents how to set mail-user-agent rmail: reads mail-user-agent, but does not set gnus: only locally binds mail-user-agent wanderlust: tells you how how to set mail-user-agent (and oddly, how to define conditionaly define a user agent) So I think notmuch is the odd one out here. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-06-03 12:18 ` David Bremner @ 2021-06-03 15:15 ` Tory S. Anderson 2021-06-03 18:22 ` Tomi Ollila 0 siblings, 1 reply; 9+ messages in thread From: Tory S. Anderson @ 2021-06-03 15:15 UTC (permalink / raw) To: David Bremner; +Cc: Tomi Ollila, notmuch Nice follow-upabout what other browsers do! David Bremner <david@tethera.net> writes: > Tomi Ollila <tomi.ollila@iki.fi> writes: > >> On Mon, May 31 2021, David Bremner wrote: >> >>> Tomi Ollila <tomi.ollila@iki.fi> writes: >>>> >>>> I am for 'ripping the bandage off' and not configure mail-user-agent >>>> outside of notmuch use (and just require 'notmuch would not set anything...) >>>> >>>> Could we have some 'compose-mail' variant (different name, of course; >>>> I had one in mind but then came off-by one problem... >;) which >>>> configures mail-user-agent just for that use (or something). >>>> >>> >>> Are you thinking about notmuch-mua-mail (which exists)? >>> >>> Tory, did you try the eval-after-load trick I mentioned btw? That seemed >>> to work in my testing, and I'm just not sure that customizing a >>> notmuch-* variable is much less annoying than adding an eval-after-load to >>> reset the variable after notmuch messes with it. No, I'm guilty here. I used my patch instead and haven't looked back since. I think having to add code lines to an init file is much more annoying (and less transparent) than simply having something for which I can add a =:custom= line in my use-package statements, or new users just use the customizer to explore to. Maybe that's just me, but I feel much more comfortable about sharing that config or that suggestion with others, too. Explorability is what customizer's big benefit to emacs is, so it seems to me a real advantage to have this in there. >>> >>> Still waiting for feedback from notmuch users that actually use M-x >>> compose-mail or other similar generic entry points. >> >> Does anyone know how compose-mail behaves when one has loaded any other >> emacs mua (mh, vm, gnus, mu, ...) ? >> > > As far as I can tell > > vm: only locally binds mail-user-agent > mh-e: used to have a setq mail-user-agent, removed in 2003-ish > mu4e: documents how to set mail-user-agent > rmail: reads mail-user-agent, but does not set > gnus: only locally binds mail-user-agent > wanderlust: tells you how how to set mail-user-agent (and oddly, how > to define conditionaly define a user agent) > > So I think notmuch is the odd one out here. > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] emacs: PATCH [1/2] mail user agent 2021-06-03 15:15 ` Tory S. Anderson @ 2021-06-03 18:22 ` Tomi Ollila 0 siblings, 0 replies; 9+ messages in thread From: Tomi Ollila @ 2021-06-03 18:22 UTC (permalink / raw) To: Tory S. Anderson, David Bremner; +Cc: notmuch On Thu, Jun 03 2021, Tory S. Anderson wrote: > Nice follow-upabout what other browsers do! > > David Bremner <david@tethera.net> writes: > >> Tomi Ollila <tomi.ollila@iki.fi> writes: >> >>> On Mon, May 31 2021, David Bremner wrote: >>> >>>> Tomi Ollila <tomi.ollila@iki.fi> writes: >>>>> >>>>> I am for 'ripping the bandage off' and not configure mail-user-agent >>>>> outside of notmuch use (and just require 'notmuch would not set anything...) >>>>> >>>>> Could we have some 'compose-mail' variant (different name, of course; >>>>> I had one in mind but then came off-by one problem... >;) which >>>>> configures mail-user-agent just for that use (or something). >>>>> >>>> >>>> Are you thinking about notmuch-mua-mail (which exists)? >>>> >>>> Tory, did you try the eval-after-load trick I mentioned btw? That seemed >>>> to work in my testing, and I'm just not sure that customizing a >>>> notmuch-* variable is much less annoying than adding an eval-after-load to >>>> reset the variable after notmuch messes with it. > > No, I'm guilty here. I used my patch instead and haven't looked back > since. I think having to add code lines to an init file is much more > annoying (and less transparent) than simply having something for which I > can add a =:custom= line in my use-package statements, or new users just > use the customizer to explore to. Maybe that's just me, but I feel much > more comfortable about sharing that config or that suggestion with > others, too. Explorability is what customizer's big benefit to emacs is, > so it seems to me a real advantage to have this in there. > mail-user-agent is defcustom in simple.el, starting: (defcustom mail-user-agent 'message-user-agent "Your preference for a mail composition package. Various Emacs Lisp packages (e.g. Reporter) require you to compose an outgoing email message. This variable lets you specify which mail-sending package you prefer. Valid values include: `message-user-agent' -- use the Message package. See Info node `(message)'. `sendmail-user-agent' -- use the Mail package. See Info node `(emacs)Sending Mail'. `mh-e-user-agent' -- use the Emacs interface to the MH mail system. See Info node `(mh-e)'. `gnus-user-agent' -- like `message-user-agent', but with Gnus paraphernalia if Gnus is running, particularly the Gcc: header for archiving. Additional valid symbols may be available; check with the author of your package for details. The function should return non-nil if it succeeds. ... Currently if one uses/used customizer to change to something else, which is saved to .emacs (or somewhere else where custom-file points to), and then loads notmuch, it suddenly changes to 'notmuch-user-agent. AFAIU the change your patch did does not change that, one just has to customize notmuch-mail-user-agent. IMO that makes things messy. If there were option to somehow magically add more values to the mail-user-agent customize menu while loading notmuch.el then one could just directly choose notmuch-user-agent from that menu. Otherwise I don't see other options than document how to do that configuration (and drop that setq and add NEWS entry). Tomi >>>> >>>> Still waiting for feedback from notmuch users that actually use M-x >>>> compose-mail or other similar generic entry points. >>> >>> Does anyone know how compose-mail behaves when one has loaded any other >>> emacs mua (mh, vm, gnus, mu, ...) ? >>> >> >> As far as I can tell >> >> vm: only locally binds mail-user-agent >> mh-e: used to have a setq mail-user-agent, removed in 2003-ish >> mu4e: documents how to set mail-user-agent >> rmail: reads mail-user-agent, but does not set >> gnus: only locally binds mail-user-agent >> wanderlust: tells you how how to set mail-user-agent (and oddly, how >> to define conditionaly define a user agent) >> >> So I think notmuch is the odd one out here. >> _______________________________________________ >> notmuch mailing list -- notmuch@notmuchmail.org >> To unsubscribe send an email to notmuch-leave@notmuchmail.org > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-06-03 18:23 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-05-19 16:03 [PATCH] emacs: PATCH [1/2] mail user agent Tory S. Anderson 2021-05-22 12:16 ` David Bremner 2021-05-22 13:28 ` Tomi Ollila 2021-05-22 15:38 ` Tory S. Anderson 2021-05-31 23:33 ` David Bremner 2021-06-02 19:10 ` Tomi Ollila 2021-06-03 12:18 ` David Bremner 2021-06-03 15:15 ` Tory S. Anderson 2021-06-03 18:22 ` Tomi Ollila
Code repositories for project(s) associated with this public inbox https://yhetil.org/notmuch.git/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).