Aloha, I use aliases and set up gnus-alias-identity-rules to select certain identities when mailing to or from certain addresses, and when I do tab completion on an email address, the correct identity naturally gets chosen as expected. However, when I have a mailing list, and press space to expand the mailing list, a different mechanism, namely abbrevs, is used. So there is no identity selection based on the members of the mailing list. I'm trying to make this work to select identity, and have been trying hacks in mailabbrev.el, where the action seems to take place in mail-abbrev-expand-wrapper. I think I might be able to get it to work, but the real question is, should this be built-in to gnus somehow? (I realize there is an issue with possible multiple matches. But that issue already exists when doing a wide reply, and it seems that the first rule to match wins the battle.) Mahalo in advance, -- Bob Newell Honolulu, Hawai`i - Via GNU/Linux/Emacs/Gnus/BBDB
>
> However, when I have a mailing list, and press space to expand
> the mailing list, a different mechanism, namely abbrevs, is
> used. So there is no identity selection based on the members
> of the mailing list.
>
> I'm trying to make this work to select identity, and have been
> trying hacks in mailabbrev.el, where the action seems to take
> place in mail-abbrev-expand-wrapper. I think I might be able
> to get it to work, but the real question is, should this be
> built-in to gnus somehow?
Well ... I did get this to work in an embarrassingly hackish
manner, which I'm too ashamed to post but will share with
anyone who has the same obscure issue.
In any case hacking mailabbrev.el, which is not part of Gnus,
might be out of scope for this mailing list. Certainly,
putting Gnus specific code into mailabbrev.el, which is what I
did, is unacceptable for general use.
I'm still seeking a way to do this within Gnus, where it
belongs, but it looks to be non-trivial for someone at my
admittedly non-stellar skill level.
--
Bob Newell
Honolulu, Hawai`i
- Via GNU/Linux/Emacs/Gnus/BBDB
Bob Newell wrote: > I use aliases and set up gnus-alias-identity-rules to select > certain identities when mailing to or from certain > addresses, and when I do tab completion on an email address, > the correct identity naturally gets chosen as expected. > > However, when I have a mailing list, and press space to > expand the mailing list, a different mechanism, namely > abbrevs, is used [...] What do you mean, when I have a mailing list? Isn't a mailing list also just a certain address? Not following ... -- underground experts united https://dataswamp.org/~incal
Bob Newell <bobnewell@bobnewell.net> writes:
>>
>> However, when I have a mailing list, and press space to expand
>> the mailing list, a different mechanism, namely abbrevs, is
>> used. So there is no identity selection based on the members
>> of the mailing list.
>>
>> I'm trying to make this work to select identity, and have been
>> trying hacks in mailabbrev.el, where the action seems to take
>> place in mail-abbrev-expand-wrapper. I think I might be able
>> to get it to work, but the real question is, should this be
>> built-in to gnus somehow?
>
> Well ... I did get this to work in an embarrassingly hackish
> manner, which I'm too ashamed to post but will share with
> anyone who has the same obscure issue.
>
> In any case hacking mailabbrev.el, which is not part of Gnus,
> might be out of scope for this mailing list. Certainly,
> putting Gnus specific code into mailabbrev.el, which is what I
> did, is unacceptable for general use.
>
> I'm still seeking a way to do this within Gnus, where it
> belongs, but it looks to be non-trivial for someone at my
> admittedly non-stellar skill level.
Completion in message-mode has always been weird, and it's gotten
temporarily weirder as someone (I assume Stefan) has started nudging it
over to use Emacs' standard completion mechanisms.
I'm also a little unclear of what situation you're seeing exactly: do
you mean that expanding names in the "To/From/Cc" headers triggers an
alias switch, but expanding group names in the "Newsgroups" header
doesn't? But the only place `expand-abbrev' is used in header completion
is in the "To/From/Cc" header, so I don't really understand how the two
situations differ.
I also don't know what hook gnus-alias uses to do its alias switching;
if we knew that then this would be easier.
If your Emacs is recent and you have the option
`message-expand-name-standard-ui', try setting it to t and see what that
does.
Eric Abrahamsen wrote: > I'm also a little unclear of what situation you're seeing > exactly: do you mean that expanding names in the > "To/From/Cc" headers triggers an alias switch, but expanding > group names in the "Newsgroups" header doesn't? But the only > place `expand-abbrev' is used in header completion is in the > "To/From/Cc" header, so I don't really understand how the > two situations differ. Isn't it from ~/.mailrc in those and in the abbrev-table with the Newsgroups? -- underground experts united https://dataswamp.org/~incal
Eric Abrahamsen <eric@ericabrahamsen.net> writes: > I'm also a little unclear of what situation you're seeing exactly: do > you mean that expanding names in the "To/From/Cc" headers triggers an > alias switch, but expanding group names in the "Newsgroups" header > doesn't? But the only place `expand-abbrev' is used in header completion > is in the "To/From/Cc" header, so I don't really understand how the two > situations differ. I think I inadvertently left out an important piece of information. BBDB is in use here. I create my own mailing lists using the 'mail-alias' BBDB field. The problem comes up when I enter a BBDB defined mail-alias in the To: field and press the spacebar to expand that into the full list of BBDB addresses that have the mail-alias in question. The list appears, of course, but gnu-alias-determine-identity doesn't run, and so my From: address (etc.) isn't altered, when in fact based on one or more of the mail-alias entries, I may want it changed in accord with my gnus alias rules. The BBDB mail-alias expansion takes place in mail-abbrev-expand-wrapper in mailabbrevs.el which is not part of Gnus. That's where I did some horribly shameful hacking. Everything is fine with simple tab completion of a (non-mail-alias) regular email address in the To: field. > I also don't know what hook gnus-alias uses to do its alias switching; > if we knew that then this would be easier. This happens with tab completion with the following line of code: (add-hook 'bbdb-complete-mail-hook 'gnus-alias-determine-identity) However this mechanism isn't used with mail-alias expansion. > If your Emacs is recent and you have the option > `message-expand-name-standard-ui', try setting it to t and see what that > does. I'll look into it. Thank you for your reply. -- Bob Newell Honolulu, Hawai`i - Via GNU/Linux/Emacs/Gnus/BBDB
> I think I inadvertently left out an important piece of
> information. BBDB is in use here. I create my own mailing
> lists using the 'mail-alias' BBDB field.
Well, this got me to thinking that there ought to be a BBDB
hook for what I want. There is, and here's the easy solution.
(setq bbdb-mail-abbrev-expand-hook
(lambda (arg1 arg2)
(gnus-alias-determine-identity)))
A BBDB mail-alias is now properly expanded (when pressing
spacebar) and the correct gnus alias is used.
Thanks to everyone for their comments. Yes, an obscure need!
--
Bob Newell
Honolulu, Hawai`i
- Via GNU/Linux/Emacs/Gnus/BBDB
Bob Newell <bobnewell@bobnewell.net> writes:
>> I think I inadvertently left out an important piece of
>> information. BBDB is in use here. I create my own mailing
>> lists using the 'mail-alias' BBDB field.
>
> Well, this got me to thinking that there ought to be a BBDB
> hook for what I want. There is, and here's the easy solution.
>
> (setq bbdb-mail-abbrev-expand-hook
> (lambda (arg1 arg2)
> (gnus-alias-determine-identity)))
>
> A BBDB mail-alias is now properly expanded (when pressing
> spacebar) and the correct gnus alias is used.
>
> Thanks to everyone for their comments. Yes, an obscure need!
Huzzah!
Hellow Emanuel!
> Isn't it from ~/.mailrc in those and in the abbrev-table with
> the Newsgroups?
Also i use ~/.mailrc, Not Newsgroups. Only personal addresses.
Sincerely, Gnus fan Byung-Hee
--
^고맙습니다 _白衣從軍_ 감사합니다_^))//
Byung-Hee HWANG wrote: >> Isn't it from ~/.mailrc in those and in the abbrev-table >> with the Newsgroups? > > Also i use ~/.mailrc, Not Newsgroups. Only personal addresses. What do you say, "great minds think alike"! ;) -- underground experts united https://dataswamp.org/~incal
On Friday, 3 Dec 2021 at 10:43, Eric Abrahamsen wrote:
> If your Emacs is recent and you have the option
> `message-expand-name-standard-ui', try setting it to t and see what that
> does.
I am trying this out (having been using bbdb-handy up to now). I cannot
quite figure out what it is doing. I use bbdb as my address book. Mail
aliases from bbdb work just fine (typing "somealias SPC") but tab
completion is strange. It works, in the sense that if I type "somename
TAB", I get a completion list. However, it is unclear where the
contents of this list are coming from.
TAB is bound to message-tab which then invokes message-expand-name which
should be checking bbdb but it does not appear to (or is missing many
entries from bbdb).
Any pointers or clarifications would be welcome.
Thank you,
eric
PS - sorry if I have hijacked the thread; happy to start a new one if
desired.
--
Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1
Emanuel Berg <moasenwood@zoho.eu> writes:
> Byung-Hee HWANG wrote:
>
>>> Isn't it from ~/.mailrc in those and in the abbrev-table
>>> with the Newsgroups?
>>
>> Also i use ~/.mailrc, Not Newsgroups. Only personal addresses.
>
> What do you say, "great minds think alike"!
Sorry man Emanuel, i should study more English!
Thanks, Gnus fan Byung-Hee
--
^고맙습니다 _救濟蒼生_ 감사합니다_^))//
On Friday, 3 Dec 2021 at 19:12, Emanuel Berg wrote:
> What do you mean, when I have a mailing list? Isn't a mailing
> list also just a certain address? Not following ...
In bbdb, all entries that have a common alias, e.g. "myresearchgroup",
are considered a /mailing list/. This is a list for emails that is made
up of individual entries as opposed to a single address run by some
server. Typing myresearchgroup SPC in the To: field will expand to a
list of email addresses, all of those that have that term as an alias.
HTH,
eric
--
Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1
Eric S Fraga wrote: >> What do you mean, when I have a mailing list? >> Isn't a mailing list also just a certain address? >> Not following ... > > In bbdb, all entries that have a common alias, e.g. > "myresearchgroup", are considered a /mailing list/. This is > a list for emails that is made up of individual entries as > opposed to a single address run by some server. > Typing myresearchgroup SPC in the To: field will expand to > a list of email addresses, all of those that have that term > as an alias. OK, I didn't even know this discussion was about bbdb ... Hm ... maybe one should change message-mode so that ~/.mailrc aliases are expanded in the Newsgroups and Followup-To headers as well? -- underground experts united https://dataswamp.org/~incal
Byung-Hee HWANG wrote: >>>> Isn't it from ~/.mailrc in those and in the abbrev-table >>>> with the Newsgroups? >>> >>> Also i use ~/.mailrc, Not Newsgroups. >>> Only personal addresses. >> >> What do you say, "great minds think alike"! > > Sorry man Emanuel, i should study more English! It is an expression used when two people do the same thing or suggest the same thing, I guess it was originally used for like two brilliant astronomers or something reaching the same conclusion from two different observatories on the face of the Earth, but it can also be used jokingly (more often) when the suggestion is perhaps somewhat less astounding ... -- underground experts united https://dataswamp.org/~incal
On Sunday, 5 Dec 2021 at 19:12, Emanuel Berg wrote:
> OK, I didn't even know this discussion was about bbdb ...
The same applies to .mailrc mailing list definitions; I shouldn't have
limited my response to BBDB. Sorry.
--
Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1
Eric S Fraga wrote: >> OK, I didn't even know this discussion was about bbdb ... > > The same applies to .mailrc mailing list definitions; > I shouldn't have limited my response to BBDB. Sorry. Uhm ... what applies? As a mailing list, this is ding@gnus.org so you can do in ~/.mailrc alias ding "ding <ding@gnus.org> and use that in the To: header (and others). As a newsgroup (the Newsgroups: and Followup-To: headers) it is gmane.emacs.gnus.general tho which won't expand there, one way is then to do for example ;;; (kill-all-abbrevs) (let ((write '(("ding" "gmane.emacs.gnus.general") ;; ... ))) (define-abbrev-table 'global-abbrev-table write )) but optimally one would want to do that in mailrc as well IMO. -- underground experts united https://dataswamp.org/~incal
On Sunday, 5 Dec 2021 at 22:30, Emanuel Berg wrote:
> Uhm ... what applies?
This was in reference to your earlier post when you said that a mailing
list is just a certain address. That's true for ding, for instance, but
with .mailrc (and bbdb as well), you can define your own personal
mailing lists that consist of a list of individual email addresses.
--
Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1
Eric S Fraga wrote: > This was in reference to your earlier post when you said > that a mailing list is just a certain address. That's true > for ding, for instance, but with .mailrc (and bbdb as well), > you can define your own personal mailing lists that consist > of a list of individual email addresses. I know? -- underground experts united https://dataswamp.org/~incal
Emanuel Berg <moasenwood@zoho.eu> writes:
> Byung-Hee HWANG wrote:
>
>>>>> Isn't it from ~/.mailrc in those and in the abbrev-table
>>>>> with the Newsgroups?
>>>>
>>>> Also i use ~/.mailrc, Not Newsgroups.
>>>> Only personal addresses.
>>>
>>> What do you say, "great minds think alike"!
>>
>> Sorry man Emanuel, i should study more English!
>
> It is an expression used when two people do the same thing or
> suggest the same thing, I guess it was originally used for
> like two brilliant astronomers or something reaching the same
> conclusion from two different observatories on the face of the
> Earth, but it can also be used jokingly (more often) when the
> suggestion is perhaps somewhat less astounding ...
Thanks! Emanul ^^^
Sincerely, Gnus fan Byung-Hee
--
^고맙습니다 _和合團結_ 감사합니다_^))//
> Thanks! Emanul ^^^
(Sorry, i did type misspel)
Thanks! Emanuel ^^^
Sincerely, Gnus fan Byung-Hee
--
^고맙습니다 _和合團結_ 감사합니다_^))//
> As a newsgroup (the Newsgroups: and Followup-To: headers) it > is gmane.emacs.gnus.general tho which won't expand > there [...] but optimally one would want to do that in > mailrc as well IMO I think one can do it by adding these headers to `mail-abbrev-mode-regexp', Its value is "^\\(Resent-\\)?\\(To\\|From\\|Cc\\|Bcc\\|Reply-To\\):" Regexp matching mail headers in which mail abbrevs should be expanded. This string will be handed to ‘looking-at’ with point at the beginning of the current line; if it matches, abbrev mode will be turned on, otherwise it will be turned off. (You don’t need to worry about continuation lines.) This should be set to match those mail fields in which you want abbreviations turned on. -- underground experts united https://dataswamp.org/~incal
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Friday, 3 Dec 2021 at 10:43, Eric Abrahamsen wrote:
>> If your Emacs is recent and you have the option
>> `message-expand-name-standard-ui', try setting it to t and see what that
>> does.
>
> I am trying this out (having been using bbdb-handy up to now). I cannot
> quite figure out what it is doing. I use bbdb as my address book. Mail
> aliases from bbdb work just fine (typing "somealias SPC") but tab
> completion is strange. It works, in the sense that if I type "somename
> TAB", I get a completion list. However, it is unclear where the
> contents of this list are coming from.
>
> TAB is bound to message-tab which then invokes message-expand-name which
> should be checking bbdb but it does not appear to (or is missing many
> entries from bbdb).
>
> Any pointers or clarifications would be welcome.
Ha, you sort of called my bluff here, I hadn't looked closely at what
that option is actually doing. Basically, in a perfect world, <TAB> in a
name/group header would call `completion-at-point' directly. Programs
that want to provide names and addresses for completion would push their
tables onto `completion-at-point-functions'. The nice thing about this
is that there are several user options that would govern how completion
works (giving you more control), and also multiple backends can put
their tables in, meaning that you could cycle through completions that
come from various packages.
At present things have gotten fairly convoluted. If you set
`message-expand-name-standard-ui' to t, what happens is: `message-tab'
calls `completion-at-point', which finds `message-completion-function'
and calls that, which sees that we're in a "To:" header and ends up
calling `message-expand-name'. `message-expand-name' sees that
`message-expand-name-standard-ui' is t, and returns the standard set of
capf data, including `message--name-table' as the completion table. This
table simply does what `message-expand-name' otherwise does directly:
checks if we're using eudc or bbdb (*EBDB maintainer wipes away a
tear*), and calls `message--bbdb-query-with-words' which, god willing
and the creek don't rise, ends up with the same result as if
`message-expand-name-standard-ui' were nil, and we'd called
`bbdb-complete-name'.
Apologies if that's more detail than you wanted; I'm also trying to make
sense of this myself.
The point being, it *ought* to behave the same way, just with
(potentially) more completion candidates from multiple backends, and
more user control over the completion style. If you're seeing wrong
completions from BBDB, that means that `message--bbdb-query-with-words'
is not doing the same job as `bbdb-complete-name', and that should be
considered a bug, I guess.
Whew.
Eric
(setq mail-abbrev-mode-regexp "^\\(\\(Newsgroups\\|Followup-To:\\)\\|\\(Resent-\\)?\\(To\\|From\\|Cc\\|Bcc\\|Reply-To\\)\\):") -- underground experts united https://dataswamp.org/~incal
> (setq mail-abbrev-mode-regexp > "^\\(\\(Newsgroups\\|Followup-To:\\)\\|\\(Resent-\\)?\\(To\\|From\\|Cc\\|Bcc\\|Reply-To\\)\\):") Then in ~/.mailrc alias ged "gmane.emacs.devel" alias geh "gmane.emacs.help" alias gew "gmane.emacs.w3m" works. -- underground experts united https://dataswamp.org/~incal
Hi Eric, I wasn't trying to call your bluff. 😉 Thanks for the explanation. I will have to explore more to see why message-tab (and the resulting chain or function evaluations) doesn't actually give me all the entries it should. I don't think I have any strange configuration for bbdb, in particular, but maybe I do. What I do know is that the results returned by hitting TAB in the To: header line differ significantly from what I would get from a simple bbdb search. The former is often a very short list, and typically missing the person I was looking for, whereas the latter is often much longer than I would like. I will look into `message--bbdb-query-with-words' and `bbdb-complete-name' to see how they differ. Thanks again, eric -- Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1
Eric, Very strange: I get different outcomes with bbdb-complete-mail, message--bbdb-query-with-words, and message-tab directly. And none of the outcomes corresponds to what I get with bbdb-search-name. I would like what bbdb-search-name returns... any idea how I can achieve this? Ideally, what would be good is a name/email search based on Emacs's own completion engine (allowing for selectrum, helm, ivy, ...). thank you, eric PS -I guess this is not really a gnus topic; it's more about message-mode and maybe should be on emacs.help? -- Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1
Eric S Fraga <e.fraga@ucl.ac.uk> writes: > Eric, > > Very strange: I get different outcomes with bbdb-complete-mail, > message--bbdb-query-with-words, and message-tab directly. And none of > the outcomes corresponds to what I get with bbdb-search-name. > > I would like what bbdb-search-name returns... any idea how I can achieve > this? But `bbdb-search-name' returns actual BBDB records, right? Not mail completion strings? I don't know `bbdb-complete-mail' well enough to say exactly why the results vary, but at the very least `bbdb-complete-mail' will allow you to complete on email addresses, not just record names, which seems desirable. You could potentially write a wrapper function that uses `bbdb-search-name' to find records, and then mapcans `bbdb-dwim-mail' over each record's mail addresses, and returns the result as a list of strings. Then you'd have to force message-tab completion to use your function. The nuclear approach I take in EBDB is: (cl-pushnew '("^\\(Resent-\\)?\\(To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):" . ebdb-complete-mail) message-completion-alist :test #'equal) You could put your own in there. > Ideally, what would be good is a name/email search based on Emacs's own > completion engine (allowing for selectrum, helm, ivy, ...). > > thank you, > eric > > PS -I guess this is not really a gnus topic; it's more about > message-mode and maybe should be on emacs.help? I'd actually raise this on the BBDB list: as message-mode continues to provide for more "standard" completion behavior, BBDB should probably provide new functions to match that. There's a code comment in message.el to the effect that `message--bbdb-query-with-words' actually belongs in BBDB. Maybe they'll have some opinions about this.
On Wednesday, 8 Dec 2021 at 09:46, Eric Abrahamsen wrote: > But `bbdb-search-name' returns actual BBDB records, right? Not mail > completion strings? Yes, indeed but my point was that the records returned for a given search string was a more comprehensive list than returned by either of the other two methods. > I don't know `bbdb-complete-mail' well enough to say exactly why the > results vary, but at the very least `bbdb-complete-mail' will allow > you to complete on email addresses, not just record names, which seems > desirable. Doesn't seem to be working for me. I only get a subset of what I would expect. Very strange. I will continue to play with this when I have time. And I will post on other more appropriate lists as this is not really a gnus problem. Thank you, eric -- Eric S Fraga with org 9.5.1 in Emacs 29.0.50 on Debian 11.1