GNU bug report logs - #71404
30.0.50; [WISHLIST] string-edit-mode should allow changing major mode

Previous Next

Package: emacs;

Reported by: Nicholas Vollmer <nv <at> parenthetic.dev>

Date: Fri, 7 Jun 2024 03:51:01 UTC

Severity: wishlist

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nicholas Vollmer <nv <at> parenthetic.dev>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71404 <at> debbugs.gnu.org
Subject: bug#71404: 30.0.50; [WISHLIST] string-edit-mode should allow changing major mode
Date: Fri, 07 Jun 2024 19:37:24 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Nicholas Vollmer <nv <at> parenthetic.dev>
>> Date: Thu, 06 Jun 2024 11:50:16 -0400
>> 
>> 
>> string-edit-mode is a nice feature to have built in.
>
> It already is?  Or what do you mean by "built in" here?

Correct. It is. I was just commenting that I'm glad to see it part 
of Emacs, rather than re-implemented over and over in third-party 
packages.
That is all.

>> It would be nice if one could change the major mode of the 
>> editing 
>> buffer while preserving the edit/abort functionality and any 
>> buffer state necessary to make those function.
>> Any reason it couldn't be implemented as a  minor mode?
>
> In what major modes will this make sense as a minor mode?

Many. For example. If the string to edit is an elisp form, why 
shouldn't the editing buffer be emacs-lisp-mode?
If the string to edit is a message which can be formatted with 
markdown, why not markdown-mode?
(I ran into this yesterday when implementing a command for 
personal use).
I can imagine many scenarios where the major mode could be 
something other than text-mode.
It seems to me that it would make more sense for the 
"abort/finish" key bindings to be bound to  a minor mode map so 
the editing buffer can be much more flexible.

> IOW, I don't think I understand what you mean by "preserving the
> edit/abort functionality and buffer state", so please elaborate.

The buffer has some local state (e.g. the abort callback function, 
header-line) stored in a buffer-local variables which are not 
preserved when the major mode is changed.







This bug report was last modified 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.