all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74637: [PATCH] Make view-read-only behave like view-file
@ 2024-12-01 20:40 Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-01 20:40 UTC (permalink / raw)
  To: 74637

[-- Attachment #1: Type: text/plain, Size: 3160 bytes --]

Tags: patch


Make view-mode behave like when called in view-file when entered because
`view-read-only' is true on a file which is not writable.
The change makes the view-read-only behave better on files which are
not writable. 
Now it makes Emacs behave more like less on these files.



In GNU Emacs 31.0.50 (build 1, x86_64-suse-linux-gnu, GTK+ Version
3.24.43, cairo version 1.18.2)
Repository revision: eee0ed8442aa78320a3e578ab290df145fb49624
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: openSUSE Tumbleweed

Configured using:
 'configure --disable-build-details --without-pop --with-mailutils
 --without-hesiod --with-gameuser=:games --with-kerberos
 --with-kerberos5 --with-file-notification=inotify --with-modules
 --enable-autodepend --enable-link-time-optimization --prefix=/usr
 --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share
 --localstatedir=/var --sharedstatedir=/var/lib
 --libexecdir=/usr/libexec --with-file-notification=yes
 --libdir=/usr/lib64 --with-native-compilation=aot
 --enable-locallisppath=/usr/share/emacs/31.0.50/site-lisp:/usr/share/emacs/site-lisp
 --with-x --with-xim --with-sound --with-xpm --with-jpeg --with-tiff
 --with-gif --with-png --with-rsvg --with-dbus --with-xft --without-gpm
 --with-tree-sitter --with-x-toolkit=gtk --without-pgtk
 --with-toolkit-scroll-bars --x-includes=/usr/include
 --x-libraries=/usr/lib64 --with-libotf --with-m17n-flt --with-cairo
 --build=x86_64-suse-linux --with-dumping=pdumper
 build_alias=x86_64-suse-linux 'CC=sccache cc' 'CFLAGS=-O2 -Wall
 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong
 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection
 -Werror=return-type -flto=auto -march=znver3 -mmmx -mpopcnt -msse
 -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -msse4a -mno-fma4
 -mno-xop -mfma -mbmi -mbmi2 -maes -mpclmul -mno-gfni -mvpclmulqdq
 -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mclzero
 -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp
 -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mmwaitx -mno-pconfig -mpku
 -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize
 -mno-sgx -msha -mshstk -mno-tbm -mno-tsxldtrk -mvaes -mno-waitpkg
 -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile
 -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl
 -mno-avxvnni -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert
 -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint
 -mno-amx-complex --param l1-cache-size=32 --param l1-cache-line-size=64
 --param l2-cache-size=512 -mtune=znver3 -fno-optimize-sibling-calls -O2
 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong
 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection
 -Werror=return-type -flto=auto -g -D_GNU_SOURCE
 -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS
 -pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label
 -DPDMP_BASE='\''"emacs-gtk"'\''' LDFLAGS=-Wl,-O2 'CXX=sccache c++'
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-view-read-only-behave-like-view-file.patch --]
[-- Type: text/patch, Size: 1937 bytes --]

From d77d0880871061820b1cdf61f1d74f2a7e5224aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Sun, 1 Dec 2024 22:22:24 +0200
Subject: [PATCH] Make view-read-only behave like view-file

Make view-mode also behave like less when entered through the
view-read-only option similarly as done in in
'1997-06-14 "Make view mode more similar to `less'' (ab7782fc244).
* lisp/files.el (after-find-file):
When opening a file which is read only and `view-read-only' is true
leave view-mode with `kill-buffer-if-not-modified'.
* lisp/view.el (view-mode): Document new behavior.
---
 lisp/files.el | 2 +-
 lisp/view.el  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index a65bc4a4ea2..2f062b45daf 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2874,7 +2874,7 @@ after-find-file
     (when (and buffer-read-only
 	       view-read-only
 	       (not (eq (get major-mode 'mode-class) 'special)))
-      (view-mode-enter))
+      (view-mode-enter nil 'kill-buffer-if-not-modified))
     (run-hooks 'find-file-hook)))
 
 (define-obsolete-function-alias 'report-errors 'with-demoted-errors "25.1")
diff --git a/lisp/view.el b/lisp/view.el
index 2ac7479739f..422d8a1f537 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -416,7 +416,7 @@ view-mode
 The effect of \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] depends on how view-mode was entered.  If it was
 entered by view-file, view-file-other-window, view-file-other-frame, or
 \\[dired-view-file] \(\\[view-file], \\[view-file-other-window],
-\\[view-file-other-frame], or the Dired mode v command),
+\\[view-file-other-frame], `view-read-only', or the Dired mode v command),
 then \\[View-quit] will try to kill the current buffer.
 If view-mode was entered from another buffer, by \\[view-buffer],
 \\[view-buffer-other-window], \\[view-buffer-other frame], \\[view-file],
-- 
2.45.2


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

* bug#74637: [PATCH] Make view-read-only behave like view-file
       [not found] <87ldwzm91r.fsf@>
@ 2024-12-02 12:29 ` Eli Zaretskii
  2024-12-02 18:08   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]   ` <87ttbmj6tt.fsf@>
  0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2024-12-02 12:29 UTC (permalink / raw)
  To: Björn Bidar; +Cc: 74637

> Date: Sun, 01 Dec 2024 22:40:16 +0200
> From:  Björn Bidar via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Make view-mode behave like when called in view-file when entered because
> `view-read-only' is true on a file which is not writable.
> The change makes the view-read-only behave better on files which are
> not writable. 
> Now it makes Emacs behave more like less on these files.

That's an incompatible behavior change.  Is that justified?  How can
we be sure that everyone agrees with your interpretation of this mode?





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-02 12:29 ` Eli Zaretskii
@ 2024-12-02 18:08   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]   ` <87ttbmj6tt.fsf@>
  1 sibling, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-02 18:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74637

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 01 Dec 2024 22:40:16 +0200
>> From:  Björn Bidar via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> Make view-mode behave like when called in view-file when entered because
>> `view-read-only' is true on a file which is not writable.
>> The change makes the view-read-only behave better on files which are
>> not writable. 
>> Now it makes Emacs behave more like less on these files.
>
> That's an incompatible behavior change.  Is that justified?  How can
> we be sure that everyone agrees with your interpretation of this mode?

All other view-file like modes behave like this, you view the file and
leave the file with q.

But even going with that point: You open a file file which isn't
writable. Once you hit q the window is quit and the buffer is buried.
What do you do now next time you visit that file?
The buffer was buried, view-mode isn't active anymore, you would have
to activate view-mode again to go where you left off.

If you would want to edit the file the you visited this way you would
have not pressed q but e to exit view mode and the proceeded to exit
read-only-mode and edit the file.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
       [not found]   ` <87ttbmj6tt.fsf@>
@ 2024-12-02 19:33     ` Eli Zaretskii
  2024-12-03 10:06       ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]       ` <87mshdjd2k.fsf@>
  0 siblings, 2 replies; 16+ messages in thread
From: Eli Zaretskii @ 2024-12-02 19:33 UTC (permalink / raw)
  To: Björn Bidar; +Cc: 74637

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Cc: 74637@debbugs.gnu.org
> Date: Mon, 02 Dec 2024 20:08:46 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Date: Sun, 01 Dec 2024 22:40:16 +0200
> >> From:  Björn Bidar via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >> 
> >> Make view-mode behave like when called in view-file when entered because
> >> `view-read-only' is true on a file which is not writable.
> >> The change makes the view-read-only behave better on files which are
> >> not writable. 
> >> Now it makes Emacs behave more like less on these files.
> >
> > That's an incompatible behavior change.  Is that justified?  How can
> > we be sure that everyone agrees with your interpretation of this mode?
> 
> All other view-file like modes behave like this, you view the file and
> leave the file with q.

That doesn't change the fact that view-mode didn't behave like that,
until now.

> But even going with that point: You open a file file which isn't
> writable. Once you hit q the window is quit and the buffer is buried.
> What do you do now next time you visit that file?
> The buffer was buried, view-mode isn't active anymore, you would have
> to activate view-mode again to go where you left off.
> 
> If you would want to edit the file the you visited this way you would
> have not pressed q but e to exit view mode and the proceeded to exit
> read-only-mode and edit the file.

What about entering view-mode by typing "C-x C-q" in a buffer whose
file is writable?  Why should we kill the buffer when the user turns
off view-mode in that file's buffer?





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-02 19:33     ` Eli Zaretskii
@ 2024-12-03 10:06       ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]       ` <87mshdjd2k.fsf@>
  1 sibling, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-03 10:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74637

[-- Attachment #1: Type: text/plain, Size: 2142 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>> Cc: 74637@debbugs.gnu.org
>> Date: Mon, 02 Dec 2024 20:08:46 +0200
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> Date: Sun, 01 Dec 2024 22:40:16 +0200
>> >> From:  Björn Bidar via "Bug reports for GNU Emacs,
>> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> >> 
>> >> Make view-mode behave like when called in view-file when entered because
>> >> `view-read-only' is true on a file which is not writable.
>> >> The change makes the view-read-only behave better on files which are
>> >> not writable. 
>> >> Now it makes Emacs behave more like less on these files.
>> >
>> > That's an incompatible behavior change.  Is that justified?  How can
>> > we be sure that everyone agrees with your interpretation of this mode?
>> 
>> All other view-file like modes behave like this, you view the file and
>> leave the file with q.
>
> That doesn't change the fact that view-mode didn't behave like that,
> until now.

View-mode isn't change outside of the specific situation of opening a
file which isn't writable. I worded it wrong in the doc string.
Please check the updated docstring or different wording.

>> But even going with that point: You open a file file which isn't
>> writable. Once you hit q the window is quit and the buffer is buried.
>> What do you do now next time you visit that file?
>> The buffer was buried, view-mode isn't active anymore, you would have
>> to activate view-mode again to go where you left off.
>> 
>> If you would want to edit the file the you visited this way you would
>> have not pressed q but e to exit view mode and the proceeded to exit
>> read-only-mode and edit the file.
>
> What about entering view-mode by typing "C-x C-q" in a buffer whose
> file is writable?  Why should we kill the buffer when the user turns
> off view-mode in that file's buffer?

The change doesn't affect those situations. If you exit view-mode this way
after having it activated through "C-x C-q" you would exit view-mode
burry the buffer but not kill it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-view-read-only-behave-like-view-file.patch --]
[-- Type: text/x-patch, Size: 1957 bytes --]

From 7e9dc995e07ce19022baccd5f54b7e9fecc4cadd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@thaodan.de>
Date: Sun, 1 Dec 2024 22:22:24 +0200
Subject: [PATCH] Make view-read-only behave like view-file

Make view-mode also behave like less when entered through the
view-read-only option similarly as done in in
'1997-06-14 "Make view mode more similar to `less'' (ab7782fc244).
* lisp/files.el (after-find-file):
When opening a file which is read only and `view-read-only' is true
leave view-mode with `kill-buffer-if-not-modified'.
* lisp/view.el (view-mode): Document new behavior.
---
 lisp/files.el | 2 +-
 lisp/view.el  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index a65bc4a4ea2..2f062b45daf 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2874,7 +2874,7 @@ after-find-file
     (when (and buffer-read-only
 	       view-read-only
 	       (not (eq (get major-mode 'mode-class) 'special)))
-      (view-mode-enter))
+      (view-mode-enter nil 'kill-buffer-if-not-modified))
     (run-hooks 'find-file-hook)))
 
 (define-obsolete-function-alias 'report-errors 'with-demoted-errors "25.1")
diff --git a/lisp/view.el b/lisp/view.el
index 2ac7479739f..e2d77a53695 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -416,7 +416,7 @@ view-mode
 The effect of \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] depends on how view-mode was entered.  If it was
 entered by view-file, view-file-other-window, view-file-other-frame, or
 \\[dired-view-file] \(\\[view-file], \\[view-file-other-window],
-\\[view-file-other-frame], or the Dired mode v command),
+\\[view-file-other-frame], `view-read-only' on a read-only file, or the Dired mode v command),
 then \\[View-quit] will try to kill the current buffer.
 If view-mode was entered from another buffer, by \\[view-buffer],
 \\[view-buffer-other-window], \\[view-buffer-other frame], \\[view-file],
-- 
2.45.2


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

* bug#74637: [PATCH] Make view-read-only behave like view-file
       [not found]       ` <87mshdjd2k.fsf@>
@ 2024-12-03 14:01         ` Eli Zaretskii
  2024-12-03 14:25           ` Visuwesh
                             ` (3 more replies)
  2024-12-05  2:15         ` Sean Whitton
  1 sibling, 4 replies; 16+ messages in thread
From: Eli Zaretskii @ 2024-12-03 14:01 UTC (permalink / raw)
  To: Björn Bidar, Stefan Kangas, Andrea Corallo; +Cc: 74637

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Cc: 74637@debbugs.gnu.org
> Date: Tue, 03 Dec 2024 12:06:11 +0200
> 
> >> > That's an incompatible behavior change.  Is that justified?  How can
> >> > we be sure that everyone agrees with your interpretation of this mode?
> >> 
> >> All other view-file like modes behave like this, you view the file and
> >> leave the file with q.
> >
> > That doesn't change the fact that view-mode didn't behave like that,
> > until now.
> 
> View-mode isn't change outside of the specific situation of opening a
> file which isn't writable.

It's still a significant change.  Killing a buffer is not a minor
think, and restoring it is not always easy, or even possible (e.g.,
the file could have been deleted in the meantime).

My opinion is that if we install this, we need to provide some way of
getting the previous behavior back, for those who may want it.

Stefan and Andrea, WDYT?





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-03 14:01         ` Eli Zaretskii
@ 2024-12-03 14:25           ` Visuwesh
  2024-12-03 19:33             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-03 19:39           ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
                             ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Visuwesh @ 2024-12-03 14:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Björn Bidar, Andrea Corallo, 74637, Stefan Kangas

[செவ்வாய் டிசம்பர் 03, 2024] Eli Zaretskii wrote:

>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>> Cc: 74637@debbugs.gnu.org
>> Date: Tue, 03 Dec 2024 12:06:11 +0200
>> 
>> >> > That's an incompatible behavior change.  Is that justified?  How can
>> >> > we be sure that everyone agrees with your interpretation of this mode?
>> >> 
>> >> All other view-file like modes behave like this, you view the file and
>> >> leave the file with q.
>> >
>> > That doesn't change the fact that view-mode didn't behave like that,
>> > until now.
>> 
>> View-mode isn't change outside of the specific situation of opening a
>> file which isn't writable.
>
> It's still a significant change.  Killing a buffer is not a minor
> think, and restoring it is not always easy, or even possible (e.g.,
> the file could have been deleted in the meantime).
>
> My opinion is that if we install this, we need to provide some way of
> getting the previous behavior back, for those who may want it.
>
> Stefan and Andrea, WDYT?

I am neither Stefan nor Andrea: there have been a number of instances
where Emacs not eagerly killing buffers has saved accidentally or
prematurely deleted files on my end.  I would be opposed to a change
that kills the buffer on exiting view-mode entered due to
view-read-only=t to avoid potential data loss.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-03 14:25           ` Visuwesh
@ 2024-12-03 19:33             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-03 19:33 UTC (permalink / raw)
  To: Visuwesh; +Cc: Eli Zaretskii, Andrea Corallo, 74637, Stefan Kangas

Visuwesh <visuweshm@gmail.com> writes:

> [செவ்வாய் டிசம்பர் 03, 2024] Eli Zaretskii wrote:
>
>>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>>> Cc: 74637@debbugs.gnu.org
>>> Date: Tue, 03 Dec 2024 12:06:11 +0200
>>> 
>>> >> > That's an incompatible behavior change.  Is that justified?  How can
>>> >> > we be sure that everyone agrees with your interpretation of this mode?
>>> >> 
>>> >> All other view-file like modes behave like this, you view the file and
>>> >> leave the file with q.
>>> >
>>> > That doesn't change the fact that view-mode didn't behave like that,
>>> > until now.
>>> 
>>> View-mode isn't change outside of the specific situation of opening a
>>> file which isn't writable.
>>
>> It's still a significant change.  Killing a buffer is not a minor
>> think, and restoring it is not always easy, or even possible (e.g.,
>> the file could have been deleted in the meantime).
>>
>> My opinion is that if we install this, we need to provide some way of
>> getting the previous behavior back, for those who may want it.
>>
>> Stefan and Andrea, WDYT?
>
> I am neither Stefan nor Andrea: there have been a number of instances
> where Emacs not eagerly killing buffers has saved accidentally or
> prematurely deleted files on my end.  I would be opposed to a change
> that kills the buffer on exiting view-mode entered due to
> view-read-only=t to avoid potential data loss.

But does apply to instance of view-read-only?  Again it only affects
files which are not writable, i.e. those that could not be deleted by
the user in the first place.

The change is for not writable files plus view-read-only, NOT files which
are visited and then view-mode activated through `view-mode` or
view-read-only through read-only-mode.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-03 14:01         ` Eli Zaretskii
  2024-12-03 14:25           ` Visuwesh
@ 2024-12-03 19:39           ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]           ` <874j3kimjv.fsf@>
  2024-12-04 13:16           ` Andrea Corallo
  3 siblings, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-03 19:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Andrea Corallo, 74637, Stefan Kangas

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>> Cc: 74637@debbugs.gnu.org
>> Date: Tue, 03 Dec 2024 12:06:11 +0200
>> 
>> >> > That's an incompatible behavior change.  Is that justified?  How can
>> >> > we be sure that everyone agrees with your interpretation of this mode?
>> >> 
>> >> All other view-file like modes behave like this, you view the file and
>> >> leave the file with q.
>> >
>> > That doesn't change the fact that view-mode didn't behave like that,
>> > until now.
>> 
>> View-mode isn't change outside of the specific situation of opening a
>> file which isn't writable.
>
> It's still a significant change.  Killing a buffer is not a minor
> think, and restoring it is not always easy, or even possible (e.g.,
> the file could have been deleted in the meantime).

In such instances the files are usually those which are shared by other
users or installed by the system administrator if the file was deleted
it could have been only by the owner or those with the power to delete
them.

Files which the user owns wouldn't be affected.

> My opinion is that if we install this, we need to provide some way of
> getting the previous behavior back, for those who may want it.
>

Should this also affected files through the other instances where
view-mode kills the buffer if not modified? In the instances affected by
the patch view-read-only is more implicit e.g. when following a reference with
xref to a read-only file but view-file is still similar.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
       [not found]           ` <874j3kimjv.fsf@>
@ 2024-12-03 19:43             ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2024-12-03 19:43 UTC (permalink / raw)
  To: Björn Bidar; +Cc: acorallo, 74637, stefankangas

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Cc: Stefan Kangas <stefankangas@gmail.com>,  Andrea Corallo
>  <acorallo@gnu.org>,  74637@debbugs.gnu.org
> Date: Tue, 03 Dec 2024 21:39:00 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > My opinion is that if we install this, we need to provide some way of
> > getting the previous behavior back, for those who may want it.
> >
> 
> Should this also affected files through the other instances where
> view-mode kills the buffer if not modified?

It should affect those cases where this change modifies existing
behavior.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-03 14:01         ` Eli Zaretskii
                             ` (2 preceding siblings ...)
       [not found]           ` <874j3kimjv.fsf@>
@ 2024-12-04 13:16           ` Andrea Corallo
  2024-12-07  0:39             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
                               ` (2 more replies)
  3 siblings, 3 replies; 16+ messages in thread
From: Andrea Corallo @ 2024-12-04 13:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Björn Bidar, 74637, Stefan Kangas

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>> Cc: 74637@debbugs.gnu.org
>> Date: Tue, 03 Dec 2024 12:06:11 +0200
>> 
>> >> > That's an incompatible behavior change.  Is that justified?  How can
>> >> > we be sure that everyone agrees with your interpretation of this mode?
>> >> 
>> >> All other view-file like modes behave like this, you view the file and
>> >> leave the file with q.
>> >
>> > That doesn't change the fact that view-mode didn't behave like that,
>> > until now.
>> 
>> View-mode isn't change outside of the specific situation of opening a
>> file which isn't writable.
>
> It's still a significant change.  Killing a buffer is not a minor
> think, and restoring it is not always easy, or even possible (e.g.,
> the file could have been deleted in the meantime).
>
> My opinion is that if we install this, we need to provide some way of
> getting the previous behavior back, for those who may want it.
>
> Stefan and Andrea, WDYT?

Agree with your position.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
       [not found]       ` <87mshdjd2k.fsf@>
  2024-12-03 14:01         ` Eli Zaretskii
@ 2024-12-05  2:15         ` Sean Whitton
  1 sibling, 0 replies; 16+ messages in thread
From: Sean Whitton @ 2024-12-05  2:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Björn Bidar, 74637

Hello,

I don't think Emacs should start killing buffers that it didn't used to
kill by default.  I also think that 'q' shouldn't generally kill
buffers, only close windows and bury buffers.

-- 
Sean Whitton





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-04 13:16           ` Andrea Corallo
@ 2024-12-07  0:39             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]             ` <87ser0s4w7.fsf@>
  2024-12-15 18:43             ` Stefan Kangas
  2 siblings, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-07  0:39 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Eli Zaretskii, 74637, Stefan Kangas

Andrea Corallo <acorallo@gnu.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>>> Cc: 74637@debbugs.gnu.org
>>> Date: Tue, 03 Dec 2024 12:06:11 +0200
>>> 
>>> >> > That's an incompatible behavior change.  Is that justified?  How can
>>> >> > we be sure that everyone agrees with your interpretation of this mode?
>>> >> 
>>> >> All other view-file like modes behave like this, you view the file and
>>> >> leave the file with q.
>>> >
>>> > That doesn't change the fact that view-mode didn't behave like that,
>>> > until now.
>>> 
>>> View-mode isn't change outside of the specific situation of opening a
>>> file which isn't writable.
>>
>> It's still a significant change.  Killing a buffer is not a minor
>> think, and restoring it is not always easy, or even possible (e.g.,
>> the file could have been deleted in the meantime).
>>
>> My opinion is that if we install this, we need to provide some way of
>> getting the previous behavior back, for those who may want it.
>>
>> Stefan and Andrea, WDYT?
>
> Agree with your position.

If before killing the file there would be a check if it was deleted
is that better? The check would also improve the view-file related
functions.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
       [not found]             ` <87ser0s4w7.fsf@>
@ 2024-12-07  7:43               ` Eli Zaretskii
  2024-12-07 18:05                 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2024-12-07  7:43 UTC (permalink / raw)
  To: Björn Bidar; +Cc: acorallo, 74637, stefankangas

> From: Björn Bidar <bjorn.bidar@thaodan.de>
> Cc: Eli Zaretskii <eliz@gnu.org>,  74637@debbugs.gnu.org,  Stefan Kangas
>  <stefankangas@gmail.com>
> Date: Sat, 07 Dec 2024 02:39:20 +0200
> 
> Andrea Corallo <acorallo@gnu.org> writes:
> 
> >> Stefan and Andrea, WDYT?
> >
> > Agree with your position.
> 
> If before killing the file there would be a check if it was deleted
> is that better? The check would also improve the view-file related
> functions.

Personally, I'm not sure it is much better.  First, the file might
have been moved or renamed, not deleted.  More generally, it strikes
me as very un-Emacsy to kill a buffer when the user is done with it.
We only do that with temporary buffers created for the purpose of
performing some processing; otherwise we leave the buffers in the
session, leaving it to the user to decide when to kill them.  We also
have optional features, like mindnight.el, which are capable of
killing buffers that were not accessed for a long time, and the very
fact that they are optional clearly shows the general attitude of
Emacs: not to kill buffers unless explicitly told so by the user.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-07  7:43               ` Eli Zaretskii
@ 2024-12-07 18:05                 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 16+ messages in thread
From: Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-07 18:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: acorallo, 74637, stefankangas

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  74637@debbugs.gnu.org,  Stefan Kangas
>>  <stefankangas@gmail.com>
>> Date: Sat, 07 Dec 2024 02:39:20 +0200
>> 
>> Andrea Corallo <acorallo@gnu.org> writes:
>> 
>> >> Stefan and Andrea, WDYT?
>> >
>> > Agree with your position.
>> 
>> If before killing the file there would be a check if it was deleted
>> is that better? The check would also improve the view-file related
>> functions.
>
> Personally, I'm not sure it is much better.  First, the file might
> have been moved or renamed, not deleted.  More generally, it strikes
> me as very un-Emacsy to kill a buffer when the user is done with it.

Would a better approach be then that pressing q burries the buffer but
doesn't exit view-mode if entered through view-read-only on a non
writable aka read-only file? Doing so wouldn't remove the option to exit
view-mode on such buffers but keep view-mode on in case the user visits
the buffer again. Pressing q to bury or delete a read-only buffer is a
common action across almost any mode.

> We only do that with temporary buffers created for the purpose of
> performing some processing; otherwise we leave the buffers in the
> session, leaving it to the user to decide when to kill them.  We also
> have optional features, like mindnight.el, which are capable of
> killing buffers that were not accessed for a long time, and the very
> fact that they are optional clearly shows the general attitude of
> Emacs: not to kill buffers unless explicitly told so by the user.

Buffer which visit read only files such as system documentation could be
considered temporary but I get the point.





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

* bug#74637: [PATCH] Make view-read-only behave like view-file
  2024-12-04 13:16           ` Andrea Corallo
  2024-12-07  0:39             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]             ` <87ser0s4w7.fsf@>
@ 2024-12-15 18:43             ` Stefan Kangas
  2 siblings, 0 replies; 16+ messages in thread
From: Stefan Kangas @ 2024-12-15 18:43 UTC (permalink / raw)
  To: Andrea Corallo, Eli Zaretskii; +Cc: Björn Bidar, 74637

Andrea Corallo <acorallo@gnu.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Björn Bidar <bjorn.bidar@thaodan.de>
>>> Cc: 74637@debbugs.gnu.org
>>> Date: Tue, 03 Dec 2024 12:06:11 +0200
>>>
>>> >> > That's an incompatible behavior change.  Is that justified?  How can
>>> >> > we be sure that everyone agrees with your interpretation of this mode?
>>> >>
>>> >> All other view-file like modes behave like this, you view the file and
>>> >> leave the file with q.
>>> >
>>> > That doesn't change the fact that view-mode didn't behave like that,
>>> > until now.
>>>
>>> View-mode isn't change outside of the specific situation of opening a
>>> file which isn't writable.
>>
>> It's still a significant change.  Killing a buffer is not a minor
>> think, and restoring it is not always easy, or even possible (e.g.,
>> the file could have been deleted in the meantime).
>>
>> My opinion is that if we install this, we need to provide some way of
>> getting the previous behavior back, for those who may want it.
>>
>> Stefan and Andrea, WDYT?
>
> Agree with your position.

+1





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

end of thread, other threads:[~2024-12-15 18:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-01 20:40 bug#74637: [PATCH] Make view-read-only behave like view-file Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found] <87ldwzm91r.fsf@>
2024-12-02 12:29 ` Eli Zaretskii
2024-12-02 18:08   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]   ` <87ttbmj6tt.fsf@>
2024-12-02 19:33     ` Eli Zaretskii
2024-12-03 10:06       ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]       ` <87mshdjd2k.fsf@>
2024-12-03 14:01         ` Eli Zaretskii
2024-12-03 14:25           ` Visuwesh
2024-12-03 19:33             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-03 19:39           ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]           ` <874j3kimjv.fsf@>
2024-12-03 19:43             ` Eli Zaretskii
2024-12-04 13:16           ` Andrea Corallo
2024-12-07  0:39             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]             ` <87ser0s4w7.fsf@>
2024-12-07  7:43               ` Eli Zaretskii
2024-12-07 18:05                 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-15 18:43             ` Stefan Kangas
2024-12-05  2:15         ` Sean Whitton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.