unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45084: so-long mode vs. dired-view-file
@ 2020-12-06 12:22 積丹尼 Dan Jacobson
  2020-12-07  4:24 ` Phil Sainty
  0 siblings, 1 reply; 5+ messages in thread
From: 積丹尼 Dan Jacobson @ 2020-12-06 12:22 UTC (permalink / raw)
  To: 45084

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





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

* bug#45084: so-long mode vs. dired-view-file
  2020-12-06 12:22 bug#45084: so-long mode vs. dired-view-file 積丹尼 Dan Jacobson
@ 2020-12-07  4:24 ` Phil Sainty
  2020-12-08  5:30   ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Sainty @ 2020-12-07  4:24 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 45084

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






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

* bug#45084: so-long mode vs. dired-view-file
  2020-12-07  4:24 ` Phil Sainty
@ 2020-12-08  5:30   ` Richard Stallman
  2021-06-06 10:32     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Stallman @ 2020-12-08  5:30 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 45084, jidanni

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







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

* bug#45084: so-long mode vs. dired-view-file
  2020-12-08  5:30   ` Richard Stallman
@ 2021-06-06 10:32     ` Lars Ingebrigtsen
  2021-06-07  8:14       ` Phil Sainty
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-06 10:32 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Phil Sainty, 45084, jidanni

Richard Stallman <rms@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





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

* bug#45084: so-long mode vs. dired-view-file
  2021-06-06 10:32     ` Lars Ingebrigtsen
@ 2021-06-07  8:14       ` Phil Sainty
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Sainty @ 2021-06-07  8:14 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 45084, Richard Stallman, jidanni

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






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

end of thread, other threads:[~2021-06-07  8:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 12:22 bug#45084: so-long mode vs. dired-view-file 積丹尼 Dan Jacobson
2020-12-07  4:24 ` Phil Sainty
2020-12-08  5:30   ` Richard Stallman
2021-06-06 10:32     ` Lars Ingebrigtsen
2021-06-07  8:14       ` Phil Sainty

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