unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
@ 2019-11-20  6:44 Amin Bandali
  2019-11-21 13:41 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Amin Bandali @ 2019-11-20  6:44 UTC (permalink / raw)
  To: 38289


As the title suggests, pressing C-c C-w (bound
to message-insert-signature) in message-mode
does not insert the signature if the signature
field of a style defined in gnus-posting-styles
applies here.  However, if I comment those bits
out and instead use a ~/.signature file, then
C-c C-w inserts the signature as expected.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-20  6:44 bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies Amin Bandali
@ 2019-11-21 13:41 ` Lars Ingebrigtsen
  2019-11-21 20:38   ` Amin Bandali
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-21 13:41 UTC (permalink / raw)
  To: Amin Bandali; +Cc: 38289

Amin Bandali <bandali@gnu.org> writes:

> As the title suggests, pressing C-c C-w (bound to
> message-insert-signature) in message-mode does not insert the
> signature if the signature field of a style defined in
> gnus-posting-styles applies here.  However, if I comment those bits
> out and instead use a ~/.signature file, then C-c C-w inserts the
> signature as expected.

I'm not sure that's a bug, though: message-mode knows nothing about
gnus-posting-styles, and `C-c C-w' is documented to act according to
what the `message-signature' variables says.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-21 13:41 ` Lars Ingebrigtsen
@ 2019-11-21 20:38   ` Amin Bandali
  2019-11-21 23:04     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Amin Bandali @ 2019-11-21 20:38 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 38289

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I'm not sure that's a bug, though:
> message-mode knows nothing about
> gnus-posting-styles, and `C-c C-w' is
> documented to act according to what the
> `message-signature' variables says.

While I so wish `message-mode' knew about
`gnus-posting-styles', that's not the bug I'm
reporting.  This is a bug where whenever a
signature rule from `gnus-posting-styles'
applies, `C-c C-w' ceases to work according to
its documentation; it does /nothing/ at all.
The expected behaviour would be for `C-c C-w'
to carry out whatever `message-signature' is
set to do, like you mentioned; but that doesn't
happen; at least not for me.

For instance, if `message-mode' was opened by
hitting `r' on an article in nnimap+gnu:INBOX
which has a custom signature set using
`gnus-posting-styles', if I manually remove the
prefilled signature and hit `C-c C-w', nothing
happens, as if `message-signature' was set to
nil; whereas it is actually t.  Makes sense?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-21 20:38   ` Amin Bandali
@ 2019-11-21 23:04     ` Lars Ingebrigtsen
  2019-11-21 23:20       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-21 23:04 UTC (permalink / raw)
  To: Amin Bandali; +Cc: 38289

Amin Bandali <bandali@gnu.org> writes:

> For instance, if `message-mode' was opened by
> hitting `r' on an article in nnimap+gnu:INBOX
> which has a custom signature set using
> `gnus-posting-styles', if I manually remove the
> prefilled signature and hit `C-c C-w', nothing
> happens, as if `message-signature' was set to
> nil; whereas it is actually t.  Makes sense?

Yes indeed -- I misread your bug report.

And, yes, that's how this works.  When doing the posting styles, Gnus
sets the message variables buffer-locally:

		   ((eq 'signature (car result))
		    (set (make-local-variable 'message-signature) nil)
		    (set (make-local-variable 'message-signature-file) nil)

I'm now quite sure what's the best way to fix this -- perhaps `C-c C-w'
should consult the global values?  But that may be equally wrong,
because somebody may be setting that variable buffer-locally in a hook,
for instance, and `C-c C-w' should do the obvious thing and work on that
value.

The nil case makes it seem obvious that Message should be doing
something other than what it's doing now, but if you've set the
signature via Gnus posting styles, and then deleted it, and then want to
insert it again with `C-c C-w' -- shouldn't that work?  I think it
should.  So that leaves the nil case -- `C-c C-w' could peek at the
global version of the variable if it's buffer-locally nil?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-21 23:04     ` Lars Ingebrigtsen
@ 2019-11-21 23:20       ` Lars Ingebrigtsen
  2019-11-22  5:55         ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-21 23:20 UTC (permalink / raw)
  To: Amin Bandali; +Cc: 38289

Lars Ingebrigtsen <larsi@gnus.org> writes:

> So that leaves the nil case -- `C-c C-w' could peek at the
> global version of the variable if it's buffer-locally nil?

I've now done this on the trunk.  It seems harmless and is more DWIM.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-21 23:20       ` Lars Ingebrigtsen
@ 2019-11-22  5:55         ` Eric Abrahamsen
  2019-11-22 12:38           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Abrahamsen @ 2019-11-22  5:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Amin Bandali, 38289

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> So that leaves the nil case -- `C-c C-w' could peek at the
>> global version of the variable if it's buffer-locally nil?
>
> I've now done this on the trunk.  It seems harmless and is more DWIM.

Okay, let me just float an idea here, and if it looks appealing I'll
open a separate bug report to keep it for posterity, and if it doesn't
we can just quietly let it go.

How about a Gnus-specific minor-mode to run in message buffers that are
expected to be tied to Gnus? Like gnus-message-minor-mode, whatever. The
minor mode could do two things:

1. Hook into header completion, so that completing a mail address in
any of the To/From/Cc/Bcc fields would run the whole message through
gnus-posting-styles again, possibly re-writing other parts of the draft
message.

2. Add an X-Gnus-Server header (stripped on sending), which could be set
as a part of posting styles, or associated with a From address, or
otherwise figured out later. The header value would be a Gnus server (eg
nntp:news.gmane.org), and other message action functions would be
patched by the minor mode to first query that server to see if it wants
to "handle" the action, before passing it on to the message-mode
functions.

The beautiful future I'm imagining is that an nnimap server queries its
remote server for "special use" mailboxes, so that it knows which of its
groups is \Drafts, which is \Sent, etc. Now we save the message as a
draft, and the minor mode first checks with the X-Gnus-Server: "can you
handle drafts?" The server can! Or it can't, and the message goes into
nndraft. Or the message is sent, and if there's no Gcc, the minor mode
asks the server, "Can you archive this somewhere?" And hey, maybe the
server can.

All this confined to a minor-mode, of course.

WDYT?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-22  5:55         ` Eric Abrahamsen
@ 2019-11-22 12:38           ` Lars Ingebrigtsen
  2019-11-22 18:20             ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-22 12:38 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: Amin Bandali, 38289

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> How about a Gnus-specific minor-mode to run in message buffers that are
> expected to be tied to Gnus? Like gnus-message-minor-mode, whatever. The
> minor mode could do two things:

That does sound cleaner than the current Gnus/Message integration, which
is based inserting some text in the buffer, and then locally setting a
bunch of Message variables to disable the default action.

But I'm not sure how it would look in practice.

> 1. Hook into header completion, so that completing a mail address in
> any of the To/From/Cc/Bcc fields would run the whole message through
> gnus-posting-styles again, possibly re-writing other parts of the draft
> message.

Hm...  I'm not sure I see how that would work.  The posting styles just
insert a bunch of stuff and can eval whatever.

> The beautiful future I'm imagining is that an nnimap server queries its
> remote server for "special use" mailboxes, so that it knows which of its
> groups is \Drafts, which is \Sent, etc. Now we save the message as a
> draft, and the minor mode first checks with the X-Gnus-Server: "can you
> handle drafts?" The server can! Or it can't, and the message goes into
> nndraft. Or the message is sent, and if there's no Gcc, the minor mode
> asks the server, "Can you archive this somewhere?" And hey, maybe the
> server can.
>
> All this confined to a minor-mode, of course.

It sounds a bit abstract -- would it ignore nndrafts if the IMAP server
has \Drafts?  (Auto-saving over nnimap isn't recommended, really.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-22 12:38           ` Lars Ingebrigtsen
@ 2019-11-22 18:20             ` Eric Abrahamsen
  2019-11-23 12:01               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Abrahamsen @ 2019-11-22 18:20 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Amin Bandali, 38289

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> How about a Gnus-specific minor-mode to run in message buffers that are
>> expected to be tied to Gnus? Like gnus-message-minor-mode, whatever. The
>> minor mode could do two things:
>
> That does sound cleaner than the current Gnus/Message integration, which
> is based inserting some text in the buffer, and then locally setting a
> bunch of Message variables to disable the default action.
>
> But I'm not sure how it would look in practice.

Well I certainly didn't spend a lot of time thinking about it :)

>> 1. Hook into header completion, so that completing a mail address in
>> any of the To/From/Cc/Bcc fields would run the whole message through
>> gnus-posting-styles again, possibly re-writing other parts of the draft
>> message.
>
> Hm...  I'm not sure I see how that would work.  The posting styles just
> insert a bunch of stuff and can eval whatever.

I'm not sure exactly how it would look either, but I believe that with
some refactoring, we could trigger a change of sending "profile" based
on completions of To/From addresses. Ideally re-using what people have
already got in their posting styles. There are a few external packages
out there that provide for "personas", it's a definite need. I could put
it on the list of things to think about.

>> The beautiful future I'm imagining is that an nnimap server queries its
>> remote server for "special use" mailboxes, so that it knows which of its
>> groups is \Drafts, which is \Sent, etc. Now we save the message as a
>> draft, and the minor mode first checks with the X-Gnus-Server: "can you
>> handle drafts?" The server can! Or it can't, and the message goes into
>> nndraft. Or the message is sent, and if there's no Gcc, the minor mode
>> asks the server, "Can you archive this somewhere?" And hey, maybe the
>> server can.
>>
>> All this confined to a minor-mode, of course.
>
> It sounds a bit abstract -- would it ignore nndrafts if the IMAP server
> has \Drafts?  (Auto-saving over nnimap isn't recommended, really.)

Actually I think this part would be much more straightforward to
implement. We decide on a priority for the various headers -- ie, an
explicit Gcc beats a X-Gnus-Server that can handle sent message, for
drafts maybe X-Draft-From comes into play -- and then just run through
what's in the message buffer. For drafts I think it would be easy enough
to have the auto-save process save the message to nndrafts, while
explicit "C-x C-s", "C-c C-d" and the gnus-quit prompt would check the
server for draft capability and give that priority.

Shall I open a wishlist bug report for this? Or keep it to myself?

Eric





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-22 18:20             ` Eric Abrahamsen
@ 2019-11-23 12:01               ` Lars Ingebrigtsen
  2019-11-23 14:19                 ` Eric Abrahamsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-23 12:01 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: Amin Bandali, 38289

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> For drafts I think it would be easy enough to have the auto-save
> process save the message to nndrafts, while explicit "C-x C-s", "C-c
> C-d" and the gnus-quit prompt would check the server for draft
> capability and give that priority.

Yeah, having `C-c C-d' save messages to \Drafts would be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies
  2019-11-23 12:01               ` Lars Ingebrigtsen
@ 2019-11-23 14:19                 ` Eric Abrahamsen
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Abrahamsen @ 2019-11-23 14:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Amin Bandali, 38289

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> For drafts I think it would be easy enough to have the auto-save
>> process save the message to nndrafts, while explicit "C-x C-s", "C-c
>> C-d" and the gnus-quit prompt would check the server for draft
>> capability and give that priority.
>
> Yeah, having `C-c C-d' save messages to \Drafts would be nice.

Okay, I'll put this on the (already very long) list. Maybe a new derived
major-mode...





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-11-23 14:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20  6:44 bug#38289: 27.0.50; C-c C-w not working if signature from gnus-posting-styles applies Amin Bandali
2019-11-21 13:41 ` Lars Ingebrigtsen
2019-11-21 20:38   ` Amin Bandali
2019-11-21 23:04     ` Lars Ingebrigtsen
2019-11-21 23:20       ` Lars Ingebrigtsen
2019-11-22  5:55         ` Eric Abrahamsen
2019-11-22 12:38           ` Lars Ingebrigtsen
2019-11-22 18:20             ` Eric Abrahamsen
2019-11-23 12:01               ` Lars Ingebrigtsen
2019-11-23 14:19                 ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).