diff options
| author | Eli Zaretskii | 2015-09-14 10:31:17 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-09-14 10:31:17 +0300 |
| commit | ef5b1a22bbeef239981dd6745abb4f08e2de54e0 (patch) | |
| tree | a5e8a7236328ebdd98b701e034c2a248c8783244 /src/w32notify.c | |
| parent | 12629d2857ba2a7c8a6b6a6b61f28a179d2c92a7 (diff) | |
| download | emacs-ef5b1a22bbeef239981dd6745abb4f08e2de54e0.tar.gz emacs-ef5b1a22bbeef239981dd6745abb4f08e2de54e0.zip | |
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.c | 29 |
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) | |||
| 464 | return flags; | 464 | return flags; |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | /* Like report_file_error, but reports a file-notify-error instead. */ | ||
| 468 | static void | ||
| 469 | report_w32notify_error (const char *string, Lisp_Object name) | ||
| 470 | { | ||
| 471 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); | ||
| 472 | synchronize_system_messages_locale (); | ||
| 473 | char *str = strerror (errno); | ||
| 474 | Lisp_Object errstring | ||
| 475 | = code_convert_string_norecord (build_unibyte_string (str), | ||
| 476 | Vlocale_coding_system, 0); | ||
| 477 | Lisp_Object errdata = Fcons (errstring, data); | ||
| 478 | |||
| 479 | xsignal (Qfile_notify_error, Fcons (build_string (string), errdata)); | ||
| 480 | } | ||
| 481 | |||
| 467 | DEFUN ("w32notify-add-watch", Fw32notify_add_watch, | 482 | DEFUN ("w32notify-add-watch", Fw32notify_add_watch, |
| 468 | Sw32notify_add_watch, 3, 3, 0, | 483 | Sw32notify_add_watch, 3, 3, 0, |
| 469 | doc: /* Add a watch for filesystem events pertaining to FILE. | 484 | doc: /* Add a watch for filesystem events pertaining to FILE. |
| @@ -528,8 +543,8 @@ generate notifications correctly, though. */) | |||
| 528 | || (w32_major_version == 5 && w32_major_version < 1)) | 543 | || (w32_major_version == 5 && w32_major_version < 1)) |
| 529 | { | 544 | { |
| 530 | errno = ENOSYS; | 545 | errno = ENOSYS; |
| 531 | report_file_error ("Watching filesystem events is not supported", | 546 | report_w32notify_error ("Watching filesystem events is not supported", |
| 532 | Qnil); | 547 | Qnil); |
| 533 | } | 548 | } |
| 534 | 549 | ||
| 535 | /* filenotify.el always passes us a directory, either the parent | 550 | /* filenotify.el always passes us a directory, either the parent |
| @@ -573,11 +588,11 @@ generate notifications correctly, though. */) | |||
| 573 | Vlocale_coding_system, 0); | 588 | Vlocale_coding_system, 0); |
| 574 | else | 589 | else |
| 575 | lisp_errstr = build_string (errstr); | 590 | lisp_errstr = build_string (errstr); |
| 576 | report_file_error ("Cannot watch file", | 591 | report_w32notify_error ("Cannot watch file", |
| 577 | Fcons (lisp_errstr, Fcons (file, Qnil))); | 592 | Fcons (lisp_errstr, Fcons (file, Qnil))); |
| 578 | } | 593 | } |
| 579 | else | 594 | else |
| 580 | report_file_error ("Cannot watch file", Fcons (file, Qnil)); | 595 | report_w32notify_error ("Cannot watch file", Fcons (file, Qnil)); |
| 581 | } | 596 | } |
| 582 | /* Store watch object in watch list. */ | 597 | /* Store watch object in watch list. */ |
| 583 | watch_descriptor = make_pointer_integer (dirwatch); | 598 | watch_descriptor = make_pointer_integer (dirwatch); |
| @@ -611,8 +626,8 @@ WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. */) | |||
| 611 | } | 626 | } |
| 612 | 627 | ||
| 613 | if (status == -1) | 628 | if (status == -1) |
| 614 | report_file_error ("Invalid watch descriptor", Fcons (watch_descriptor, | 629 | report_w32notify_error ("Invalid watch descriptor", Fcons (watch_descriptor, |
| 615 | Qnil)); | 630 | Qnil)); |
| 616 | 631 | ||
| 617 | return Qnil; | 632 | return Qnil; |
| 618 | } | 633 | } |