unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31388: 27.0.50; message-mode hard-codes key bindings in docstring
@ 2018-05-08 19:06 Basil L. Contovounesios
  2018-05-08 19:11 ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2018-05-08 19:06 UTC (permalink / raw)
  To: 31388; +Cc: Lars Ingebrigtsen

The docstring of message-mode currently hard-codes the bindings provided
by message-mode-map.  For example:

1. emacs -Q
2. Evaluate:
   (with-eval-after-load 'message
     (define-key message-mode-map "\C-c\C-c" #'ignore))
3. C-x m
4. C-c ?

still reports "C-c C-c  ‘message-send-and-exit’".

Is this intentional?  I realise that this affords summary, custom
layout, and descriptions of the available bindings, but isn't it
confusing to report the wrong thing in the case that users customise
(or use packages which customise) their bindings?

One solution is to replace the hard-coded bindings with
\[command]-sequences; another to replace the whole listing with
\{message-mode-map}.  In both cases, the binding listed for
message-insert-or-toggle-importance will be C-c C-u instead of
C-c C-f C-i, due to the higher precedence of the former.  WDYT?

P.S. I have, over time, accumulated a set of 12 patches for message.el
     with refactors such as defining message-mode-map in a single
     (let ...)  calculation, replacing '-quotes with #'-quotes where
     applicable, removing calls to mapcar where the result is unused,
     adding tests, etc.  I also have a couple of minor and relevant
     questions to ask.  Would patches of this nature be welcome?  If so,
     should I send them here, submit a new bug report, or send mail to
     emacs-devel?

Thanks,

-- 
Basil





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

* bug#31388: 27.0.50; message-mode hard-codes key bindings in docstring
  2018-05-08 19:06 bug#31388: 27.0.50; message-mode hard-codes key bindings in docstring Basil L. Contovounesios
@ 2018-05-08 19:11 ` Basil L. Contovounesios
  2019-05-13 21:06   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2018-05-08 19:11 UTC (permalink / raw)
  To: 31388; +Cc: Lars Ingebrigtsen

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Do-not-hard-code-message-mode-keys-in-docstring.patch --]
[-- Type: text/x-diff, Size: 6414 bytes --]

From 0d0afd160b16decb77a9358a49efab5fdf307ba6 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Mon, 7 May 2018 16:29:19 +0100
Subject: [PATCH] Do not hard-code message-mode keys in docstring

* lisp/gnus/message.el (message-mode): Replace hard-coded bindings
with \[command] sequences in docstring.
---
 lisp/gnus/message.el | 101 ++++++++++++++++++++++++++++---------------
 1 file changed, 65 insertions(+), 36 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 867c3d271b..c407fb0a6a 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2893,42 +2893,71 @@ message--syntax-propertize
 ;;;###autoload
 (define-derived-mode message-mode text-mode "Message"
   "Major mode for editing mail and news to be sent.
-Like Text Mode but with these additional commands:\\<message-mode-map>
-C-c C-s  `message-send' (send the message)  C-c C-c  `message-send-and-exit'
-C-c C-d  Postpone sending the message       C-c C-k  Kill the message
-C-c C-f  move to a header field (and create it if there isn't):
-	 C-c C-f C-t  move to To	C-c C-f C-s  move to Subject
-	 C-c C-f C-c  move to Cc	C-c C-f C-b  move to Bcc
-	 C-c C-f C-w  move to Fcc	C-c C-f C-r  move to Reply-To
-	 C-c C-f C-u  move to Summary	C-c C-f C-n  move to Newsgroups
-	 C-c C-f C-k  move to Keywords	C-c C-f C-d  move to Distribution
-	 C-c C-f C-o  move to From (\"Originator\")
-	 C-c C-f C-f  move to Followup-To
-	 C-c C-f C-m  move to Mail-Followup-To
-	 C-c C-f C-e  move to Expires
-	 C-c C-f C-i  cycle through Importance values
-	 C-c C-f s    change subject and append \"(was: <Old Subject>)\"
-	 C-c C-f x    crossposting with FollowUp-To header and note in body
-	 C-c C-f t    replace To: header with contents of Cc: or Bcc:
-	 C-c C-f a    Insert X-No-Archive: header and a note in the body
-C-c C-t  `message-insert-to' (add a To header to a news followup)
-C-c C-l  `message-to-list-only' (removes all but list address in to/cc)
-C-c C-n  `message-insert-newsgroups' (add a Newsgroup header to a news reply)
-C-c C-b  `message-goto-body' (move to beginning of message text).
-C-c C-i  `message-goto-signature' (move to the beginning of the signature).
-C-c C-w  `message-insert-signature' (insert `message-signature-file' file).
-C-c C-y  `message-yank-original' (insert current message, if any).
-C-c C-q  `message-fill-yanked-message' (fill what was yanked).
-C-c C-e  `message-elide-region' (elide the text between point and mark).
-C-c C-v  `message-delete-not-region' (remove the text outside the region).
-C-c C-z  `message-kill-to-signature' (kill the text up to the signature).
-C-c C-r  `message-caesar-buffer-body' (rot13 the message body).
-C-c C-a  `mml-attach-file' (attach a file as MIME).
-C-c C-u  `message-insert-or-toggle-importance'  (insert or cycle importance).
-C-c M-n  `message-insert-disposition-notification-to'  (request receipt).
-C-c M-m  `message-mark-inserted-region' (mark region with enclosing tags).
-C-c M-f  `message-mark-insert-file' (insert file marked with enclosing tags).
-M-RET    `message-newline-and-reformat' (break the line and reformat)."
+Like `text-mode' but with these additional commands:\\<message-mode-map>
+\\[message-send]	 `message-send' (send the message)
+\\[message-send-and-exit]	 `message-send-and-exit'
+\\[message-dont-send]	 Postpone sending the message
+\\[message-kill-buffer]	 Kill the message
+Commands for moving to a header field, creating it as required:
+	 \\[message-goto-to]	Move to To
+	 \\[message-goto-subject]	Move to Subject
+	 \\[message-goto-cc]	Move to Cc
+	 \\[message-goto-bcc]	Move to Bcc
+	 \\[message-goto-fcc]	Move to Fcc
+	 \\[message-goto-reply-to]	Move to Reply-To
+	 \\[message-goto-summary]	Move to Summary
+	 \\[message-goto-newsgroups]	Move to Newsgroups
+	 \\[message-goto-keywords]	Move to Keywords
+	 \\[message-goto-distribution]	Move to Distribution
+	 \\[message-goto-from]	Move to From (\"Originator\")
+	 \\[message-goto-followup-to]	Move to Followup-To
+	 \\[message-goto-mail-followup-to]	Move to Mail-Followup-To
+	 \\[message-insert-expires]	Move to Expires
+         \\[message-insert-or-toggle-importance]\
+	Cycle through Importance values
+	 \\[message-change-subject]\
+	Change subject and append \"(was: <Old Subject>)\"
+	 \\[message-cross-post-followup-to]\
+	Crosspost with Followup-To header and note in body
+	 \\[message-reduce-to-to-cc]\
+	Replace To header with contents of Cc or Bcc
+	 \\[message-add-archive-header]\
+	Insert X-No-Archive header and note in body
+\\[message-insert-to]\
+	 `message-insert-to' (add To header to a news followup)
+\\[message-to-list-only]\
+	 `message-to-list-only' (remove all but list address in To/Cc)
+\\[message-insert-newsgroups]\
+	 `message-insert-newsgroups' (add Newsgroup header to a news reply)
+\\[message-goto-body]\
+	 `message-goto-body' (move to beginning of message text)
+\\[message-goto-signature]\
+	 `message-goto-signature' (move to beginning of the signature)
+\\[message-insert-signature]\
+	 `message-insert-signature' (insert `message-signature-file' file)
+\\[message-yank-original]\
+	 `message-yank-original' (insert current message, if any)
+\\[message-fill-yanked-message]\
+	 `message-fill-yanked-message' (fill what was yanked)
+\\[message-elide-region]\
+	 `message-elide-region' (elide text between point and mark)
+\\[message-delete-not-region]\
+	 `message-delete-not-region' (remove text outside the region)
+\\[message-kill-to-signature]\
+	 `message-kill-to-signature' (kill text up to the signature)
+\\[message-caesar-buffer-body]\
+	 `message-caesar-buffer-body' (rot13 the message body)
+\\[mml-attach-file]	 `mml-attach-file' (attach a file as MIME)
+\\[message-insert-or-toggle-importance]\
+	 `message-insert-or-toggle-importance'  (insert or cycle importance)
+\\[message-insert-disposition-notification-to]\
+	 `message-insert-disposition-notification-to'  (request receipt)
+\\[message-mark-inserted-region]\
+	 `message-mark-inserted-region' (mark region with enclosing tags)
+\\[message-mark-insert-file]\
+	 `message-mark-insert-file' (insert file marked with enclosing tags)
+\\[message-newline-and-reformat]\
+	 `message-newline-and-reformat' (break line and reformat)"
   (set (make-local-variable 'message-reply-buffer) nil)
   (set (make-local-variable 'message-inserted-headers) nil)
   (set (make-local-variable 'message-send-actions) nil)
-- 
2.17.0


[-- Attachment #2: Type: text/plain, Size: 468 bytes --]


"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> One solution is to replace the hard-coded bindings with
> \[command]-sequences; another to replace the whole listing with
> \{message-mode-map}.  In both cases, the binding listed for
> message-insert-or-toggle-importance will be C-c C-u instead of
> C-c C-f C-i, due to the higher precedence of the former.  WDYT?

I attach a patch as an example of doing the former.
The latter would probably look as follows:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-Do-not-hard-code-message-mode-keys-in-docstring.patch --]
[-- Type: text/x-diff, Size: 3399 bytes --]

From e1b28796dc2c6b6828d73740dd98f4fd83771caa Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Mon, 7 May 2018 16:42:41 +0100
Subject: [PATCH] Do not hard-code message-mode keys in docstring

* lisp/gnus/message.el (message-mode): Replace hard-coded bindings
in docstring with summary of message-mode-map.
---
 lisp/gnus/message.el | 39 +++------------------------------------
 1 file changed, 3 insertions(+), 36 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 867c3d271b..a85925d94d 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2893,42 +2893,9 @@ message--syntax-propertize
 ;;;###autoload
 (define-derived-mode message-mode text-mode "Message"
   "Major mode for editing mail and news to be sent.
-Like Text Mode but with these additional commands:\\<message-mode-map>
-C-c C-s  `message-send' (send the message)  C-c C-c  `message-send-and-exit'
-C-c C-d  Postpone sending the message       C-c C-k  Kill the message
-C-c C-f  move to a header field (and create it if there isn't):
-	 C-c C-f C-t  move to To	C-c C-f C-s  move to Subject
-	 C-c C-f C-c  move to Cc	C-c C-f C-b  move to Bcc
-	 C-c C-f C-w  move to Fcc	C-c C-f C-r  move to Reply-To
-	 C-c C-f C-u  move to Summary	C-c C-f C-n  move to Newsgroups
-	 C-c C-f C-k  move to Keywords	C-c C-f C-d  move to Distribution
-	 C-c C-f C-o  move to From (\"Originator\")
-	 C-c C-f C-f  move to Followup-To
-	 C-c C-f C-m  move to Mail-Followup-To
-	 C-c C-f C-e  move to Expires
-	 C-c C-f C-i  cycle through Importance values
-	 C-c C-f s    change subject and append \"(was: <Old Subject>)\"
-	 C-c C-f x    crossposting with FollowUp-To header and note in body
-	 C-c C-f t    replace To: header with contents of Cc: or Bcc:
-	 C-c C-f a    Insert X-No-Archive: header and a note in the body
-C-c C-t  `message-insert-to' (add a To header to a news followup)
-C-c C-l  `message-to-list-only' (removes all but list address in to/cc)
-C-c C-n  `message-insert-newsgroups' (add a Newsgroup header to a news reply)
-C-c C-b  `message-goto-body' (move to beginning of message text).
-C-c C-i  `message-goto-signature' (move to the beginning of the signature).
-C-c C-w  `message-insert-signature' (insert `message-signature-file' file).
-C-c C-y  `message-yank-original' (insert current message, if any).
-C-c C-q  `message-fill-yanked-message' (fill what was yanked).
-C-c C-e  `message-elide-region' (elide the text between point and mark).
-C-c C-v  `message-delete-not-region' (remove the text outside the region).
-C-c C-z  `message-kill-to-signature' (kill the text up to the signature).
-C-c C-r  `message-caesar-buffer-body' (rot13 the message body).
-C-c C-a  `mml-attach-file' (attach a file as MIME).
-C-c C-u  `message-insert-or-toggle-importance'  (insert or cycle importance).
-C-c M-n  `message-insert-disposition-notification-to'  (request receipt).
-C-c M-m  `message-mark-inserted-region' (mark region with enclosing tags).
-C-c M-f  `message-mark-insert-file' (insert file marked with enclosing tags).
-M-RET    `message-newline-and-reformat' (break the line and reformat)."
+Like `text-mode', but with these additional commands:
+
+\\{message-mode-map}"
   (set (make-local-variable 'message-reply-buffer) nil)
   (set (make-local-variable 'message-inserted-headers) nil)
   (set (make-local-variable 'message-send-actions) nil)
-- 
2.17.0


[-- Attachment #4: Type: text/plain, Size: 11 bytes --]


-- 
Basil

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

* bug#31388: 27.0.50; message-mode hard-codes key bindings in docstring
  2018-05-08 19:11 ` Basil L. Contovounesios
@ 2019-05-13 21:06   ` Lars Ingebrigtsen
  2019-05-13 23:05     ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-05-13 21:06 UTC (permalink / raw)
  To: 31388

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> I attach a patch as an example of doing the former.
> The latter would probably look as follows:
>
>>From e1b28796dc2c6b6828d73740dd98f4fd83771caa Mon Sep 17 00:00:00 2001
> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> Date: Mon, 7 May 2018 16:42:41 +0100
> Subject: [PATCH] Do not hard-code message-mode keys in docstring
>
> * lisp/gnus/message.el (message-mode): Replace hard-coded bindings
> in docstring with summary of message-mode-map.

Looks OK to me.

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





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

* bug#31388: 27.0.50; message-mode hard-codes key bindings in docstring
  2019-05-13 21:06   ` Lars Ingebrigtsen
@ 2019-05-13 23:05     ` Basil L. Contovounesios
  0 siblings, 0 replies; 4+ messages in thread
From: Basil L. Contovounesios @ 2019-05-13 23:05 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 31388-done

tags 31388 fixed
close 31388
quit

Lars Ingebrigtsen <larsi@gnus.org> writes:

>>>From e1b28796dc2c6b6828d73740dd98f4fd83771caa Mon Sep 17 00:00:00 2001
>> From: "Basil L. Contovounesios" <contovob@tcd.ie>
>> Date: Mon, 7 May 2018 16:42:41 +0100
>> Subject: [PATCH] Do not hard-code message-mode keys in docstring
>>
>> * lisp/gnus/message.el (message-mode): Replace hard-coded bindings
>> in docstring with summary of message-mode-map.
>
> Looks OK to me.

Thanks, I pushed to master[1] and am therefore closing this report.

[1: 364d4e156d]: Do not hard-code message-mode keys in docstring
  2019-05-13 23:58:45 +0100
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=364d4e156d80bff711d000bdb2e0ac765726c953

-- 
Basil





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

end of thread, other threads:[~2019-05-13 23:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-08 19:06 bug#31388: 27.0.50; message-mode hard-codes key bindings in docstring Basil L. Contovounesios
2018-05-08 19:11 ` Basil L. Contovounesios
2019-05-13 21:06   ` Lars Ingebrigtsen
2019-05-13 23:05     ` Basil L. Contovounesios

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).