all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Yoni Rabkin <yoni@rabkins.net>
Cc: Michael Albinus <michael.albinus@gmx.de>,
	 Stefan Kangas <stefankangas@gmail.com>,
	 emacs-devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] elisp manual patch: add to file notification documentation
Date: Tue, 13 Dec 2022 13:06:28 -0500	[thread overview]
Message-ID: <jwvzgbr9ob8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <871qp3i4wu.fsf@rabkins.net> (Yoni Rabkin's message of "Tue, 13 Dec 2022 12:34:25 -0500")

> The documentation for `file-notify-add-watch' says: "If the file cannot
> be watched for some reason, this function signals a `file-notify-error'
> error."

If this error is not good enough, maybe we should improve it, e.g. it
could return different contents depending on whether the problem is
a lack of notification support in Emacs, or a lack of notification
support for this particular file/dir (e.g. via Tramp), etc...

> I think that there is value in documenting a way for us to check if the
> emacs we are running supports file notification, short of actually
> trying to run `file-notify-add-watch', getting a generic
> `file-notify-error', and reading the associated message to find out if
> it is a simple problem, like a missing directory, or a difficult
> problem, like a missing library.

I guess it depends what you intend to do with that info.

AFAIK all callers of `file-notify-add-watch` need to handle the case
where the addition fails, but I wonder how you intend to use the
specific kind of error in the rest of the code.

I guess you could also perform a dummy `file-notify-add-watch` on
something like $HOME as a way to check whether there is basic support
for file notifications.


        Stefan




  parent reply	other threads:[~2022-12-13 18:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  3:05 [PATCH] elisp manual patch: add to file notification documentation Yoni Rabkin
2022-12-13  3:25 ` Stefan Kangas
2022-12-13  8:21   ` Michael Albinus
2022-12-13 17:34     ` Yoni Rabkin
2022-12-13 17:46       ` Eli Zaretskii
2022-12-13 18:23         ` Yoni Rabkin
2022-12-13 20:07           ` Eli Zaretskii
2022-12-13 18:06       ` Stefan Monnier [this message]
2022-12-13 18:28       ` Michael Albinus
2022-12-13 18:52         ` Stefan Kangas
2022-12-13 19:05           ` Michael Albinus
2022-12-13 17:18   ` Yoni Rabkin
2022-12-13 18:20     ` Stefan Kangas
2022-12-13 18:31     ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvzgbr9ob8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=stefankangas@gmail.com \
    --cc=yoni@rabkins.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.