unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#33855: 27.0.50; Can't see markup in HELLO
@ 2018-12-23 22:15 Stefan Monnier
  2022-05-18 13:07 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2018-12-23 22:15 UTC (permalink / raw)
  To: 33855

Severity: wishlist
Package: Emacs
Version: 27.0.50


I can't seem to figure out how to conveniently edit the markup.
In modes like image-mode, postscript-mode, doc-view-mode, ..., we can
choose between the "edit source" and "view rendering", but for
enriched-mode buffers, all I find is find-file-literally which not only
makes the markup explicit but also shows me the bytes rather than the
chars, which is not what I want.

I think we should add a way to see (and edit) the markup.
Maybe the corresponding command can be `enriched-mode` (tho currently
that command doesn't do this).
And maybe it can be bound to C-c C-c.


        Stefan



In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2018-12-14 built on pastel
Repository revision: fbae0090fe9595ba1669fdfd5ef88f1ee3172edc
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)

Recent messages:
Quit

Enriched: decoding document...
Indenting...
View mode: type C-h for help, h for commands, q to quit.
Quit
Auto-saving...
Warning: hide-sublevels is obsolete!
Mark saved where search started
Enriched mode disabled in current buffer





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2018-12-23 22:15 bug#33855: 27.0.50; Can't see markup in HELLO Stefan Monnier
@ 2022-05-18 13:07 ` Lars Ingebrigtsen
  2022-05-18 14:31   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-18 13:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 33855

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> I can't seem to figure out how to conveniently edit the markup.
> In modes like image-mode, postscript-mode, doc-view-mode, ..., we can
> choose between the "edit source" and "view rendering", but for
> enriched-mode buffers, all I find is find-file-literally which not only
> makes the markup explicit but also shows me the bytes rather than the
> chars, which is not what I want.
>
> I think we should add a way to see (and edit) the markup.
> Maybe the corresponding command can be `enriched-mode` (tho currently
> that command doesn't do this).
> And maybe it can be bound to C-c C-c.

This doesn't seem like it should be that difficult to implement.
Round-tripping with

(enriched-encode (point-min) (point-max) (current-buffer))

and

(enriched-decode (point-min) (point-max))

seems to work fine (well, with some post-processing after the first to
get rid of colours, so they're not doubly encoded).

I'm not quite sure that having the `C-c C-c' command be `enriched-mode'
would be all that helpful, though -- was there any particular reason for
that in the feature spec?  

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





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-18 13:07 ` Lars Ingebrigtsen
@ 2022-05-18 14:31   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-18 14:53     ` Robert Pluim
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-18 14:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 33855

> I'm not quite sure that having the `C-c C-c' command be `enriched-mode'
> would be all that helpful, though -- was there any particular reason for
> that in the feature spec?  

No, it just seemed like a natural binding for it.
But it'd likely be used so rarely that it's not worth having
a key-binding.


        Stefan






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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-18 14:31   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-18 14:53     ` Robert Pluim
  2022-05-19 23:18       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Robert Pluim @ 2022-05-18 14:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Stefan Monnier, 33855

>>>>> On Wed, 18 May 2022 10:31:10 -0400, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:

    >> I'm not quite sure that having the `C-c C-c' command be `enriched-mode'
    >> would be all that helpful, though -- was there any particular reason for
    >> that in the feature spec?  

    Stefan> No, it just seemed like a natural binding for it.
    Stefan> But it'd likely be used so rarely that it's not worth having
    Stefan> a key-binding.

How about "C-c '", for consistency with org-mode.

Robert
-- 





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-18 14:53     ` Robert Pluim
@ 2022-05-19 23:18       ` Lars Ingebrigtsen
  2022-05-20 12:33         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-19 23:18 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Stefan Monnier, 33855

Robert Pluim <rpluim@gmail.com> writes:

>     Stefan> No, it just seemed like a natural binding for it.
>     Stefan> But it'd likely be used so rarely that it's not worth having
>     Stefan> a key-binding.

I've now added a new command 'enriched-toggle-markup' to Emacs 29.

> How about "C-c '", for consistency with org-mode.

I left it unbound for now -- I'm not quite sure whether it's something
that many people would want to use, even if it's useful for debugging.

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





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-19 23:18       ` Lars Ingebrigtsen
@ 2022-05-20 12:33         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-20 13:16           ` Eli Zaretskii
  2022-05-21 11:58           ` Lars Ingebrigtsen
  0 siblings, 2 replies; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-20 12:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Robert Pluim, 33855

Lars Ingebrigtsen [2022-05-20 01:18:35] wrote:
> Robert Pluim <rpluim@gmail.com> writes:
>>     Stefan> No, it just seemed like a natural binding for it.
>>     Stefan> But it'd likely be used so rarely that it's not worth having
>>     Stefan> a key-binding.
> I've now added a new command 'enriched-toggle-markup' to Emacs 29.

Thanks.

>> How about "C-c '", for consistency with org-mode.
> I left it unbound for now -- I'm not quite sure whether it's something
> that many people would want to use, even if it's useful for debugging.

Agreed.

Looking a bit more into it, I wonder if 'enriched-toggle-markup' should
be merged with the `enriched-mode` command itself.

Currently, doing something like:

    C-x C-f .../HELLO    # Open an enriched-mode file
    M-x enriched-mode    # Disable enriched-mode
    foobar               # Insert arbitrary text
    C-x C-s              # Save

throws away all the annotations without any warning.

WDYT?


        Stefan






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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 12:33         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-20 13:16           ` Eli Zaretskii
  2022-05-20 14:24             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-21 11:58           ` Lars Ingebrigtsen
  1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2022-05-20 13:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: larsi, rpluim, 33855

> Cc: Robert Pluim <rpluim@gmail.com>, 33855@debbugs.gnu.org
> Date: Fri, 20 May 2022 08:33:43 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Currently, doing something like:
> 
>     C-x C-f .../HELLO    # Open an enriched-mode file
>     M-x enriched-mode    # Disable enriched-mode
>     foobar               # Insert arbitrary text
>     C-x C-s              # Save
> 
> throws away all the annotations without any warning.
> 
> WDYT?

What other method would you suggest for removing the annotations?





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 13:16           ` Eli Zaretskii
@ 2022-05-20 14:24             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-20 15:49               ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-20 14:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, rpluim, 33855

>> Cc: Robert Pluim <rpluim@gmail.com>, 33855@debbugs.gnu.org
>> Date: Fri, 20 May 2022 08:33:43 -0400
>> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> Currently, doing something like:
>> 
>>     C-x C-f .../HELLO    # Open an enriched-mode file
>>     M-x enriched-mode    # Disable enriched-mode
>>     foobar               # Insert arbitrary text
>>     C-x C-s              # Save
>> 
>> throws away all the annotations without any warning.
>> 
>> WDYT?
>
> What other method would you suggest for removing the annotations?

Maybe a more explicit one, like `C-x h M-x write-region`?

I can't see any part of my above recipe which says that the user (me in
this case, I was just trying things out, tho admittedly I disabled
`enriched-mode` via the menu on the "Enriched" word in the mode line
instead of via `M-x enriched-mode`) intended to remove the annotations.


        Stefan






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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 14:24             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-20 15:49               ` Eli Zaretskii
  2022-05-20 18:56                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2022-05-20 15:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: larsi, rpluim, 33855

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: larsi@gnus.org,  rpluim@gmail.com,  33855@debbugs.gnu.org
> Date: Fri, 20 May 2022 10:24:12 -0400
> 
> > What other method would you suggest for removing the annotations?
> 
> Maybe a more explicit one, like `C-x h M-x write-region`?

Yuck!  Users shouldn't need to use that command.

> I can't see any part of my above recipe which says that the user (me in
> this case, I was just trying things out, tho admittedly I disabled
> `enriched-mode` via the menu on the "Enriched" word in the mode line
> instead of via `M-x enriched-mode`) intended to remove the annotations.

That's what Emacs understood: disabling Enriched means you give up on
saving the faces and the other annotations, because Emacs never does
that.  E.g., if you save a buffer in CC mode with all the faces set by
font-lock, you don't expect the file on disk to have any traces of
those faces, right?





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 15:49               ` Eli Zaretskii
@ 2022-05-20 18:56                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-20 19:07                   ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-20 18:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, rpluim, 33855

Eli Zaretskii [2022-05-20 18:49:04] wrote:
>> Maybe a more explicit one, like `C-x h M-x write-region`?
> Yuck!  Users shouldn't need to use that command.

At least, for this user here, it is what I would do if I ever needed to
do that (and I think it's a fairly rare occurrence).

>> I can't see any part of my above recipe which says that the user (me in
>> this case, I was just trying things out, tho admittedly I disabled
>> `enriched-mode` via the menu on the "Enriched" word in the mode line
>> instead of via `M-x enriched-mode`) intended to remove the annotations.
> That's what Emacs understood:

I know but it very much surprised me, so I expect it could surprise
other users just as well.  Maybe `enriched-mode` should prompt the user
to confirm that this is what they intend.  And if they don't intend
to do that, it could do what `enriched-toggle-markup` does.

Similarly when enabling `enriched-mode` if it notices that the buffer is
already in a valid format for decoding, it could prompt to decide
whether to do the `enriched-toggle-markup` in reverse or to convert
the buffer to enriched-mode like it currently does.

> disabling Enriched means you give up on saving the faces and the other
> annotations,

I don't see any reason why the user should expect that.  Obviously some
users (e.g. you) would expect that, but since it throws away information
it seems better not to make such an assumption.

Usually our priority is to avoid throwing away information unless the
user says so explicitly and I don't think that disabling a minor mode
can be taken as a request to throw away information.

> because Emacs never does that.  E.g., if you save a buffer in CC mode
> with all the faces set by font-lock, you don't expect the file on disk
> to have any traces of those faces, right?

I think this assumes too much knowledge on the part of the user about
how `enriched-mode` works internally.


        Stefan






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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 18:56                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-20 19:07                   ` Eli Zaretskii
  2022-05-20 20:56                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2022-05-20 19:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: larsi, rpluim, 33855

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: larsi@gnus.org,  rpluim@gmail.com,  33855@debbugs.gnu.org
> Date: Fri, 20 May 2022 14:56:43 -0400
> 
> > because Emacs never does that.  E.g., if you save a buffer in CC mode
> > with all the faces set by font-lock, you don't expect the file on disk
> > to have any traces of those faces, right?
> 
> I think this assumes too much knowledge on the part of the user about
> how `enriched-mode` works internally.

Not at all.  Enriched mode is the _only_ mode that is capable of
preserving the faces when saving buffers to files.  The documentation
of Enriched mode spells that out at the beginning.

I'm quite sure any Emacs user knows that faces are lost when you save
a buffer to disk.





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 19:07                   ` Eli Zaretskii
@ 2022-05-20 20:56                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-21  5:34                       ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-20 20:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, rpluim, 33855

>> I think this assumes too much knowledge on the part of the user about
>> how `enriched-mode` works internally.
> Not at all.  Enriched mode is the _only_ mode that is capable of
> preserving the faces when saving buffers to files.  The documentation
> of Enriched mode spells that out at the beginning.

So you're absolutely sure that I'm one of the very rarest of users who
could fall into this trap?

I still can't see why even if you're right it wouldn't be beneficial to
merge `enriched-mode` with `enriched-toggle-markup` by prompting the users
to know which behavior they want.

When enabling `enriched-mode` we already prompt the user (to know what
to do about hard/soft newlines).


        Stefan






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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 20:56                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-21  5:34                       ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2022-05-21  5:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: larsi, rpluim, 33855

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: larsi@gnus.org,  rpluim@gmail.com,  33855@debbugs.gnu.org
> Date: Fri, 20 May 2022 16:56:24 -0400
> 
> I still can't see why even if you're right it wouldn't be beneficial to
> merge `enriched-mode` with `enriched-toggle-markup` by prompting the users
> to know which behavior they want.
> 
> When enabling `enriched-mode` we already prompt the user (to know what
> to do about hard/soft newlines).

I don't think I have a clear idea what kind of prompt do you have in
mind.  Please tell more.





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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-20 12:33         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-20 13:16           ` Eli Zaretskii
@ 2022-05-21 11:58           ` Lars Ingebrigtsen
  2022-05-21 12:42             ` Eli Zaretskii
  1 sibling, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-21 11:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Robert Pluim, 33855

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Looking a bit more into it, I wonder if 'enriched-toggle-markup' should
> be merged with the `enriched-mode` command itself.
>
> Currently, doing something like:
>
>     C-x C-f .../HELLO    # Open an enriched-mode file
>     M-x enriched-mode    # Disable enriched-mode
>     foobar               # Insert arbitrary text
>     C-x C-s              # Save
>
> throws away all the annotations without any warning.
>
> WDYT?

(Then more discussion followed.)

I don't really have much of an opinion here -- I think that
enriched-mode is a weird thing to have as a minor mode.  If you switch
it on in a programming mode, and then save the file, you've destroyed
the file -- silently.  (You can often undestroyify it by loading it into
Emacs, and then writing out the buffer text to a file, but would a user
know that?)

It's a thing that only makes sense as a major mode, inheriting from text
mode, and it should have its own file ending, like HELLO.enriched.

Fortunately, the only file in existence in the entire universe➀ that uses
this format (and minor mode) is etc/HELLO, so it's not a major issue
(except for the file-destroying bit for unfortunate users, but
fortunately most people don't know about it so they don't try to use
it).

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






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

* bug#33855: 27.0.50; Can't see markup in HELLO
  2022-05-21 11:58           ` Lars Ingebrigtsen
@ 2022-05-21 12:42             ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2022-05-21 12:42 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: rpluim, monnier, 33855

> Cc: Robert Pluim <rpluim@gmail.com>, 33855@debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sat, 21 May 2022 13:58:19 +0200
> 
> Fortunately, the only file in existence in the entire universe➀ that uses
> this format (and minor mode) is etc/HELLO

There's also etc/enriched.txt.





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

end of thread, other threads:[~2022-05-21 12:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-23 22:15 bug#33855: 27.0.50; Can't see markup in HELLO Stefan Monnier
2022-05-18 13:07 ` Lars Ingebrigtsen
2022-05-18 14:31   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-18 14:53     ` Robert Pluim
2022-05-19 23:18       ` Lars Ingebrigtsen
2022-05-20 12:33         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-20 13:16           ` Eli Zaretskii
2022-05-20 14:24             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-20 15:49               ` Eli Zaretskii
2022-05-20 18:56                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-20 19:07                   ` Eli Zaretskii
2022-05-20 20:56                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-21  5:34                       ` Eli Zaretskii
2022-05-21 11:58           ` Lars Ingebrigtsen
2022-05-21 12:42             ` Eli Zaretskii

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