[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 82c1b36: Fix Bug#21841
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master 82c1b36: Fix Bug#21841 |
Date: |
Sun, 08 Nov 2015 14:23:25 +0000 |
branch: master
commit 82c1b368a227ca710e3582be311f2cbabc33499f
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Fix Bug#21841
* lisp/filenotify.el (file-notify--rm-descriptor):
Use `descriptor' instead of computing its value.
(file-notify--descriptor): Additional argument FILE. Adapt all callees.
(file-notify-rm-watch): Use `descriptor' when calling file name handler.
(Bug#21841)
---
lisp/filenotify.el | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 132f164..4c5d43f 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -62,7 +62,7 @@ WHAT is a file or directory name to be removed, needed just
for `inotify'."
;; Send `stopped' event.
(dolist (entry (cdr registered))
(funcall (cdr entry)
- `(,(file-notify--descriptor desc) stopped
+ `(,descriptor stopped
,(or (and (stringp (car entry))
(expand-file-name (car entry) dir))
dir))))
@@ -123,14 +123,17 @@ This is available in case a file has been moved."
;; `inotify' returns the same descriptor when the file (directory)
;; uses the same inode. We want to distinguish, and apply a virtual
;; descriptor which make the difference.
-(defun file-notify--descriptor (descriptor)
+(defun file-notify--descriptor (desc file)
"Return the descriptor to be used in `file-notify-*-watch'.
For `gfilenotify' and `w32notify' it is the same descriptor as
used in the low-level file notification package."
- (if (and (natnump descriptor) (eq file-notify--library 'inotify))
- (cons descriptor
- (car (cadr (gethash descriptor file-notify-descriptors))))
- descriptor))
+ (if (and (natnump desc) (eq file-notify--library 'inotify))
+ (cons desc
+ (and (stringp file)
+ (car (assoc
+ (file-name-nondirectory file)
+ (gethash desc file-notify-descriptors)))))
+ desc))
;; The callback function used to map between specific flags of the
;; respective file notifications, and the ones we return.
@@ -210,9 +213,11 @@ EVENT is the cadr of the event in
`file-notify-handle-event'
(car file-notify--pending-event)))
;; If the source is handled by another watch, we
;; must fire the rename event there as well.
- (when (not (equal (file-notify--descriptor desc)
+ (when (not (equal (file-notify--descriptor desc file1)
(file-notify--descriptor
- (caar file-notify--pending-event))))
+ (caar file-notify--pending-event)
+ (file-notify--event-file-name
+ file-notify--pending-event))))
(setq pending-event
`((,(caar file-notify--pending-event)
renamed ,file ,file1)
@@ -223,7 +228,10 @@ EVENT is the cadr of the event in
`file-notify-handle-event'
;; Apply pending callback.
(when pending-event
(setcar
- (car pending-event) (file-notify--descriptor (caar pending-event)))
+ (car pending-event)
+ (file-notify--descriptor
+ (caar pending-event)
+ (file-notify--event-file-name file-notify--pending-event)))
(funcall (cadr pending-event) (car pending-event))
(setq pending-event nil))
@@ -257,14 +265,15 @@ EVENT is the cadr of the event in
`file-notify-handle-event'
(if file1
(funcall
callback
- `(,(file-notify--descriptor desc) ,action ,file ,file1))
+ `(,(file-notify--descriptor desc file) ,action ,file ,file1))
(funcall
callback
- `(,(file-notify--descriptor desc) ,action ,file)))))
+ `(,(file-notify--descriptor desc file) ,action ,file)))))
;; Modify `file-notify-descriptors'.
(when stopped
- (file-notify--rm-descriptor (file-notify--descriptor desc) file)))))
+ (file-notify--rm-descriptor
+ (file-notify--descriptor desc file) file)))))
;; `gfilenotify' and `w32notify' return a unique descriptor for every
;; `file-notify-add-watch', while `inotify' returns a unique
@@ -375,7 +384,8 @@ FILE is the name of the file whose event is being reported."
file-notify-descriptors)
;; Return descriptor.
- (file-notify--descriptor desc)))
+ (file-notify--descriptor
+ desc (unless (file-directory-p file) (file-name-nondirectory file)))))
(defun file-notify-rm-watch (descriptor)
"Remove an existing watch specified by its DESCRIPTOR.
@@ -396,7 +406,7 @@ DESCRIPTOR should be an object returned by
`file-notify-add-watch'."
(if handler
;; A file name handler could exist even if there is no local
;; file notification support.
- (funcall handler 'file-notify-rm-watch desc)
+ (funcall handler 'file-notify-rm-watch descriptor)
(funcall
(cond
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 82c1b36: Fix Bug#21841,
Michael Albinus <=