unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable
@ 2012-05-05 15:23 Eric Hanchrow
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Hanchrow @ 2012-05-05 15:23 UTC (permalink / raw)
  To: 11412

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)





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

* bug#11549: auto-revert doesn't revert file permissions as revert-buffer does
@ 2012-05-23 23:40 Barry OReilly
  2021-06-02  6:24 ` bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Barry OReilly @ 2012-05-23 23:40 UTC (permalink / raw)
  To: 11549

To reproduce this bug minimally:

Use a .emacs with only:
(global-auto-revert-mode 1)
(setq revert-without-query (quote (".*")))

Create foo.py:
# aaa
# bbb

Set permissions on foo.py:
-r-xr-xr--  1 boreilly ccgoesr        13 May 22 09:12 foo.py

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>

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.

I would think if revert-buffer updates permissions that auto-revert would too.

An information dump from report-emacs-bug follows.

In GNU Emacs 23.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4)
 of 2012-03-19 on [cut]
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--prefix=[cut]/sw/emacs-install' '--with-gif=no''

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: @im=none
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  global-auto-revert-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <down> <down> <down> i <help-echo>
<help-echo> <down-mouse-1> <drag-mouse-1> <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> <help-echo>
<down-mouse-1> <mouse-1> M-x r e p o r t - e m a c
s - b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Note: file is write protected
Buffer is read-only: #<buffer foo.py>

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug python-21 python easymenu
comint ring autorevert tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mldrag 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 loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)





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

* bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable
  2012-05-23 23:40 bug#11549: auto-revert doesn't revert file permissions as revert-buffer does Barry OReilly
@ 2021-06-02  6:24 ` Lars Ingebrigtsen
  2021-07-02 11:17   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-02  6:24 UTC (permalink / raw)
  To: Barry OReilly; +Cc: 11412, 11549

Barry OReilly <gundaetiapo@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@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





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

* bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable
  2021-06-02  6:24 ` bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable Lars Ingebrigtsen
@ 2021-07-02 11:17   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-02 11:17 UTC (permalink / raw)
  To: Barry OReilly; +Cc: 11412, 11549

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This is apparently a feature added in 2004:
>
> commit 90e118abf2dcc4aca4d7a7642247fa488554351e
> Author:     Luc Teirlinck <teirllm@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





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

end of thread, other threads:[~2021-07-02 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-23 23:40 bug#11549: auto-revert doesn't revert file permissions as revert-buffer does Barry OReilly
2021-06-02  6:24 ` bug#11412: 24.0.95; auto-revert-mode doesn't revert buffer when file becomes writeable Lars Ingebrigtsen
2021-07-02 11:17   ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2012-05-05 15:23 Eric Hanchrow

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