GNU bug report logs - #11412
24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable

Previous Next

Package: emacs;

Reported by: Eric Hanchrow <eric.hanchrow <at> gmail.com>

Date: Sat, 5 May 2012 15:27:01 UTC

Severity: wishlist

Tags: moreinfo

Merged with 11549

Found in version 24.0.95

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 11412 in the body.
You can then email your comments to 11412 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#11412; Package emacs. (Sat, 05 May 2012 15:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eric Hanchrow <eric.hanchrow <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 05 May 2012 15:27:02 GMT) Full text and rfc822 format available.

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

From: Eric Hanchrow <eric.hanchrow <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.95;
	auto-revert-mode doesn't revert buffer when file becomes writeable
Date: Sat, 5 May 2012 08:23:36 -0700
This is probably not an actual bug, since I think Emacs is doing what
it was designed to do.  Rather, it's more of a feature request.

Put this form in a freshly-started emacs and evaluate it:

(let ((fn (make-temp-file "frotzplotz")))
  (set-file-modes fn #o444)
  (find-file fn)
  (auto-revert-mode 1)
  (message "Note the %% in the mode line")
  (sit-for 1)
  (set-file-modes fn #o644)
  (message "It'd be nice if the %% in the mode line went away"))

When the evaluation finishes, you'll see a (empty) buffer visiting the
temp file.  The buffer will be read-only, as indicated by the %% in the
mode line.  However, this is less than ideal; the file is writeable, so
it'd be nice if the mode line so indicated.

In fact, the buffer never reverted; I assme because Emacs only looks
at the st_mtime field of the stat info, whereas when I made the file
writeable, only the st_ctime field changed.  So: perhaps
verify-visited-file-modtime could check st_ctime as well, or (probably
less disruptive) perhaps auto-revert-handler could check that.

This change would be useful in one case: when I'm using a
revision-control system that "locks" files by making them read-only,
and I then "check out" the file, it'd be nice if my read-only buffer
would automatically become writable to reflect the corresponding
change in the underlying file.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/local/src/emacs/etc/DEBUG.


In GNU Emacs 24.0.95.1 (i686-pc-linux-gnu)
 of 2012-04-04 on ip-10-171-85-229
Configured using:
 `configure '--without-x''

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.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-log-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  shell-dirtrack-mode: t
  eldoc-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  ido-everywhere: t
  display-time-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
" p r o c e s s " SPC c a l l s SPC w i t h SPC e l
i s p SPC f u n c t i o n s SPC t h o u g h C-c C-c
q q q C-a C-u C-p C-p C-p ESC C-k C-x C-o C-x C-s C-h
i i c h m o d RET t C-s c h m o d C-s C-a i r e a d
- o TAB RET , , , , , , , , , , , , t C-s m o d e s
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-a i f
i l e SPC m o d e TAB s RET u i ESC p ESC p ESC n C-e
, SPC s e TAB RET C-x 2 C-x b RET ESC m ESC C-k ESC
( s e t - f i l e - m o d e s SPC f n SPC C-x o C-v
C-x o # o 4 4 4 C-x C-e C-n C-n C-n C-a C-n C-n ESC
m ESC C-k ESC ( s e t - f ESC / SPC f n SPC # o 6 4
4 C-x C-s ESC C-x C-x o C-x b t m p RET g C-x o C-x
o ESC ! ESC p ESC p ESC p ESC p ESC d ESC d ESC d ESC
d ESC d e c h o C-e ESC \ TAB RET C-x b s h e RET ESC
> C-x b b u RET C-x 1 C-x v v d o n e C-c C-c ESC x
r e p o r t - e m a c s TAB RET

Recent messages:
Saving file /home/erich/bug/bug.el...
Wrote /home/erich/bug/bug.el
Note: file is write protected
Note the % in the mode line
It'd be nice if the % in the mode line went away [2 times]
(Shell command succeeded with no output)
Mark set [2 times]
Press C-c C-c when you are done editing.
Enter a change comment.  Type C-c C-c when done
Checking in /home/erich/bug/bug.el...done

Load-path shadows:
~/.emacs.d/custom hides /usr/local/src/emacs/lisp/custom
/home/erich/.emacs.d/elpa/eieio-1.4/eieio-opt hides
/usr/local/src/emacs/lisp/emacs-lisp/eieio-opt
/home/erich/.emacs.d/elpa/eieio-1.4/eieio hides
/usr/local/src/emacs/lisp/emacs-lisp/eieio

Features:
(cmuscheme org-table cl-specs edebug novice wdired browse-kill-ring
erc-fill tmm electric vc-arch vc-mtn vc-hg chistory ind-util ruby-mode
find-dired vc-annotate doc-view image-mode whitespace pcmpl-gnu
make-mode log-view repeat compare-w rmailmm rmail nxml-uchnm rng-xsd
xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse
nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode
nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok sgml-mode
two-column skeleton cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs python-21 python scheme morse
sh-script executable cperl-mode iswitchb color descr-text shadow sort
mail-extr emacsbug message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mailabbrev gmm-utils mailheader gist gh-gist gh-oauth gh-api
gh-cache gh-auth gh-common debug apropos conf-mode timezone logito
pcache json eieio-base pcache-autoloads eieio-comp inversion speedbar
sb-image ezimage dframe eieio-autoloads tar-mode logito-autoloads
autoload epa-file epa epg epg-config mule-util parse-time url-cache
url-http mail-parse rfc2231 url-gw url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-util url-parse
url-vars mailcap finder-inf loadhist rect disp-table jka-compr tabify
sql-indent sql face-remap org-wl org-w3m org-vm org-rmail org-mhe
org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp
org-exp-blocks org-agenda org-info org-gnus org-docview org-bibtex
bibtex org-bbdb org ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint ob-keys ob ob-eval org-pcomplete org-list
org-faces org-compat org-entities org-macs noutline outline cal-menu
calendar cal-loaddefs dired-aux info iso-transl dabbrev log-edit
pcvs-util add-log smerge-mode newcomment diff-mode easy-mmode cus-edit
cus-start cus-load help-mode view edit-list multi-isearch ffap vc-bzr
vc-sccs vc-svn vc-cvs vc-rcs vc-dir ewoc vc ediff-merg ediff-diff
ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff
vc-dispatcher pcmpl-unix network-stream tls erc-hl-nicks erc-menu
erc-ring erc-pcomplete erc-track erc-match erc-netsplit erc-button
erc-stamp erc-truncate erc-spelling flyspell ispell erc-join erc-log
erc-services erc-networks erc-goodies erc erc-backend erc-compat
format-spec thingatpt pp shell pcomplete woman man
erc-hl-nicks-autoloads package tabulated-list eldoc midnight uniquify
warnings protbuf etags vc-git derived autorevert paste-to-dropbox advice
help-fns advice-preload path server starttls smtpmail auth-source eieio
byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util time-date
password-cache sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils grep compile comint ansi-color ring tool-bar cl find-func
ibuf-ext ibuf-macs ibuffer recentf tree-widget wid-edit ido dired-x
easymenu dired regexp-opt edmacro kmacro rx autoinsert time image
ediff-hook vc-hooks lisp-float-type lisp-mode register page menu-bar
rfn-eshadow timer select mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind multi-tty emacs)




Forcibly Merged 11412 11549. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 24 May 2012 00:19:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11412; Package emacs. (Wed, 02 Jun 2021 06:25:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 11412 <at> debbugs.gnu.org, 11549 <at> debbugs.gnu.org
Subject: Re: bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when
 file becomes writeable
Date: Wed, 02 Jun 2021 08:24:02 +0200
Barry OReilly <gundaetiapo <at> gmail.com> writes:

> Open foo.py in Emacs.
>
> In a terminal:
> chmod u+w foo.py
>
> Wait several seconds, inserting text yields error:
> Buffer is read-only: #<buffer foo.py>

(I'm going through old bug reports that unfortunately got no response at
the time.)

This has been fixed in the years since this was reported.

> Open foo.py with vim and add text:
> # aaa blah
> # bbb
>
> The blah string appears in Emacs.  Insertion still fails with error:
> Buffer is read-only: #<buffer foo.py>
>
> Do: M-x revert-buffer
>
> Insertion now works.

This is apparently a feature added in 2004:

commit 90e118abf2dcc4aca4d7a7642247fa488554351e
Author:     Luc Teirlinck <teirllm <at> auburn.edu>
AuthorDate: Fri Sep 3 22:28:10 2004 +0000

        ;; Bind buffer-read-only in case user has done C-x C-q, so as
        ;; not to forget that.  This gives undesirable results when
        ;; the file's mode changes, but that is less common.
        (let ((buffer-read-only buffer-read-only))
           ...
            (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))))

So auto-reversion doesn't touch the buffer-readedness in case the user
has set it manually.  So I'm not sure whether we should change this
behaviour here.  Anybody got an opinion?

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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 02 Jun 2021 06:25:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11412; Package emacs. (Fri, 02 Jul 2021 11:19:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: 11412 <at> debbugs.gnu.org, 11549 <at> debbugs.gnu.org
Subject: Re: bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when
 file becomes writeable
Date: Fri, 02 Jul 2021 13:17:54 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> This is apparently a feature added in 2004:
>
> commit 90e118abf2dcc4aca4d7a7642247fa488554351e
> Author:     Luc Teirlinck <teirllm <at> auburn.edu>
> AuthorDate: Fri Sep 3 22:28:10 2004 +0000
>
>         ;; Bind buffer-read-only in case user has done C-x C-q, so as
>         ;; not to forget that.  This gives undesirable results when
>         ;; the file's mode changes, but that is less common.
>         (let ((buffer-read-only buffer-read-only))
>            ...
>             (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes))))
>
> So auto-reversion doesn't touch the buffer-readedness in case the user
> has set it manually.  So I'm not sure whether we should change this
> behaviour here.  Anybody got an opinion?

Nobody had an opinion, and I think this is working as designed, and I'm
closing this bug report.  If I misunderstood the issue, please respond
to the debbugs address and we'll reopen.

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




bug closed, send any further explanations to 11412 <at> debbugs.gnu.org and Eric Hanchrow <eric.hanchrow <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 02 Jul 2021 11:19:03 GMT) Full text and rfc822 format available.

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

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

Previous Next


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