[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113279: * fileio.c (Qfile_notify_error): New error
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] trunk r113279: * fileio.c (Qfile_notify_error): New error symbol. |
Date: |
Thu, 04 Jul 2013 09:29:57 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113279
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Thu 2013-07-04 11:29:28 +0200
message:
* fileio.c (Qfile_notify_error): New error symbol.
* gfilenotify.c (Fgfile_add_watch, Fgfile_rm_watch):
* inotify.c (inotify_callback, symbol_to_inotifymask)
(Finotify_add_watch, Finotify_rm_watch): Use it.
(inotifyevent_to_event): Exchange order of cookie and file name.
(Finotify_add_watch): Adapt docstring.
* lisp.h (Qfile_notify_error): Declare.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/fileio.c fileio.c-20091113204419-o5vbwnq5f7feedwu-210
src/gfilenotify.c gfilenotify.c-20130528100009-4z0x3dhiuzxnn8hq-1
src/inotify.c inotify.c-20121210111500-2cd7np2oq1r0lmp9-1
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-07-04 06:20:55 +0000
+++ b/src/ChangeLog 2013-07-04 09:29:28 +0000
@@ -1,3 +1,15 @@
+2013-07-04 Michael Albinus <address@hidden>
+
+ * fileio.c (Qfile_notify_error): New error symbol.
+
+ * gfilenotify.c (Fgfile_add_watch, Fgfile_rm_watch):
+ * inotify.c (inotify_callback, symbol_to_inotifymask)
+ (Finotify_add_watch, Finotify_rm_watch): Use it.
+ (inotifyevent_to_event): Exchange order of cookie and file name.
+ (Finotify_add_watch): Adapt docstring.
+
+ * lisp.h (Qfile_notify_error): Declare.
+
2013-07-04 Paul Eggert <address@hidden>
Try again to fix FreeBSD bug re multithreaded memory alloc (Bug#14569).
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2013-06-18 07:42:37 +0000
+++ b/src/fileio.c 2013-07-04 09:29:28 +0000
@@ -148,7 +148,7 @@
#ifdef WINDOWSNT
#endif
-Lisp_Object Qfile_error;
+Lisp_Object Qfile_error, Qfile_notify_error;
static Lisp_Object Qfile_already_exists, Qfile_date_error;
static Lisp_Object Qexcl;
Lisp_Object Qfile_name_history;
@@ -5887,6 +5887,7 @@
DEFSYM (Qfile_error, "file-error");
DEFSYM (Qfile_already_exists, "file-already-exists");
DEFSYM (Qfile_date_error, "file-date-error");
+ DEFSYM (Qfile_notify_error, "file-notify-error");
DEFSYM (Qexcl, "excl");
DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system,
@@ -5925,6 +5926,11 @@
Fput (Qfile_date_error, Qerror_message,
build_pure_c_string ("Cannot set file date"));
+ Fput (Qfile_notify_error, Qerror_conditions,
+ Fpurecopy (list3 (Qfile_notify_error, Qfile_error, Qerror)));
+ Fput (Qfile_notify_error, Qerror_message,
+ build_pure_c_string ("File notification error"));
+
DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist,
doc: /* Alist of elements (REGEXP . HANDLER) for file names
handled specially.
If a file name matches REGEXP, all I/O on that file is done by calling
=== modified file 'src/gfilenotify.c'
--- a/src/gfilenotify.c 2013-06-06 07:04:35 +0000
+++ b/src/gfilenotify.c 2013-07-04 09:29:28 +0000
@@ -132,15 +132,14 @@
to Emacs. Use `gfile-rm-watch' to cancel the watch.
Value is a descriptor for the added watch. If the file cannot be
-watched for some reason, this function signals a `file-error' error.
+watched for some reason, this function signals a `file-notify-error' error.
FLAGS is a list of conditions to set what will be watched for. It can
include the following symbols:
'watch-mounts' -- watch for mount events
'send-moved' -- pair 'deleted' and 'created' events caused by file
- renames (moves) and send a single 'event-moved'
- event instead
+ renames and send a single 'renamed' event instead
When any event happens, Emacs will call the CALLBACK function passing
it a single argument EVENT, which is of the form
@@ -193,7 +192,7 @@
/* Enable watch. */
monitor = g_file_monitor (gfile, gflags, NULL, NULL);
if (! monitor)
- xsignal2 (Qfile_error, build_string ("Cannot watch file"), file);
+ xsignal2 (Qfile_notify_error, build_string ("Cannot watch file"), file);
/* On all known glib platforms, converting MONITOR directly to a
Lisp_Object value results is a Lisp integer, which is safe. This
@@ -202,7 +201,8 @@
if (! INTEGERP (watch_descriptor))
{
g_object_unref (monitor);
- xsignal2 (Qfile_error, build_string ("Unsupported file watcher"), file);
+ xsignal2 (Qfile_notify_error, build_string ("Unsupported file watcher"),
+ file);
}
g_signal_connect (monitor, "changed",
@@ -226,14 +226,14 @@
Lisp_Object watch_object = assq_no_quit (watch_descriptor, watch_list);
if (! CONSP (watch_object))
- xsignal2 (Qfile_error, build_string ("Not a watch descriptor"),
+ xsignal2 (Qfile_notify_error, build_string ("Not a watch descriptor"),
watch_descriptor);
eassert (INTEGERP (watch_descriptor));
int_monitor = XLI (watch_descriptor);
monitor = (GFileMonitor *) int_monitor;
if (!g_file_monitor_cancel (monitor))
- xsignal2 (Qfile_error, build_string ("Could not rm watch"),
+ xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"),
watch_descriptor);
/* Remove watch descriptor from watch list. */
=== modified file 'src/inotify.c'
--- a/src/inotify.c 2013-01-02 16:30:50 +0000
+++ b/src/inotify.c 2013-07-04 09:29:28 +0000
@@ -139,8 +139,8 @@
return list2 (list4 (make_watch_descriptor (ev->wd),
mask_to_aspects (ev->mask),
- make_number (ev->cookie),
- name),
+ name,
+ make_number (ev->cookie)),
XCDR (watch_object));
}
@@ -158,15 +158,17 @@
to_read = 0;
if (ioctl (fd, FIONREAD, &to_read) == -1)
- report_file_error ("Error while trying to retrieve file system events",
- Qnil);
+ xsignal1
+ (Qfile_notify_error,
+ build_string ("Error while trying to retrieve file system events"));
buffer = xmalloc (to_read);
n = read (fd, buffer, to_read);
if (n < 0)
{
xfree (buffer);
- report_file_error ("Error while trying to read file system events",
- Qnil);
+ xsignal1
+ (Qfile_notify_error,
+ build_string ("Error while trying to read file system events"));
}
EVENT_INIT (event);
@@ -242,7 +244,7 @@
else if (EQ (symb, Qt) || EQ (symb, Qall_events))
return IN_ALL_EVENTS;
else
- signal_error ("Unknown aspect", symb);
+ xsignal2 (Qfile_notify_error, build_string ("Unknown aspect"), symb);
}
static uint32_t
@@ -298,7 +300,7 @@
event. It gets passed a single argument EVENT which contains an event
structure
of the format
-(WATCH-DESCRIPTOR ASPECTS COOKIE NAME)
+(WATCH-DESCRIPTOR ASPECTS NAME COOKIE)
WATCH-DESCRIPTOR is the same object that was returned by this function. It can
be tested for equality using `equal'. ASPECTS describes the event. It is a
@@ -310,11 +312,11 @@
q-overflow
unmount
+If a directory is watched then NAME is the name of file that caused the event.
+
COOKIE is an object that can be compared using `equal' to identify two matching
renames (moved-from and moved-to).
-If a directory is watched then NAME is the name of file that caused the event.
-
See inotify(7) and inotify_add_watch(2) for further information. The inotify
fd
is managed internally and there is no corresponding inotify_init. Use
`inotify-rm-watch' to remove a watch.
@@ -335,8 +337,9 @@
if (inotifyfd == -1)
{
inotifyfd = uninitialized;
- report_file_error ("File watching feature (inotify) is not
available",
- Qnil);
+ xsignal1
+ (Qfile_notify_error,
+ build_string ("File watching feature (inotify) is not available"));
}
watch_list = Qnil;
add_read_fd (inotifyfd, &inotify_callback, NULL);
@@ -346,7 +349,8 @@
encoded_file_name = ENCODE_FILE (file_name);
watchdesc = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask);
if (watchdesc == -1)
- report_file_error ("Could not add watch for file", Fcons (file_name,
Qnil));
+ xsignal2 (Qfile_notify_error,
+ build_string ("Could not add watch for file"), file_name);
watch_descriptor = make_watch_descriptor (watchdesc);
@@ -375,8 +379,8 @@
int wd = XINT (watch_descriptor);
if (inotify_rm_watch (inotifyfd, wd) == -1)
- report_file_error ("Could not rm watch", Fcons (watch_descriptor,
- Qnil));
+ xsignal2 (Qfile_notify_error,
+ build_string ("Could not rm watch"), watch_descriptor);
/* Remove watch descriptor from watch list. */
watch_object = Fassoc (watch_descriptor, watch_list);
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2013-07-02 03:41:16 +0000
+++ b/src/lisp.h 2013-07-04 09:29:28 +0000
@@ -3809,6 +3809,7 @@
/* Defined in fileio.c. */
extern Lisp_Object Qfile_error;
+extern Lisp_Object Qfile_notify_error;
extern Lisp_Object Qfile_exists_p;
extern Lisp_Object Qfile_directory_p;
extern Lisp_Object Qinsert_file_contents;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113279: * fileio.c (Qfile_notify_error): New error symbol.,
Michael Albinus <=