summaryrefslogtreecommitdiff
path: root/src/w32notify.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-09-14 10:31:17 +0300
committerEli Zaretskii <eliz@gnu.org>2015-09-14 10:31:17 +0300
commitef5b1a22bbeef239981dd6745abb4f08e2de54e0 (patch)
treea5e8a7236328ebdd98b701e034c2a248c8783244 /src/w32notify.c
parent12629d2857ba2a7c8a6b6a6b61f28a179d2c92a7 (diff)
downloademacs-ef5b1a22bbeef239981dd6745abb4f08e2de54e0.tar.gz
Report file-notify-error in w32notify.c
* src/w32notify.c (report_w32notify_error): New function. (Fw32notify_add_watch, Fw32notify_rm_watch): Use it to report errors, instead of calling report_file_error. (Bug#21432)
Diffstat (limited to 'src/w32notify.c')
-rw-r--r--src/w32notify.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/w32notify.c b/src/w32notify.c
index fa4ad01636b..efd9e56e105 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -464,6 +464,21 @@ filter_list_to_flags (Lisp_Object filter_list)
return flags;
}
+/* Like report_file_error, but reports a file-notify-error instead. */
+static void
+report_w32notify_error (const char *string, Lisp_Object name)
+{
+ Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name);
+ synchronize_system_messages_locale ();
+ char *str = strerror (errno);
+ Lisp_Object errstring
+ = code_convert_string_norecord (build_unibyte_string (str),
+ Vlocale_coding_system, 0);
+ Lisp_Object errdata = Fcons (errstring, data);
+
+ xsignal (Qfile_notify_error, Fcons (build_string (string), errdata));
+}
+
DEFUN ("w32notify-add-watch", Fw32notify_add_watch,
Sw32notify_add_watch, 3, 3, 0,
doc: /* Add a watch for filesystem events pertaining to FILE.
@@ -528,8 +543,8 @@ generate notifications correctly, though. */)
|| (w32_major_version == 5 && w32_major_version < 1))
{
errno = ENOSYS;
- report_file_error ("Watching filesystem events is not supported",
- Qnil);
+ report_w32notify_error ("Watching filesystem events is not supported",
+ Qnil);
}
/* filenotify.el always passes us a directory, either the parent
@@ -573,11 +588,11 @@ generate notifications correctly, though. */)
Vlocale_coding_system, 0);
else
lisp_errstr = build_string (errstr);
- report_file_error ("Cannot watch file",
- Fcons (lisp_errstr, Fcons (file, Qnil)));
+ report_w32notify_error ("Cannot watch file",
+ Fcons (lisp_errstr, Fcons (file, Qnil)));
}
else
- report_file_error ("Cannot watch file", Fcons (file, Qnil));
+ report_w32notify_error ("Cannot watch file", Fcons (file, Qnil));
}
/* Store watch object in watch list. */
watch_descriptor = make_pointer_integer (dirwatch);
@@ -611,8 +626,8 @@ WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. */)
}
if (status == -1)
- report_file_error ("Invalid watch descriptor", Fcons (watch_descriptor,
- Qnil));
+ report_w32notify_error ("Invalid watch descriptor", Fcons (watch_descriptor,
+ Qnil));
return Qnil;
}