ement.el icon indicating copy to clipboard operation
ement.el copied to clipboard

Changing major mode in composition buffer erases header line and binding

Open alphapapa opened this issue 2 years ago • 2 comments

From @wolfjb:matrix.org:

using M-RET to compose in a buffer, then using M-x org-mode to switch the major mode, the C-x C-s keybinding disappears and the message doesn't post. But copying it, killing the window, and then M-RET again does show the keybindings and pasting the message works.

alphapapa avatar Mar 07 '23 01:03 alphapapa

"Don't use M-x org-mode" is the answer to that, I would have thought? Changing major mode in any buffer will kill the buffer's header- and footer-lines (along with most other buffer-local values), and change the mode-specific key bindings that are available; so that's just expected behaviour, no? Hence the M-x ement-room-compose-org command for switching to org formatting without incurring these problems...

That said, a buffer-local change-major-mode-hook function could be used to stash away any particular things deemed desirable to restore after a major mode change, if reacting to arbitrary mode changes was going to be a thing.

phil-s avatar Oct 03 '23 11:10 phil-s

Yes, knowing what we do about Emacs's internals, this is obviously wrong to us. But to a non-developer user, simply activating org-mode normally would be natural. So it'd be nice to handle this in some way to prevent the composition buffer from getting "broken," or at least direct the user to the proper command.

alphapapa avatar Oct 04 '23 05:10 alphapapa