Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses
- From
Andy Koppe <andy.koppe@gmail.com>
- Date
- Nov 4, 2023, 09:51 UTC
- Message-ID
- <9662afd1-a596-4d36-8c50-6c2e953a36cb@gmail.com>
- In-Reply-To
- <xmqqy1fegu5i.fsf@gitster.g>
On 04/11/2023 01:54, Junio C Hamano wrote:
Show 10 quoted lines
> Andy Koppe <andy.koppe@gmail.com> writes: > >> I'm not sure that this is the right way to handle a missing '@' here >> actually, because %al already returns the whole email field in that >> case, which makes sense as the likes of the 'mail' command would >> interpret it as a local username. > > We could expand "%am" to \C-h (\010) so that "%al@%am" would end up > displaying the same as "%al" but that would be way too cute for its > own worth ;-)
:)
Unfortunately it also wouldn't always work, because ^H only moves the cursor, so if the next thing is a newline, the '@' wouldn't actually get deleted.
> It is unfortunate that "%al@%am" cannot be the same as "%ae" for > local-only address, but giving an empty string for "%am" if "%ae" is > local-only would be the best we could do for our users, and certainly > much better than giving the same as "%ae", as you said above.
I suppose "%@am" could mean prepending an '@' when a domain is present, similar to how "% am" would mean prepending a space and "%+am" would mean prepending a newline. With that, "%al%@am" would be equivalent to "%ae".
But that then raises the question whether it should be implemented just for "%@[ac][mM]", or for all placeholders. In any case, I don't think it needs to be part of the changes at hand.
Andy