unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20299: 25.0.50; File notification is not working
@ 2015-04-11  0:39 Sean McAfee
  2015-04-11  7:03 ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Sean McAfee @ 2015-04-11  0:39 UTC (permalink / raw)
  To: 20299

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

I recently started a new job, where I have been supplied with the laptop
I'm now using.  I noticed that magit-auto-revert-mode was not having any
effect; checking out a new branch using Magit did not revert any of the
buffers visiting files which were different on the previous branch.

I dug into the source and found that the culprit is the function
auto-revert-handler, and specifically the expression:

(or (not auto-revert-use-notify)
  auto-revert-notify-modified-p)

auto-revert-use-notify had a value of t, and yet
auto-revert-notify-modified-p was nil even in buffers whose associated
files had changed out from under them.  I verified this visiting a file,
then repeatedly issuing the shell command "echo foo >> my-file" and then
evaluating the expression (auto-revert-handler) with M-:, but the file
never got reverted.

I found a note to the effect that this feature would only be active if
Emacs had been compiled with file notification support.  I would have
expected auto-revert-use-notify to be given a suitable default value
depending on whether such support was available, but in any case I went
to my local emacs git repo, pulled down the latest changes, and
recompiled after providing the --with-file-notification=inotify flag to
configure.  Even after this change, though, file notification still
isn't working.

I can just set auto-revert-use-notify to nil going forward, but it would
be nice to get file notification working as intended.



In GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
 of 2015-04-10 on sean-Latitude-E7440
Repository revision: f55ea05bdf60e24c09f9064fc0d2e8a114d6e358
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
System Description:    Ubuntu 14.10

Configured using:
 `configure --with-file-notification=inotify'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  recentf-mode: t
  projectile-global-mode: t
  projectile-mode: t
  global-anzu-mode: t
  anzu-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  google-this-mode: t
  global-flycheck-mode: t
  minibuffer-depth-indicate-mode: t
  ido-everywhere: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  override-global-mode: t
  show-paren-mode: t
  electric-pair-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
Cleaning up the recentf list...done (2 removed)
~/emacs-src
Template key:
Clipboard pasted as level 4 subtree
C-c C-g is undefined
ad-handle-definition: `bookmark-jump' got redefined
Saving bookmarks to file ~/.emacs.d/bookmarks...
Wrote /home/sean/.emacs.d/bookmarks
Saving bookmarks to file ~/.emacs.d/bookmarks...done
Wrote /home/sean/done.org

Load-path shadows:
~/emacs/japanese hides /usr/local/share/emacs/25.0.50/lisp/language/japanese

Features:
(shadow sort mail-extr emacsbug sendmail bookmark tabify org-datetree
org-capture pcmpl-unix recentf tree-widget eww mm-url url-queue shr dom
browse-url js-mode-expansions js imenu cc-mode-expansions cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs sh-script smie executable restclient conf-mode cap-words
superword subword scala-mode2 scala-mode2-imenu scala-mode2-sbt
scala-mode2-map scala-mode2-fontlock scala-mode2-indent
scala-mode2-paragraph scala-mode2-lib html-mode-expansions sgml-mode
org-element org-rmail org-mhe org-irc org-info org-gnus org-docview
doc-view image-mode org-bibtex bibtex org-bbdb org-w3m
the-org-mode-expansions org org-macro org-footnote org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs gnus-dired jka-compr vc vc-dispatcher vc-git
projectile ibuf-ext ibuffer elisp-slime-nav etags xref anzu mule-util
magit-key-mode magit view tramp tramp-compat tramp-loaddefs trampver
shell pcomplete epa epg diff-mode autorevert filenotify git-rebase-mode
git-commit-mode log-edit message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader pcvs-util add-log google-this
flycheck find-func rx subr-x cyberpunk-theme ensime ensime-ui
ensime-semantic-highlight ensime-doc ensime-scalex url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source eieio eieio-core cl-generic
password-cache mailcap ensime-search ensime-undo ensime-startup
ensime-refactor ensime-popup ensime-notes ensime-model ensime-mode
ensime-inspector ensime-goto-testfile ensime-editor ensime-debug gdb-mi
bindat json gud ensime-stacktrace ensime-inf ensime-sbt sbt-mode
sbt-mode-rgrep grep sbt-mode-comint sbt-mode-buffer sbt-mode-project
ensime-company yasnippet help-mode company ensime-auto-complete
ensime-completion-util scala-mode2-syntax ensime-config ensime-vars s
ucs-normalize ensime-util auto-complete popup flymake hideshow pp
arc-mode archive-mode dash url-gw url-vars ensime-client derived
ensime-macros warnings gnus gnus-ems nnheader gnus-util mail-utils
mm-util mail-prsvr wid-edit mb-depth ido dired-details+ dired
dired-details anchored-transpose change-inner expand-region
text-mode-expansions er-basic-expansions expand-region-core
expand-region-custom org-bullets multiple-cursors
mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core byte-opt advice rect undo-tree diff
ack compile comint ansi-color ring paredit edmacro kmacro use-package
diminish bytecomp byte-compile cl-extra seq cconv bind-key easy-mmode
finder-inf info easymenu package epg-config paren elec-pair savehist
desktop frameset server thingatpt help-fns perl-mode cl-macs cl gv
cl-loaddefs pcase cl-lib time-date tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar 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 cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 567561 51984)
 (symbols 48 51197 0)
 (miscs 40 2332 364)
 (strings 32 121532 20169)
 (string-bytes 1 3675027)
 (vectors 16 75299)
 (vector-slots 8 1788518 105160)
 (floats 8 456 780)
 (intervals 56 4135 309)
 (buffers 976 64)
 (heap 1024 54594 2035))

[-- Attachment #2: Type: text/html, Size: 8182 bytes --]

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

* bug#20299: 25.0.50; File notification is not working
  2015-04-11  0:39 bug#20299: 25.0.50; File notification is not working Sean McAfee
@ 2015-04-11  7:03 ` Michael Albinus
       [not found]   ` <CANan03bo=meT7fQZ_QPxAgO69x_PBPx_H53BLMqUYk-=iqOybg@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2015-04-11  7:03 UTC (permalink / raw)
  To: Sean McAfee; +Cc: 20299

Sean McAfee <eefacm@gmail.com> writes:

Hi Sean,

> auto-revert-use-notify had a value of t, and yet
> auto-revert-notify-modified-p was nil even in buffers whose associated
> files had changed out from under them. I verified this visiting a
> file,
> then repeatedly issuing the shell command "echo foo >> my-file" and
> then
> evaluating the expression (auto-revert-handler) with M-:, but the file
> never got reverted.

On which directory have you done this? Note, that inotify does not work
on mounted directories.

> I can just set auto-revert-use-notify to nil going forward, but it
> would
> be nice to get file notification working as intended.

Another test you might apply is setting prior magit-auto-revert-mode

(require 'filenotify)
(require 'trace)
(dolist (elt (all-completions "file-notify-" obarray 'functionp))
  (trace-function (intern elt)))

You will observe in the buffer *trace-output*, whether file
notifications events arrive.

Best regards, Michael.





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

* bug#20299: 25.0.50; File notification is not working
       [not found]       ` <CANan03ZDin3ZkU_=NxPa0Xyf2ouNrVYVJy7q-=Oo+Bo1Hs3KtQ@mail.gmail.com>
@ 2015-04-16 14:25         ` Michael Albinus
  2015-04-18 16:54           ` Sean McAfee
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2015-04-16 14:25 UTC (permalink / raw)
  To: Sean McAfee; +Cc: 20299

Sean McAfee <eefacm@gmail.com> writes:

[Pls keep the Cc for the archives]

> Anyway, here's what I just did:
>
> * Started Emacs with "emacs -Q"
> * (require 'filenotify)
> * (require 'trace)
> * Evaluated your (dolist ...) expression from above
> * (require 'auto-revert)

Not needed.

> * Visit a file

Here you must apply "M-x auto-revert-mode".

> * Append to the file by executing a shell command
> * Evaluated (auto-revert-handler)
>
> The file was not reverted, and the complete list of open buffers at
> that time were foo.txt (visiting my test file), *scratch*, *Messages*,
> *Shell Command Output*, and *Backtrace*. Nothing trace-related that I
> can see. It appears that none of the file-notify-* functions are ever
> called, even though I built Emacs with the -
> -with-file-notification=inotify configuration switch.
>
> --Sean

Best regards, Michael.





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

* bug#20299: 25.0.50; File notification is not working
  2015-04-16 14:25         ` Michael Albinus
@ 2015-04-18 16:54           ` Sean McAfee
  2015-04-18 17:51             ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Sean McAfee @ 2015-04-18 16:54 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 20299

Michael Albinus <michael.albinus@gmx.de> writes:
> Here you must apply "M-x auto-revert-mode".

Ah, I didn't realize this was necessary.  I assumed Emacs would receive
file notification events for all open files if it was built with that
capability, since it seems an inexpensive enough operation.

This would seem to be more of a Magit issue than an Emacs issue.  I'll
re-report my original issue in the appropriate place (although it's hard
to imagine that such a substantial feature being broken could have gone
unnoticed by anyone other than me by now).

Thanks for the help!


--Sean





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

* bug#20299: 25.0.50; File notification is not working
  2015-04-18 16:54           ` Sean McAfee
@ 2015-04-18 17:51             ` Michael Albinus
  2015-04-19  8:27               ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2015-04-18 17:51 UTC (permalink / raw)
  To: Sean McAfee; +Cc: 20299

Sean McAfee <eefacm@gmail.com> writes:

> Michael Albinus <michael.albinus@gmx.de> writes:
>> Here you must apply "M-x auto-revert-mode".
>
> Ah, I didn't realize this was necessary.  I assumed Emacs would receive
> file notification events for all open files if it was built with that
> capability, since it seems an inexpensive enough operation.

Inexpensive if you have native support like inotify. If you use glib,
for example, it might be necessary to poll, which is more heavy.

> This would seem to be more of a Magit issue than an Emacs issue.  I'll
> re-report my original issue in the appropriate place (although it's hard
> to imagine that such a substantial feature being broken could have gone
> unnoticed by anyone other than me by now).

OK, so I'm closing this bug. Feel free to come back if needed.

> Thanks for the help!
>
> --Sean

Best regards, Michael.





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

* bug#20299: 25.0.50; File notification is not working
  2015-04-18 17:51             ` Michael Albinus
@ 2015-04-19  8:27               ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2015-04-19  8:27 UTC (permalink / raw)
  To: Sean McAfee; +Cc: 20299

Michael Albinus <michael.albinus@gmx.de> writes:

> Sean McAfee <eefacm@gmail.com> writes:
>
>> Michael Albinus <michael.albinus@gmx.de> writes:
>>> Here you must apply "M-x auto-revert-mode".
>>
>> Ah, I didn't realize this was necessary.  I assumed Emacs would receive
>> file notification events for all open files if it was built with that
>> capability, since it seems an inexpensive enough operation.
>
> Inexpensive if you have native support like inotify. If you use glib,
> for example, it might be necessary to poll, which is more heavy.

PS: If you want to run all buffers in auto-revert-mode per default, you
could apply "M-x global-auto-revert-mode".

>> Thanks for the help!

Bst regards, Michael.





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

end of thread, other threads:[~2015-04-19  8:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-11  0:39 bug#20299: 25.0.50; File notification is not working Sean McAfee
2015-04-11  7:03 ` Michael Albinus
     [not found]   ` <CANan03bo=meT7fQZ_QPxAgO69x_PBPx_H53BLMqUYk-=iqOybg@mail.gmail.com>
     [not found]     ` <87vbgyn8tr.fsf@gmx.de>
     [not found]       ` <CANan03ZDin3ZkU_=NxPa0Xyf2ouNrVYVJy7q-=Oo+Bo1Hs3KtQ@mail.gmail.com>
2015-04-16 14:25         ` Michael Albinus
2015-04-18 16:54           ` Sean McAfee
2015-04-18 17:51             ` Michael Albinus
2015-04-19  8:27               ` Michael Albinus

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