Function: file-notify--call-handler

file-notify--call-handler is a byte-compiled function defined in filenotify.el.gz.

Signature

(file-notify--call-handler WATCH DESC ACTION FILE FILE1)

Documentation

Call the handler of WATCH with the arguments DESC, ACTION, FILE and FILE1.

Source Code

;; Defined in /usr/src/emacs/lisp/filenotify.el.gz
(defun file-notify--call-handler (watch desc action file file1)
  "Call the handler of WATCH with the arguments DESC, ACTION, FILE and FILE1."
  (when (or
         ;; If there is no relative file name for that
         ;; watch, we watch the whole directory.
         (null (file-notify--watch-filename watch))
         ;; File matches.
         (string-equal
          (file-notify--watch-filename watch)
          (file-name-nondirectory file))

         ;; Directory matches.
         ;;  FIXME: What purpose would this condition serve?
         ;;  Doesn't it just slip through events for files
         ;;  having the same name as the last component of the
         ;;  directory of the file that we are really watching?
         ;;(string-equal
         ;; (file-name-nondirectory file)
         ;; (file-name-nondirectory (file-notify--watch-directory watch)))

         ;; File1 matches.
         (and (stringp file1)
              (string-equal (file-notify--watch-filename watch)
                            (file-name-nondirectory file1))))
    ;; The callback could have removed in `file-notify--rm-descriptor'.
    (when (file-notify--watch-callback watch)
      (when file-notify-debug
        (message
         "file-notify--call-handler %S %S %S %S %S %S %S"
         desc action file file1 watch
         (file-notify--watch-absolute-filename watch)
         (file-notify--watch-directory watch)))
      (funcall (file-notify--watch-callback watch)
               (if file1
                   (list desc action file file1)
                 (list desc action file))))))