unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17148: 23.1; Revert Buffer
@ 2014-03-31 13:33 Joe Camaioni
  2014-04-01  7:06 ` Michael Albinus
  2022-02-22 14:45 ` bug#17148: Revert buffer menu-item and file permission changes Lars Ingebrigtsen
  0 siblings, 2 replies; 14+ messages in thread
From: Joe Camaioni @ 2014-03-31 13:33 UTC (permalink / raw)
  To: 17148


A buffer has been loaded with a file.  It is initially unwritable.  A chmod is performed in a shell window to make it writable.  Going into the File menu pulldown, the Revert Buffer stays gray-ed out, and the file is still listed as unwritable.  


In GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.18.9)
 of 2011-02-01 on x86-003.build.bos.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.60900000
configured using `configure  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
 --param=ssp-buffer-size=4 -m64 -mtune=generic''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.iso88591
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

Major mode: Tcl

Minor modes in effect:
  text-scale-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
nd-emacs-bug-report>

Recent messages:
Cannot write backup file; backing up in /home/jcamaion/%backup%~
Wrote /home/vobadm/bin/AR_QA_pkg.exp
Saving file /home/vobadm/bin/AR_QA_pkg.exp...
Wrote /home/vobadm/bin/AR_QA_pkg.exp
Note: file is write protected
Mark saved where search started
Note: file is write protected
Buffer is read-only: #<buffer AP_QA_tar.exp>
Mark saved where search started
call-interactively: Text is read-only





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

* bug#17148: 23.1; Revert Buffer
  2014-03-31 13:33 bug#17148: 23.1; Revert Buffer Joe Camaioni
@ 2014-04-01  7:06 ` Michael Albinus
  2014-04-01 15:54   ` Glenn Morris
  2022-02-22 14:45 ` bug#17148: Revert buffer menu-item and file permission changes Lars Ingebrigtsen
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-04-01  7:06 UTC (permalink / raw)
  To: 17148

Joe Camaioni <jcamaion@tbfmdev1.ctasdev.tc.faa.gov> writes:

> A buffer has been loaded with a file.  It is initially unwritable.  A chmod is performed in a shell window to make it writable.  Going into the File menu pulldown, the Revert Buffer stays gray-ed out, and the file is still listed as unwritable.

Emacs is not notified, when a file changes its state outside Emacs. Only
prior to writing to a file Emacs checks, whether a file has changed on disk.

The upcoming Emacs 24.4 has implemented file notifications on systems
which support it (mainly GNU/Linux and MS Windows). This could be used
for this kind of checks.

For Emacs 23, I don't regard this as a bug.

Best regards, Michael.





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01  7:06 ` Michael Albinus
@ 2014-04-01 15:54   ` Glenn Morris
  2014-04-01 18:04     ` Michael Albinus
  2014-04-01 20:14     ` Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Glenn Morris @ 2014-04-01 15:54 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 17148

Michael Albinus wrote:

> Emacs is not notified, when a file changes its state outside Emacs. Only
> prior to writing to a file Emacs checks, whether a file has changed on disk.

Why can't the revert-buffer menu-item check the file mode bits match,
the same way it verifies the modtime? IMO it should just call
file-attributes once, and use that to check time and permissions.






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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 15:54   ` Glenn Morris
@ 2014-04-01 18:04     ` Michael Albinus
  2014-04-01 18:30       ` Glenn Morris
  2014-04-01 20:14     ` Stefan Monnier
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-04-01 18:04 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17148

tags 17148 - notabug
fixed 17148 24.4
thanks

Glenn Morris <rgm@gnu.org> writes:

> Michael Albinus wrote:
>
>> Emacs is not notified, when a file changes its state outside Emacs. Only
>> prior to writing to a file Emacs checks, whether a file has changed on disk.
>
> Why can't the revert-buffer menu-item check the file mode bits match,
> the same way it verifies the modtime? IMO it should just call
> file-attributes once, and use that to check time and permissions.

Hmm, I wanted to implement something with file notifications.

However, surprisingly this problem is reproducible in Emacs 23, but it
is NOT reproducible with Emacs 24.3.50. This is because
`revert-buffer-function' is set to `revert-buffer--default' since last
year.

My analysis was wrong, but the result (not a bug) is somehow right for
Emacs 24.3. We shall changed that to "Fixed in 24.4", 'tho.

Best regards, Michael.





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 18:04     ` Michael Albinus
@ 2014-04-01 18:30       ` Glenn Morris
  2014-04-01 18:40         ` Michael Albinus
  0 siblings, 1 reply; 14+ messages in thread
From: Glenn Morris @ 2014-04-01 18:30 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 17148

Michael Albinus wrote:

> However, surprisingly this problem is reproducible in Emacs 23, but it
> is NOT reproducible with Emacs 24.3.50. This is because
> `revert-buffer-function' is set to `revert-buffer--default' since last
> year.

So the result is basically now that the "Revert Buffer" menu item is
always enabled, which may not be precisely what the OP wanted.





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 18:30       ` Glenn Morris
@ 2014-04-01 18:40         ` Michael Albinus
  2014-04-01 19:01           ` Glenn Morris
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Albinus @ 2014-04-01 18:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 17148

Glenn Morris <rgm@gnu.org> writes:

>> However, surprisingly this problem is reproducible in Emacs 23, but it
>> is NOT reproducible with Emacs 24.3.50. This is because
>> `revert-buffer-function' is set to `revert-buffer--default' since last
>> year.
>
> So the result is basically now that the "Revert Buffer" menu item is
> always enabled, which may not be precisely what the OP wanted.

Yes. Maybe Stefan could explain the reasoning behind.

Best regards, Michael.





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 18:40         ` Michael Albinus
@ 2014-04-01 19:01           ` Glenn Morris
  2014-04-02 13:03             ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Glenn Morris @ 2014-04-01 19:01 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 17148

Michael Albinus wrote:

>> So the result is basically now that the "Revert Buffer" menu item is
>> always enabled, which may not be precisely what the OP wanted.
>
> Yes. Maybe Stefan could explain the reasoning behind.

I'm going to guess it is an unintended consequence of changing the
default value of revert-buffer-function (and
revert-buffer-insert-file-contents-function) to be non-nil (which was
probably for the purpose of advice).

This change has no NEWS entry and no documentation updates.





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 15:54   ` Glenn Morris
  2014-04-01 18:04     ` Michael Albinus
@ 2014-04-01 20:14     ` Stefan Monnier
  2014-04-02  6:45       ` Glenn Morris
  1 sibling, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2014-04-01 20:14 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Michael Albinus, 17148

>> Emacs is not notified, when a file changes its state outside Emacs. Only
>> prior to writing to a file Emacs checks, whether a file has changed on disk.
> Why can't the revert-buffer menu-item check the file mode bits match,
> the same way it verifies the modtime? IMO it should just call
> file-attributes once, and use that to check time and permissions.

Because revert-buffer is meant to handle the file's content, not its
read-only setting.
E.g. maybe the buffer is read-only because the user hit C-x C-q.

Maybe we should use a 3rd setting for buffer-read-only which says "obey
the file's writability".


        Stefan





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 20:14     ` Stefan Monnier
@ 2014-04-02  6:45       ` Glenn Morris
  2014-04-02 13:04         ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Glenn Morris @ 2014-04-02  6:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Albinus, 17148

Stefan Monnier wrote:

> Because revert-buffer is meant to handle the file's content, not its
> read-only setting.

File permission bits can be viewed as just another form of content.

> E.g. maybe the buffer is read-only because the user hit C-x C-q.

Personally I would not mind seeing a non-greyed-out menu-item for Revert
Buffer in such a case. I have modified the buffer ('s meta-data)
compared to how it is on disk, so I might want to revert it.





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

* bug#17148: 23.1; Revert Buffer
  2014-04-01 19:01           ` Glenn Morris
@ 2014-04-02 13:03             ` Stefan Monnier
  0 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2014-04-02 13:03 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Michael Albinus, 17148

>>> So the result is basically now that the "Revert Buffer" menu item is
>>> always enabled, which may not be precisely what the OP wanted.
>> Yes. Maybe Stefan could explain the reasoning behind.
> I'm going to guess it is an unintended consequence of changing the
> default value of revert-buffer-function (and
> revert-buffer-insert-file-contents-function) to be non-nil (which was
> probably for the purpose of advice).

Right.

> This change has no NEWS entry and no documentation updates.

It seemed "internal" enough.  But I guess I was wrong.


        Stefan





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

* bug#17148: 23.1; Revert Buffer
  2014-04-02  6:45       ` Glenn Morris
@ 2014-04-02 13:04         ` Stefan Monnier
  0 siblings, 0 replies; 14+ messages in thread
From: Stefan Monnier @ 2014-04-02 13:04 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Michael Albinus, 17148

> Personally I would not mind seeing a non-greyed-out menu-item for Revert
> Buffer in such a case. I have modified the buffer ('s meta-data)
> compared to how it is on disk, so I might want to revert it.

I can agree, but only if revert-buffer indeed changes buffer-read-only.


        Stefan





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

* bug#17148: Revert buffer menu-item and file permission changes
  2014-03-31 13:33 bug#17148: 23.1; Revert Buffer Joe Camaioni
  2014-04-01  7:06 ` Michael Albinus
@ 2022-02-22 14:45 ` Lars Ingebrigtsen
  2022-02-22 16:53   ` Eli Zaretskii
  1 sibling, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-22 14:45 UTC (permalink / raw)
  To: Joe Camaioni; +Cc: 17148

Joe Camaioni <jcamaion@tbfmdev1.ctasdev.tc.faa.gov> writes:

> A buffer has been loaded with a file.  It is initially unwritable.  A
> chmod is performed in a shell window to make it writable.  Going into
> the File menu pulldown, the Revert Buffer stays gray-ed out, and the
> file is still listed as unwritable.

I've now fixed this in Emacs 29.

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





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

* bug#17148: Revert buffer menu-item and file permission changes
  2022-02-22 14:45 ` bug#17148: Revert buffer menu-item and file permission changes Lars Ingebrigtsen
@ 2022-02-22 16:53   ` Eli Zaretskii
  2022-02-22 17:56     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2022-02-22 16:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: jcamaion, 17148

> Resent-From: Lars Ingebrigtsen <larsi@gnus.org>
> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
> Resent-CC: bug-gnu-emacs@gnu.org
> Resent-Sender: help-debbugs@gnu.org
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Tue, 22 Feb 2022 15:45:03 +0100
> Cc: 17148@debbugs.gnu.org
> 
> Joe Camaioni <jcamaion@tbfmdev1.ctasdev.tc.faa.gov> writes:
> 
> > A buffer has been loaded with a file.  It is initially unwritable.  A
> > chmod is performed in a shell window to make it writable.  Going into
> > the File menu pulldown, the Revert Buffer stays gray-ed out, and the
> > file is still listed as unwritable.
> 
> I've now fixed this in Emacs 29.

Did you forget to push, by chance?





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

* bug#17148: Revert buffer menu-item and file permission changes
  2022-02-22 16:53   ` Eli Zaretskii
@ 2022-02-22 17:56     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-22 17:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jcamaion, 17148

Eli Zaretskii <eliz@gnu.org> writes:

> Did you forget to push, by chance?

Indeed.  Now pushed.

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





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

end of thread, other threads:[~2022-02-22 17:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31 13:33 bug#17148: 23.1; Revert Buffer Joe Camaioni
2014-04-01  7:06 ` Michael Albinus
2014-04-01 15:54   ` Glenn Morris
2014-04-01 18:04     ` Michael Albinus
2014-04-01 18:30       ` Glenn Morris
2014-04-01 18:40         ` Michael Albinus
2014-04-01 19:01           ` Glenn Morris
2014-04-02 13:03             ` Stefan Monnier
2014-04-01 20:14     ` Stefan Monnier
2014-04-02  6:45       ` Glenn Morris
2014-04-02 13:04         ` Stefan Monnier
2022-02-22 14:45 ` bug#17148: Revert buffer menu-item and file permission changes Lars Ingebrigtsen
2022-02-22 16:53   ` Eli Zaretskii
2022-02-22 17:56     ` Lars Ingebrigtsen

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