Minor fix in filenotify.el

* lisp/filenotify.el (file-notify--event-file-name)
(file-notify--event-file1-name): Normalize result with
`directory-file-name'.
This commit is contained in:
Michael Albinus 2015-10-31 14:42:16 +01:00
parent b059c6b584
commit 547a23469a
2 changed files with 8 additions and 6 deletions

View file

@ -100,17 +100,19 @@ It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).")
(defun file-notify--event-file-name (event)
"Return file name of file notification event, or nil."
(expand-file-name
(or (and (stringp (nth 2 event)) (nth 2 event)) "")
(car (gethash (car event) file-notify-descriptors))))
(directory-file-name
(expand-file-name
(or (and (stringp (nth 2 event)) (nth 2 event)) "")
(car (gethash (car event) file-notify-descriptors)))))
;; Only `gfilenotify' could return two file names.
(defun file-notify--event-file1-name (event)
"Return second file name of file notification event, or nil.
This is available in case a file has been moved."
(and (stringp (nth 3 event))
(expand-file-name
(nth 3 event) (car (gethash (car event) file-notify-descriptors)))))
(directory-file-name
(expand-file-name
(nth 3 event) (car (gethash (car event) file-notify-descriptors))))))
;; Cookies are offered by `inotify' only.
(defun file-notify--event-cookie (event)

View file

@ -623,7 +623,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered."
;; TODO:
;; * It does not work yet for local gfilenotify and remote inotifywait.
;; * It does not work yet for local gfilenotify.
;; * For w32notify, no stopped events arrive when a directory is removed.
(provide 'file-notify-tests)