GNU bug report logs - #45084
so-long mode vs. dired-view-file

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Sun, 6 Dec 2020 22:02:02 UTC

Severity: wishlist

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45084 in the body.
You can then email your comments to 45084 AT debbugs.gnu.org in the normal way.

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#45084; Package emacs. (Sun, 06 Dec 2020 22:02:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 06 Dec 2020 22:02:03 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: so-long mode vs. dired-view-file
Date: Sun, 06 Dec 2020 20:22:01 +0800
OK, here in emacs-version "27.1" we have
(global-so-long-mode 1)
in our .emacs file, and everything is working great.

We are happily using dired,

 v        ;; dired-view-file
 q        ;; View-quit
 SPC      ;; dired-next-line
 v        ;; dired-view-file
 q        ;; View-quit
 SPC      ;; dired-next-line
 v        ;; dired-view-file
 q        ;; View-quit
 SPC      ;; dired-next-line
 v        ;; dired-view-file
 q        ;; View-quit
 SPC      ;; dired-next-line
 v        ;; dired-view-file
 q        ;; self-insert-command <------Notice anything NOT funny?
 C-x k    ;; kill-buffer
 <return> ;; minibuffer-complete-and-exit

That's right. We stumbled into a file that triggers so-long mode.

Our whole rhythm is busted. And we have to go through hoops to finally
do what just a "q" did.

So so-long mode and whatever dired-view-file calls should somehow make a
deal not to mess up "q".

The modeline says (So Long View).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45084; Package emacs. (Mon, 07 Dec 2020 04:25:02 GMT) Full text and rfc822 format available.

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

From: Phil Sainty <psainty <at> orcon.net.nz>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 45084 <at> debbugs.gnu.org
Subject: Re: bug#45084: so-long mode vs. dired-view-file
Date: Mon, 07 Dec 2020 17:24:12 +1300
On 2020-12-07 01:22, 積丹尼 Dan Jacobson wrote:
> That's right. We stumbled into a file that triggers so-long mode.
> 
> Our whole rhythm is busted. And we have to go through hoops to finally
> do what just a "q" did.
> 
> So so-long mode and whatever dired-view-file calls should somehow make
> a deal not to mess up "q".

It's true that, by default, so-long changing the major mode is going
to cause key bindings for the original mode to not be available.  This
is one of the trade-offs we make -- we have the benefit that Emacs
isn't going to freeze up, with the cost that the file is being treated
differently.

I don't think it would be very practical to try to account for all of
the special cases that might arise in people's workflows, and try to
implement workarounds.  Adding `view-mode' support wouldn't be hard,
but I do worry about the slippery slope factor.

You can alternatively use:

 (setq so-long-action 'so-long-minor-mode)

And then the buffers would remain in view-mode, and "q" will work as
normal.


-Phil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45084; Package emacs. (Tue, 08 Dec 2020 05:31:01 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 45084 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#45084: so-long mode vs. dired-view-file
Date: Tue, 08 Dec 2020 00:30:29 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > So so-long mode and whatever dired-view-file calls should somehow make
  > > a deal not to mess up "q".

  > It's true that, by default, so-long changing the major mode is going
  > to cause key bindings for the original mode to not be available.

dired-view-file does something quite unusual: it visits a file and puts
it in View mode.

I think so-long needs to make a special case for View mode.
For instance, if View mode is in effect, it could (1) turn off View mode,
(2) switch modes however it does, then (3) reenable View mode.
 
-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45084; Package emacs. (Sun, 06 Jun 2021 10:33:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Richard Stallman <rms <at> gnu.org>
Cc: Phil Sainty <psainty <at> orcon.net.nz>, 45084 <at> debbugs.gnu.org,
 jidanni <at> jidanni.org
Subject: Re: bug#45084: so-long mode vs. dired-view-file
Date: Sun, 06 Jun 2021 12:32:18 +0200
Richard Stallman <rms <at> gnu.org> writes:

> dired-view-file does something quite unusual: it visits a file and puts
> it in View mode.
>
> I think so-long needs to make a special case for View mode.
> For instance, if View mode is in effect, it could (1) turn off View mode,
> (2) switch modes however it does, then (3) reenable View mode.

It does feel a bit messy to special-case `view-mode' here, but on the
other hand, not doing so will make the `v' command in Dired a less
handy.

So I've gone ahead with Richard's suggestion here in Emacs 28 --
`so-long' will now restore the view minor mode if it was switched on.

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




bug marked as fixed in version 28.1, send any further explanations to 45084 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 06 Jun 2021 10:34:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45084; Package emacs. (Mon, 07 Jun 2021 08:15:02 GMT) Full text and rfc822 format available.

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

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45084 <at> debbugs.gnu.org, Richard Stallman <rms <at> gnu.org>, jidanni <at> jidanni.org
Subject: Re: bug#45084: so-long mode vs. dired-view-file
Date: Mon, 07 Jun 2021 20:14:11 +1200
Hi Lars,

Thanks for this.  I've actually implemented a more general solution
with default support for the view-mode case, so I'll revert your
changes when I merge the scratch/so-long changes.

https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=scratch/so-long&id=6edeae3b4b7dd5105c9cf0dc0560d4c2c96a85bd

I don't see a problem with leaving your change in place for the interim,
though.  It doesn't handle the `so-long-revert' case, but there's no
need to address that as my changes will deal with it.


-Phil



On 2021-06-06 22:32, Lars Ingebrigtsen wrote:
> Richard Stallman <rms <at> gnu.org> writes:
> 
>> dired-view-file does something quite unusual: it visits a file and 
>> puts
>> it in View mode.
>> 
>> I think so-long needs to make a special case for View mode.
>> For instance, if View mode is in effect, it could (1) turn off View 
>> mode,
>> (2) switch modes however it does, then (3) reenable View mode.
> 
> It does feel a bit messy to special-case `view-mode' here, but on the
> other hand, not doing so will make the `v' command in Dired a less
> handy.
> 
> So I've gone ahead with Richard's suggestion here in Emacs 28 --
> `so-long' will now restore the view minor mode if it was switched on.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 05 Jul 2021 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 267 days ago.

Previous Next


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