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

To reply to this bug, email your comments to 71404 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Fri, 07 Jun 2024 03:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicholas Vollmer <nv <at> parenthetic.dev>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 07 Jun 2024 03:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicholas Vollmer <nv <at> parenthetic.dev>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; [WISHLIST] string-edit-mode should allow changing major mode
Date: Thu, 06 Jun 2024 11:50:16 -0400
string-edit-mode is a nice feature to have built in.
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?






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Fri, 07 Jun 2024 06:39:02 GMT) Full text and rfc822 format available.

Message #8 received at 71404 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicholas Vollmer <nv <at> parenthetic.dev>
Cc: 71404 <at> debbugs.gnu.org
Subject: Re: bug#71404: 30.0.50;
 [WISHLIST] string-edit-mode should allow changing major mode
Date: Fri, 07 Jun 2024 09:35:22 +0300
> 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?

> 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?

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Fri, 07 Jun 2024 23:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 71404 <at> debbugs.gnu.org (full text, mbox):

From: Nicholas Vollmer <nv <at> parenthetic.dev>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71404 <at> debbugs.gnu.org
Subject: Re: 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.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Sat, 08 Jun 2024 02:41:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicholas Vollmer <nv <at> parenthetic.dev>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 30.0.50; [WISHLIST] string-edit-mode should allow changing
 major mode
Date: Fri, 07 Jun 2024 22:24:06 -0400
Nicholas Vollmer <nv <at> parenthetic.dev> writes:

Attached is a proof-of-concept patch which addresses bugs #71404, 
#71405, and #71406 
I'll take care of that if/when the design is agreed upon.

The patch rewrites string-edit-mode as a minor mode.
It utilizes an overlay for the edit prompt (to persist across 
major mode changes) and prevents the prompt separator from being 
deleted.
It persists the buffer-local editing data so that the major mode 
can be changed and the edit can still be completed.
It uses #'ignore as the default abort function if none is 
provided.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Sat, 08 Jun 2024 02:41:02 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicholas Vollmer <nv <at> parenthetic.dev>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 30.0.50; [WISHLIST] string-edit-mode should allow changing
 major mode
Date: Fri, 07 Jun 2024 22:27:58 -0400
[Message part 1 (text/plain, inline)]
Nicholas Vollmer <nv <at> parenthetic.dev> writes:

> Nicholas Vollmer <nv <at> parenthetic.dev> writes:
>
> Attached is a proof-of-concept patch which addresses bugs 
> #71404, #71405, and
> #71406 I'll take care of that if/when the design is agreed upon.
>
> The patch rewrites string-edit-mode as a minor mode.
> It utilizes an overlay for the edit prompt (to persist across 
> major mode
> changes) and prevents the prompt separator from being deleted.
> It persists the buffer-local editing data so that the major mode 
> can be changed
> and the edit can still be completed.
> It uses #'ignore as the default abort function if none is 
> provided.

Sorry. Forgot to attach patch.
Attached here.

[0001-lisp-textmodes-string-edit.el-refactor-as-minor-mode.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Tue, 11 Jun 2024 20:35:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicholas Vollmer <nv <at> parenthetic.dev>
To: bug-gnu-emacs <at> gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: 30.0.50; [WISHLIST] string-edit-mode should allow changing
 major mode
Date: Mon, 10 Jun 2024 16:53:47 -0400
Nicholas Vollmer <nv <at> parenthetic.dev> writes:

> Nicholas Vollmer <nv <at> parenthetic.dev> writes:
>
>> Nicholas Vollmer <nv <at> parenthetic.dev> writes:
>>
>> Attached is a proof-of-concept patch which addresses bugs 
>> #71404, #71405, and
>> #71406 I'll take care of that if/when the design is agreed 
>> upon.
>>
>> The patch rewrites string-edit-mode as a minor mode.
>> It utilizes an overlay for the edit prompt (to persist across 
>> major mode
>> changes) and prevents the prompt separator from being deleted.
>> It persists the buffer-local editing data so that the major 
>> mode can be
>> changed
>> and the edit can still be completed.
>> It uses #'ignore as the default abort function if none is 
>> provided.
>
> Sorry. Forgot to attach patch.
> Attached here.
>
> [2. text/x-patch; 
> 0001-lisp-textmodes-string-edit.el-refactor-as-minor-mode.patch]...


Any thoughts here?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Tue, 11 Jun 2024 20:42:06 GMT) Full text and rfc822 format available.

Message #23 received at 71404 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicholas Vollmer <nv <at> parenthetic.dev>
Cc: 71404 <at> debbugs.gnu.org
Subject: Re: bug#71404: 30.0.50;
 [WISHLIST] string-edit-mode should allow changing major mode
Date: Tue, 11 Jun 2024 09:21:48 +0300
> From: Nicholas Vollmer <nv <at> parenthetic.dev>
> CC: Eli Zaretskii <eliz <at> gnu.org>
> Date: Mon, 10 Jun 2024 16:53:47 -0400
> 
> Any thoughts here?

I didn't yet have time to look into this, sorry.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Thu, 11 Jul 2024 15:04:02 GMT) Full text and rfc822 format available.

Message #26 received at 71404 <at> debbugs.gnu.org (full text, mbox):

From: No Wayman <iarchivedmywholelife <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Nicholas Vollmer <nv <at> parenthetic.dev>, 71404 <at> debbugs.gnu.org
Subject: Re: bug#71404: 30.0.50; [WISHLIST] string-edit-mode should allow
 changing major mode
Date: Thu, 11 Jul 2024 11:01:39 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Nicholas Vollmer <nv <at> parenthetic.dev>
>> CC: Eli Zaretskii <eliz <at> gnu.org>
>> Date: Mon, 10 Jun 2024 16:53:47 -0400
>> 
>> Any thoughts here?
>
> I didn't yet have time to look into this, sorry.

Feel free to close this. Patch has gone rotten on the vine.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71404; Package emacs. (Tue, 23 Jul 2024 21:06:01 GMT) Full text and rfc822 format available.

Message #29 received at 71404 <at> debbugs.gnu.org (full text, mbox):

From: Jeremy Bryant <jb <at> jeremybryant.net>
To: No Wayman <iarchivedmywholelife <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 71404 <at> debbugs.gnu.org,
 Nicholas Vollmer <nv <at> parenthetic.dev>
Subject: Re: bug#71404: 30.0.50; [WISHLIST] string-edit-mode should allow
 changing major mode
Date: Tue, 23 Jul 2024 22:04:52 +0100
No Wayman <iarchivedmywholelife <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> From: Nicholas Vollmer <nv <at> parenthetic.dev>
>>> CC: Eli Zaretskii <eliz <at> gnu.org>
>>> Date: Mon, 10 Jun 2024 16:53:47 -0400
>>> Any thoughts here?
>>
>> I didn't yet have time to look into this, sorry.
>



> Feel free to close this. Patch has gone rotten on the vine.

Please elaborate?




This bug report was last modified 86 days ago.

Previous Next


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