Subject: bug#9171: 23.2; revert-buffer ignores revert-without-query

From: Steve Throckmorton <[email-masked]>
Date: Mon, 25 Jul 2011 15:52:58 -0400

I set 'revert-without-query' to (".+") so that every file name would
match.  However, revert-buffer ignored this and continued to confirm
reversion (unless the buffer had not been modified, as testing later
revealed).  Here's the relevant section from files.el:

(cond ((null file-name)
       (error "Buffer does not seem to be associated with any file"))
      ((or noconfirm
           (and (not (buffer-modified-p))
                (catch 'found
                  (dolist (regexp revert-without-query)
                    (when (string-match regexp file-name)
                      (throw 'found t)))))
           (yes-or-no-p (format "Revert buffer from file %s? "
                                file-name)))
       ;;;     .... DO ACTUAL BUFFER REVERSION  ....

And here's a diff of the change that "fixed" this:

4856c4856
< 		   (and (buffer-modified-p)
---
> 		   (and (not (buffer-modified-p))

Obviously, inverting the buffer-modified test means the rest of the
AND expression (where the test using revert-without-query is) never
gets evaluated, except (as mentioned) in the silly case of reverting
an unchanged buffer.

I put "fix" in quotes because the behavior is still sub-optimal.  Now,
if one attempts to revert an unmodified buffer, revert-buffer queries
the user--again, without regard to the state of revert-without-query.
I'm not sure why the test for buffer-modified is combined with the
test against revert-without-query.  It seems to make it difficult to
get a sensible combination of behaviors.

Steve T.

In GNU Emacs 23.2.1 (i386-redhat-linux-gnu, GTK+ Version 2.21.4)
 of 2010-07-08 on x86-05.phx2.fedoraproject.org
Windowing system distributor `The Cygwin/X Project', version 11.0.10800000
configured using `configure  '--build=i386-redhat-linux-gnu'
'--host=i386-redhat-linux-gnu' '--program-prefix='
'--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib'
'--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=i386-redhat-linux-gnu'
'host_alias=i386-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
-fasynchronous-unwind-tables -fno-optimize-sibling-calls''

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: Ibuffer

Minor modes in effect:
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC C-x b <return> M-x r e v <backspace> c o v e r
- f i l <backspace> <backspace> <backspace> t h i s
<tab> <return> y e s <return> C-x C-b <help-echo> M-x
e m a <backspace> <backspace> <backspace> f i l e -
e m a <C-backspace> <C-backspace> r e p o r t - e m
<tab> <return>

Recent messages:
Loading time...done
Loading paren...done
Loading /home/steve/.emacs.d/emacs-custom.el (source)...done
Starting Emacs daemon.
journal.org has auto save data; consider M-x recover-this-file
Loading vc-git...done
When done with this frame, type C-x 5 0
Updating buffer list...
Formats have changed, recompiling...done
Updating buffer list...done

Load-path shadows:
~/.emacs.d/lisp/theirs/slime/contrib/bridge hides
~/.emacs.d/lisp/theirs/slime/bridge
/usr/share/emacs/site-lisp/flim/hex-util hides
/usr/share/emacs/23.2/lisp/hex-util
/usr/share/emacs/site-lisp/flim/sha1 hides /usr/share/emacs/23.2/lisp/sha1
/usr/share/emacs/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4
~/.emacs.d/lisp/theirs/slime/tree-widget hides
/usr/share/emacs/23.2/lisp/tree-widget
~/.emacs.d/lisp/theirs/ruby-mode hides
/usr/share/emacs/23.2/lisp/progmodes/ruby-mode
/usr/share/emacs/site-lisp/org-7.5/org-datetree hides
/usr/share/emacs/23.2/lisp/org/org-datetree
/usr/share/emacs/site-lisp/org-7.5/org-src hides
/usr/share/emacs/23.2/lisp/org/org-src
/usr/share/emacs/site-lisp/org-7.5/org-icalendar hides
/usr/share/emacs/23.2/lisp/org/org-icalendar
/usr/share/emacs/site-lisp/org-7.5/org-bbdb hides
/usr/share/emacs/23.2/lisp/org/org-bbdb
/usr/share/emacs/site-lisp/org-7.5/org-docbook hides
/usr/share/emacs/23.2/lisp/org/org-docbook
/usr/share/emacs/site-lisp/org-7.5/org-table hides
/usr/share/emacs/23.2/lisp/org/org-table
/usr/share/emacs/site-lisp/org-7.5/org-habit hides
/usr/share/emacs/23.2/lisp/org/org-habit
/usr/share/emacs/site-lisp/org-7.5/org-vm hides
/usr/share/emacs/23.2/lisp/org/org-vm
/usr/share/emacs/site-lisp/org-7.5/org-bibtex hides
/usr/share/emacs/23.2/lisp/org/org-bibtex
/usr/share/emacs/site-lisp/org-7.5/org-agenda hides
/usr/share/emacs/23.2/lisp/org/org-agenda
/usr/share/emacs/site-lisp/org-7.5/org-clock hides
/usr/share/emacs/23.2/lisp/org/org-clock
/usr/share/emacs/site-lisp/org-7.5/org-ascii hides
/usr/share/emacs/23.2/lisp/org/org-ascii
/usr/share/emacs/site-lisp/org-7.5/org-crypt hides
/usr/share/emacs/23.2/lisp/org/org-crypt
/usr/share/emacs/site-lisp/org-7.5/org-gnus hides
/usr/share/emacs/23.2/lisp/org/org-gnus
/usr/share/emacs/site-lisp/org-7.5/org-latex hides
/usr/share/emacs/23.2/lisp/org/org-latex
/usr/share/emacs/site-lisp/org-7.5/org-footnote hides
/usr/share/emacs/23.2/lisp/org/org-footnote
/usr/share/emacs/site-lisp/org-7.5/org-remember hides
/usr/share/emacs/23.2/lisp/org/org-remember
/usr/share/emacs/site-lisp/org-7.5/org-indent hides
/usr/share/emacs/23.2/lisp/org/org-indent
/usr/share/emacs/site-lisp/org-7.5/org-inlinetask hides
/usr/share/emacs/23.2/lisp/org/org-inlinetask
/usr/share/emacs/site-lisp/org-7.5/org-feed hides
/usr/share/emacs/23.2/lisp/org/org-feed
/usr/share/emacs/site-lisp/org-7.5/org-colview hides
/usr/share/emacs/23.2/lisp/org/org-colview
/usr/share/emacs/site-lisp/org-7.5/org-plot hides
/usr/share/emacs/23.2/lisp/org/org-plot
/usr/share/emacs/site-lisp/org-7.5/org-macs hides
/usr/share/emacs/23.2/lisp/org/org-macs
/usr/share/emacs/site-lisp/org-7.5/org-mhe hides
/usr/share/emacs/23.2/lisp/org/org-mhe
/usr/share/emacs/site-lisp/org-7.5/org-xoxo hides
/usr/share/emacs/23.2/lisp/org/org-xoxo
/usr/share/emacs/site-lisp/org-7.5/org-irc hides
/usr/share/emacs/23.2/lisp/org/org-irc
/usr/share/emacs/site-lisp/org-7.5/org-freemind hides
/usr/share/emacs/23.2/lisp/org/org-freemind
/usr/share/emacs/site-lisp/org-7.5/org-mew hides
/usr/share/emacs/23.2/lisp/org/org-mew
/usr/share/emacs/site-lisp/org-7.5/org-rmail hides
/usr/share/emacs/23.2/lisp/org/org-rmail
/usr/share/emacs/site-lisp/org-7.5/org-install hides
/usr/share/emacs/23.2/lisp/org/org-install
/usr/share/emacs/site-lisp/org-7.5/org hides /usr/share/emacs/23.2/lisp/org/org
/usr/share/emacs/site-lisp/org-7.5/org-html hides
/usr/share/emacs/23.2/lisp/org/org-html
/usr/share/emacs/site-lisp/org-7.5/org-jsinfo hides
/usr/share/emacs/23.2/lisp/org/org-jsinfo
/usr/share/emacs/site-lisp/org-7.5/org-protocol hides
/usr/share/emacs/23.2/lisp/org/org-protocol
/usr/share/emacs/site-lisp/org-7.5/org-wl hides
/usr/share/emacs/23.2/lisp/org/org-wl
/usr/share/emacs/site-lisp/org-7.5/org-w3m hides
/usr/share/emacs/23.2/lisp/org/org-w3m
/usr/share/emacs/site-lisp/org-7.5/org-mac-message hides
/usr/share/emacs/23.2/lisp/org/org-mac-message
/usr/share/emacs/site-lisp/org-7.5/org-exp hides
/usr/share/emacs/23.2/lisp/org/org-exp
/usr/share/emacs/site-lisp/org-7.5/org-id hides
/usr/share/emacs/23.2/lisp/org/org-id
/usr/share/emacs/site-lisp/org-7.5/org-info hides
/usr/share/emacs/23.2/lisp/org/org-info
/usr/share/emacs/site-lisp/org-7.5/org-archive hides
/usr/share/emacs/23.2/lisp/org/org-archive
/usr/share/emacs/site-lisp/org-7.5/org-exp-blocks hides
/usr/share/emacs/23.2/lisp/org/org-exp-blocks
/usr/share/emacs/site-lisp/org-7.5/org-mouse hides
/usr/share/emacs/23.2/lisp/org/org-mouse
/usr/share/emacs/site-lisp/org-7.5/org-mobile hides
/usr/share/emacs/23.2/lisp/org/org-mobile
/usr/share/emacs/site-lisp/org-7.5/org-faces hides
/usr/share/emacs/23.2/lisp/org/org-faces
/usr/share/emacs/site-lisp/org-7.5/org-compat hides
/usr/share/emacs/23.2/lisp/org/org-compat
/usr/share/emacs/site-lisp/org-7.5/org-publish hides
/usr/share/emacs/23.2/lisp/org/org-publish
/usr/share/emacs/site-lisp/org-7.5/org-attach hides
/usr/share/emacs/23.2/lisp/org/org-attach
/usr/share/emacs/site-lisp/org-7.5/org-list hides
/usr/share/emacs/23.2/lisp/org/org-list
/usr/share/emacs/site-lisp/org-7.5/org-timer hides
/usr/share/emacs/23.2/lisp/org/org-timer
/usr/share/emacs/site-lisp/flim/hmac-def hides
/usr/share/emacs/23.2/lisp/net/hmac-def
/usr/share/emacs/site-lisp/flim/sasl-ntlm hides
/usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs/site-lisp/flim/sasl-digest hides
/usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs/site-lisp/flim/hmac-md5 hides
/usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs/site-lisp/flim/sasl hides /usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs/site-lisp/flim/sasl-cram hides
/usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs/site-lisp/flim/ntlm hides /usr/share/emacs/23.2/lisp/net/ntlm
~/.emacs.d/lisp/theirs/slime/cl-indent hides
/usr/share/emacs/23.2/lisp/emacs-lisp/cl-indent
/usr/share/emacs/site-lisp/timeclock hides
/usr/share/emacs/23.2/lisp/calendar/timeclock

Features:
(shadow sort mail-extr message idna sendmail 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 mm-util mail-prsvr gmm-utils mailheader canlock sha1 sha1-el
hex-util hashcash mail-utils hippie-exp emacsbug ibuf-ext ibuffer
help-mode view server vc-git org-indent org-wl org-w3m org-vm org-rmail
org-mhe org-mew org-irc org-jsinfo org-infojs org-html format-spec
org-exp ob-exp org-exp-blocks org-agenda org-info org-gnus org-docview
org-bibtex org-bbdb org byte-opt bytecomp byte-compile advice help-fns
advice-preload ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint comint ring ob-keys ob ob-eval
org-pcomplete pcomplete org-list org-faces org-compat org-entities
org-macs time-date noutline outline easy-mmode regexp-opt cal-menu
calendar cal-loaddefs paren time cus-start cus-load slime-autoloads
edmacro kmacro ido color-theme easymenu wid-edit cl cl-19 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)