I would to do a specific action (create an org-mod link) when a new file appears in a given directory. For that I need to catch the event but also the path of the new file. I managed to use file-notify-add-watch function which is described here and its work very well, but the output is an "event". How to get a string from this event ?


1 Answer 1


As the documentation you linked to states:

When any event happens, Emacs will call the callback function passing it a single argument event, which is of the form

     (descriptor action file [file1])


file and file1 are the name of the file(s) whose event is being reported

So you could get the filename from event using (third event) (and/or fourth if multiple files changed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.