commit bfa1aa8e2bdaf14adbbf1e9e824051d3f740694c (HEAD, refs/remotes/origin/master) Author: Tassilo Horn Date: Tue Sep 22 10:19:25 2015 +0200 Improve last commit to process.c diff --git a/src/process.c b/src/process.c index 73704c0..42dd17c 100644 --- a/src/process.c +++ b/src/process.c @@ -5031,14 +5031,17 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, for (channel = 0; channel <= max_input_desc; ++channel) { struct fd_callback_data *d = &fd_callback_info[channel]; - if (d->func - && ((d->condition & FOR_READ - && FD_ISSET (channel, &Available)) - || (d->condition & FOR_WRITE - && FD_ISSET (channel, &write_mask)))) + if (d->func) { - d->func (channel, d->data); - FD_CLR (channel, &Available); + if (d->condition & FOR_READ + && FD_ISSET (channel, &Available)) + { + d->func (channel, d->data); + FD_CLR (channel, &Available); + } + else if (d->condition & FOR_WRITE + && FD_ISSET (channel, &write_mask)) + d->func (channel, d->data); } } commit 170ed29b438ed0d9f31f1cd1f2f6d9808540763d Author: Michael Albinus Date: Tue Sep 22 08:40:08 2015 +0200 Implement gfile-valid-p * lisp/filenotify.el (file-notify-callback): Fix typo. (gfile-valid-p): Remove defalias. * src/gfilenotify.c (dir_monitor_callback): Cancel the monitor if the file or directory to be watched is deleted. (Fgfile_add_watch): Make watch_object a triple. (Fgfile_rm_watch): Check, whether watch is cancelled already. (Fgfile_valid_p): New defun. (syms_of_gfilenotify): Declare Sgfile_valid_p. diff --git a/lisp/filenotify.el b/lisp/filenotify.el index b3490fd..e2c0af0 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el @@ -161,7 +161,7 @@ EVENT is the cadr of the event in `file-notify-handle-event' ((eq action 'attrib) 'attribute-changed) ((memq action '(create added)) 'created) ((memq action '(modify modified)) 'changed) - ((memq action '(delete 'delete-self move-self removed)) 'deleted) + ((memq action '(delete delete-self move-self removed)) 'deleted) ;; Make the event pending. ((memq action '(moved-from renamed-from)) (setq file-notify--pending-event @@ -359,9 +359,6 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'." desc)) (file-notify-error nil)))))) -;; Temporary declarations. -(defalias 'gfile-valid-p 'identity) - (defun file-notify-valid-p (descriptor) "Check a watch specified by its DESCRIPTOR. DESCRIPTOR should be an object returned by `file-notify-add-watch'." diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 5c6ebe6..1439666 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c @@ -29,6 +29,7 @@ along with GNU Emacs. If not, see . */ #include "process.h" +/* This is a list, elements are triples (DESCRIPTOR FILE CALLBACK) */ static Lisp_Object watch_list; /* This is the callback function for arriving signals from @@ -93,10 +94,17 @@ dir_monitor_callback (GFileMonitor *monitor, Fcons (symbol, Fcons (build_string (name), otail))), - XCDR (watch_object)); + XCAR (XCDR (XCDR (watch_object)))); /* Store it into the input event queue. */ kbd_buffer_store_event (&event); + + /* Cancel monitor if file or directory is deleted. */ + if (((event_type == G_FILE_MONITOR_EVENT_DELETED) || + (event_type == G_FILE_MONITOR_EVENT_MOVED)) && + (strcmp (name, SSDATA (XCAR (XCDR (watch_object)))) == 0) && + (!g_file_monitor_is_cancelled (monitor))) + g_file_monitor_cancel (monitor); } /* Cleanup. */ @@ -198,13 +206,13 @@ will be reported only in case of the `moved' event. */) (GCallback) dir_monitor_callback, NULL); /* Store watch object in watch list. */ - watch_object = Fcons (watch_descriptor, callback); + watch_object = list3 (watch_descriptor, file, callback); watch_list = Fcons (watch_object, watch_list); return watch_descriptor; } -DEFUN ("gfile-rm-watch", Fgfile_rm_watch, Sgfile_rm_watch, 1, 1, 0, +DEFUN ("gfile-rm-watc", Fgfile_rm_watch, Sgfile_rm_watch, 1, 1, 0, doc: /* Remove an existing WATCH-DESCRIPTOR. WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) @@ -218,11 +226,12 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) eassert (INTEGERP (watch_descriptor)); GFileMonitor *monitor = XINTPTR (watch_descriptor); - if (!g_file_monitor_cancel (monitor)) - xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"), - watch_descriptor); + if (!g_file_monitor_is_cancelled (monitor) && + !g_file_monitor_cancel (monitor)) + xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"), + watch_descriptor); - /* Remove watch descriptor from watch list. */ + /* Remove watch descriptor from watch list. */ watch_list = Fdelq (watch_object, watch_list); /* Cleanup. */ @@ -231,6 +240,27 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) return Qt; } +DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0, + doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. + +WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. + +A watch can become invalid if the file or directory it watches is +deleted, or if the watcher thread exits abnormally for any other +reason. Removing the watch by calling `gfile-rm-watch' also makes it +invalid. */) + (Lisp_Object watch_descriptor) +{ + Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); + if (NILP (watch_object)) + return Qnil; + else + { + GFileMonitor *monitor = XINTPTR (watch_descriptor); + return g_file_monitor_is_cancelled (monitor) ? Qnil : Qt; + } +} + void globals_of_gfilenotify (void) @@ -246,6 +276,7 @@ syms_of_gfilenotify (void) { defsubr (&Sgfile_add_watch); defsubr (&Sgfile_rm_watch); + defsubr (&Sgfile_valid_p); /* Filter objects. */ DEFSYM (Qwatch_mounts, "watch-mounts"); /* G_FILE_MONITOR_WATCH_MOUNTS */ commit 27f871907cc24f33a7d12ac3a4ab71a88f0bc554 Author: Tassilo Horn Date: Tue Sep 22 07:43:39 2015 +0200 Remove callback-handled channels from Available set * src/process.c (wait_reading_process_output): Remove channel from Available set if it is handled by a callback, e.g., dbus or inotify (bug#21313). diff --git a/src/process.c b/src/process.c index 55f31a0..73704c0 100644 --- a/src/process.c +++ b/src/process.c @@ -5036,7 +5036,10 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, && FD_ISSET (channel, &Available)) || (d->condition & FOR_WRITE && FD_ISSET (channel, &write_mask)))) - d->func (channel, d->data); + { + d->func (channel, d->data); + FD_CLR (channel, &Available); + } } for (channel = 0; channel <= max_process_desc; channel++) commit 084b8af8e0bddadfca840b7439e10fdf44d1b22a Author: Mark Oteiza Date: Mon Sep 21 16:45:58 2015 -0400 Use lunate epsilon for TeX \epsilon * lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist): Add \varepsilon using GREEK SMALL LETTER EPSILON, and change \epsilon to use GREEK LUNATE EPSILON SYMBOL diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 0a4e070..25ffb5e 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2955,7 +2955,7 @@ There might be text before point." ("\\beta" . ?β) ("\\gamma" . ?γ) ("\\delta" . ?δ) - ("\\epsilon" . ?ε) + ("\\epsilon" . ?ϵ) ("\\zeta" . ?ζ) ("\\eta" . ?η) ("\\theta" . ?θ) @@ -3358,6 +3358,7 @@ There might be text before point." ("\\urcorner" . ?⌝) ("\\u{i}" . ?ĭ) ("\\vDash" . ?⊨) + ("\\varepsilon" . ?ε) ("\\varprime" . ?′) ("\\varpropto" . ?∝) ("\\varrho" . ?ϱ) commit 7760f32c1f5678bda97376d7bcb1153b9570320f Author: Stefan Monnier Date: Mon Sep 21 16:22:17 2015 -0400 * lisp/progmodes/prolog.el: Fix nested electric if-then-else * lisp/progmodes/prolog.el (prolog-find-unmatched-paren): Use innermost rather than outermost paren (bug#21526). diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 24ac8d7..8c02e54 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -2081,7 +2081,7 @@ Argument BOUND is a buffer position limiting searching." (defun prolog-find-unmatched-paren () "Return the column of the last unmatched left parenthesis." (save-excursion - (goto-char (or (car (nth 9 (syntax-ppss))) (point-min))) + (goto-char (or (nth 1 (syntax-ppss)) (point-min))) (current-column))) commit e3a6246eff4a793171511f32e9c6877faa2f6f3e Author: Paul Eggert Date: Mon Sep 21 11:56:01 2015 -0700 Improve git diff hunk headers for .el, .texi Problem reported by Alan Mackenzie in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00826.html * .gitattributes (*.el, *.texi): New patterns. * autogen.sh: Configure diff.elisp.xfuncname and diff.texinfo.xfuncname if using Git. diff --git a/.gitattributes b/.gitattributes index 21af4e6..ac26a2b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -44,3 +44,7 @@ doc/misc/texinfo.tex -whitespace=blank-at-eol *.sig binary *.tiff binary etc/e/eterm-color binary + +# Hooks for non-default diff hunk headers; see autogen.sh. +*.el diff=elisp +*.texi diff=texinfo diff --git a/autogen.sh b/autogen.sh index bc9c5a0..926915c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -216,8 +216,20 @@ autoreconf -fi -I m4 || exit $? ## cause 'make' to needlessly run 'autoheader'. echo timestamp > src/stamp-h.in || exit -## Install Git hooks, if using Git. -if test -d .git/hooks; then + +## Configure Git, if using Git. +if test -d .git; then + + # Configure 'git diff' hunk header format. + + git config 'diff.elisp.xfuncname' \ + '^\(def[^[:space:]]+[[:space:]]+([^()[:space:]]+)' || exit + git config 'diff.texinfo.xfuncname' \ + '^@node[[:space:]]+([^,[:space:]][^,]+)' || exit + + + # Install Git hooks. + tailored_hooks= sample_hooks= commit db828f62f6f17414fbbc3206dac123dc73dd6055 Author: Eli Zaretskii Date: Mon Sep 21 19:51:20 2015 +0300 Don't rely on defaults in decoding UTF-8 encoded Lisp files * lisp/replace.el: * lisp/textmodes/rst.el: * lisp/whitespace.el: Add an explicit UTF-8 encoding tag. diff --git a/lisp/replace.el b/lisp/replace.el index 3a908ac..d84f3a2 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1,4 +1,4 @@ -;;; replace.el --- replace commands for Emacs +;;; replace.el --- replace commands for Emacs -*- coding: utf-8 -*- ;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2015 Free ;; Software Foundation, Inc. diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 0ff1d72..fb96c6c 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -2446,7 +2446,7 @@ of ENTRY-LIST is a list of cons cells (\"MACRONAME\" . LEVEL). See ;;;*** -;;;### (autoloads nil "reftex-cite" "reftex-cite.el" "43a3f05c024aee5b7708420f74266933") +;;;### (autoloads nil "reftex-cite" "reftex-cite.el" "751df6ee674ea533b755e8cda4ad1cf8") ;;; Generated autoloads from reftex-cite.el (autoload 'reftex-default-bibliography "reftex-cite" "\ diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 581e16e..4c234c9 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -4235,4 +4235,8 @@ column is used (fill-column vs. end of previous/next line)." (provide 'rst) +;; Local Variables: +;; coding: utf-8 +;; End: + ;;; rst.el ends here diff --git a/lisp/whitespace.el b/lisp/whitespace.el index d45a1dc..839ca8c 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2581,5 +2581,8 @@ It should be added buffer-locally to `write-file-functions'." (run-hooks 'whitespace-load-hook) +;; Local Variables: +;; coding: utf-8 +;; End: ;;; whitespace.el ends here commit 818fc6e128491de6bc5d630f6c9c8adf969e3ea8 Author: Paul Eggert Date: Mon Sep 21 07:58:41 2015 -0700 Clarify or replace a few \u escapes. * doc/lispref/nonascii.texi (Character Properties) More-detailed commentary for \u escapes. * lisp/progmodes/python.el (python--prettify-symbols-alist): * lisp/replace.el (query-replace-from-to-separator): * lisp/textmodes/rst.el (rst-bullets, rst-re-alist-def) (rst-mode-syntax-table): * lisp/whitespace.el (whitespace-display-mappings): Prefer actual character to \u escape when this makes the code easier to follow in the usual case where Unicode chars can be displayed. diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index fb76de1..3351b84 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -583,17 +583,17 @@ This function returns the value of @var{char}'s @var{propname} property. @result{} Nd @end group @group -;; subscript 4 +;; U+2084 SUBSCRIPT FOUR (get-char-code-property ?\u2084 'digit-value) @result{} 4 @end group @group -;; one fifth +;; U+2155 VULGAR FRACTION ONE FIFTH (get-char-code-property ?\u2155 'numeric-value) @result{} 0.2 @end group @group -;; Roman IV +;; U+2163 ROMAN NUMERAL FOUR (get-char-code-property ?\u2163 'numeric-value) @result{} 4 @end group diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4fdf2ca..b641e30 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -621,9 +621,9 @@ The type returned can be `comment', `string' or `paren'." (0 (ignore (python-syntax-stringify)))))) (defconst python--prettify-symbols-alist - '(("lambda" . ?\u03bb) - ("and" . ?\u2227) - ("or" . ?\u2228))) + '(("lambda" . ?λ) + ("and" . ?∧) + ("or" . ?∨))) (defsubst python-syntax-count-quotes (quote-char &optional point limit) "Count number of quotes around point (max is 3). diff --git a/lisp/replace.el b/lisp/replace.el index 37e97e2..3a908ac 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -76,7 +76,7 @@ to the minibuffer that reads the string to replace, or invoke replacements from Isearch by using a key sequence like `C-s C-s M-%'." "24.3") (defcustom query-replace-from-to-separator - (propertize (if (char-displayable-p ?\u2192) " \u2192 " " -> ") + (propertize (if (char-displayable-p ?→) " → " " -> ") 'face 'minibuffer-prompt) "String that separates FROM and TO in the history of replacement pairs." ;; Avoids error when attempt to autoload char-displayable-p fails diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index e6bfe5f..581e16e 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -296,7 +296,7 @@ in parentheses follows the development revision and the time stamp.") ;; syntax. (defconst rst-bullets ;; Sorted so they can form a character class when concatenated. - '(?- ?* ?+ ?\u2022 ?\u2023 ?\u2043) + '(?- ?* ?+ ?• ?‣ ?⁃) "List of all possible bullet characters for bulleted lists.") (defconst rst-uri-schemes @@ -392,8 +392,8 @@ in parentheses follows the development revision and the time stamp.") ; item tag. ;; Inline markup (`ilm') - (ilm-pfx (:alt "^" hws-prt "[-'\"([{<\u2018\u201c\u00ab\u2019/:]")) - (ilm-sfx (:alt "$" hws-prt "[]-'\")}>\u2019\u201d\u00bb/:.,;!?\\]")) + (ilm-pfx (:alt "^" hws-prt "[-'\"([{<‘“«’/:]")) + (ilm-sfx (:alt "$" hws-prt "[]-'\")}>’”»/:.,;!?\\]")) ;; Inline markup content (`ilc') (ilcsgl-tag "\\S ") ; A single non-white character. @@ -778,12 +778,12 @@ This inherits from Text mode.") (modify-syntax-entry ?\\ "\\" st) (modify-syntax-entry ?_ "." st) (modify-syntax-entry ?| "." st) - (modify-syntax-entry ?\u00ab "." st) - (modify-syntax-entry ?\u00bb "." st) - (modify-syntax-entry ?\u2018 "." st) - (modify-syntax-entry ?\u2019 "." st) - (modify-syntax-entry ?\u201c "." st) - (modify-syntax-entry ?\u201d "." st) + (modify-syntax-entry ?« "." st) + (modify-syntax-entry ?» "." st) + (modify-syntax-entry ?‘ "." st) + (modify-syntax-entry ?’ "." st) + (modify-syntax-entry ?“ "." st) + (modify-syntax-entry ?” "." st) st) "Syntax table used while in `rst-mode'.") diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 0c20850..d45a1dc 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -891,22 +891,22 @@ Used when `whitespace-style' includes `lines' or `lines-tail'." ;; Hacked from `visible-whitespace-mappings' in visws.el (defcustom whitespace-display-mappings '( - (space-mark ?\ [?\u00B7] [?.]) ; space - centered dot - (space-mark ?\xA0 [?\u00A4] [?_]) ; hard space - currency + (space-mark ?\ [?·] [?.]) ; space - middle dot + (space-mark ?\xA0 [?¤] [?_]) ; hard space - currency sign ;; NEWLINE is displayed using the face `whitespace-newline' (newline-mark ?\n [?$ ?\n]) ; eol - dollar sign - ;; (newline-mark ?\n [?\u21B5 ?\n] [?$ ?\n]) ; eol - downwards arrow - ;; (newline-mark ?\n [?\u00B6 ?\n] [?$ ?\n]) ; eol - pilcrow - ;; (newline-mark ?\n [?\u00AF ?\n] [?$ ?\n]) ; eol - overscore - ;; (newline-mark ?\n [?\u00AC ?\n] [?$ ?\n]) ; eol - negation - ;; (newline-mark ?\n [?\u00B0 ?\n] [?$ ?\n]) ; eol - degrees + ;; (newline-mark ?\n [?↵ ?\n] [?$ ?\n]) ; eol - downwards arrow + ;; (newline-mark ?\n [?¶ ?\n] [?$ ?\n]) ; eol - pilcrow + ;; (newline-mark ?\n [?¯ ?\n] [?$ ?\n]) ; eol - overscore + ;; (newline-mark ?\n [?¬ ?\n] [?$ ?\n]) ; eol - negation + ;; (newline-mark ?\n [?° ?\n] [?$ ?\n]) ; eol - degrees ;; ;; WARNING: the mapping below has a problem. ;; When a TAB occupies exactly one column, it will display the ;; character ?\xBB at that column followed by a TAB which goes to ;; the next TAB column. ;; If this is a problem for you, please, comment the line below. - (tab-mark ?\t [?\u00BB ?\t] [?\\ ?\t]) ; tab - left quote mark + (tab-mark ?\t [?» ?\t] [?\\ ?\t]) ; tab - right guillemet ) "Specify an alist of mappings for displaying characters. commit cf91ea794be50c2d3c572726b1d4e53ab92da506 Author: Paul Eggert Date: Mon Sep 21 07:45:31 2015 -0700 Pacify GCC -Wmaybe-uninitialized in xdisp.c * src/xdisp.c (face_before_or_after_it_pos): Use do-while rather than while loop to avoid GCC -Wmaybe-uninitialized diagnostic with charpos. The loop should always execute at least once anyway. diff --git a/src/xdisp.c b/src/xdisp.c index 34b5ca3..0d0bc91 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4024,13 +4024,16 @@ face_before_or_after_it_pos (struct it *it, bool before_p) SAVE_IT (it_copy, *it, it_copy_data); IT_STRING_CHARPOS (it_copy) = 0; bidi_init_it (0, 0, FRAME_WINDOW_P (it_copy.f), &it_copy.bidi_it); - while (IT_STRING_CHARPOS (it_copy) != IT_STRING_CHARPOS (*it)) + + do { charpos = IT_STRING_CHARPOS (it_copy); if (charpos >= SCHARS (it->string)) break; bidi_move_to_visually_next (&it_copy.bidi_it); } + while (IT_STRING_CHARPOS (it_copy) != IT_STRING_CHARPOS (*it)); + RESTORE_IT (it, it, it_copy_data); } else commit aeb17b60f9d41a40b1b5b9a7817d31bd0cb2c3c0 Author: Tassilo Horn Date: Mon Sep 21 16:09:17 2015 +0200 Signal error on invalid regexp * lisp/textmodes/reftex-cite.el (reftex-extract-bib-entries): Signal an error when the user tries searching with a regexp matching the empty string. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 173c8a8..8f3f2cc 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -210,7 +210,9 @@ Return list with entries." (setq first-re (car re-list) ; We'll use the first re to find things, rest-re (cdr re-list)) ; the others to narrow down. (if (string-match "\\`[ \t]*\\'" (or first-re "")) - (error "Empty regular expression")) + (user-error "Empty regular expression")) + (if (string-match first-re "") + (user-error "Regular expression matches the empty string.")) (save-excursion (save-window-excursion commit d443345b13ccb761257878217d10d6881eabaac6 Author: Eli Zaretskii Date: Mon Sep 21 16:29:43 2015 +0300 Another fix of file-notify-tests for w32notify * test/automated/file-notify-tests.el (file-notify-test02-events): Further adaptation for w32notify: reduce the number of expected 'changed' events. (Bug#21435) diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 75e0c24..569f946 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el @@ -285,7 +285,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." ;; w32notify does not distinguish between `changed' and ;; `attribute-changed'. (if (eq file-notify--library 'w32notify) - '(created changed changed changed deleted) + '(created changed changed deleted) '(created changed deleted)) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -327,7 +327,7 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." (should (equal (mapcar #'cadr file-notify--test-events) (if (eq file-notify--library 'w32notify) '(created changed deleted - created changed changed changed deleted + created changed changed deleted created changed renamed) '(created changed deleted created changed deleted commit 01b547529ba81f4f5a64f5017a2c3d6601d0bb95 Author: Michael Albinus Date: Mon Sep 21 15:07:06 2015 +0200 Adapt tests and manual for w32notify * doc/lispref/os.texi (File Notifications): w32notify does not send `attribute-changed' events. * test/automated/file-notify-tests.el (file-notify--test-with-events): Simplify parameters. Adapt all callees. (file-notify-test02-events): w32notify does not send `attribute-changed' events. (file-notify-test04-file-validity, file-notify-test05-dir-validity): Do not skip in case of w32notify. Simply ignore this part of the test. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index f5eecb2..1d0723e 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -2565,7 +2565,7 @@ specification prior to @samp{"1.0"}. Several operating systems support watching of filesystems for changes of files. If configured properly, Emacs links a respective library -like @file{gfilenotify}, @file{inotify}, or @file{w32notify} +like @file{gfilenotify}, @file{inotify}, or @file{w32notify} statically. These libraries enable watching of filesystems on the local machine. @@ -2632,6 +2632,11 @@ any one of the following symbols: a @var{file} attribute was changed @end table +Note that the @file{w32notify} library does not report +@code{attribute-changed} events. Even in case a file attribute has +changed, like permissions or modification time, this library reports a +@code{changed} event. + @var{file} and @var{file1} are the name of the file(s) whose event is being reported. For example: diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 9d66f03..75e0c24 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el @@ -245,17 +245,17 @@ TIMEOUT is the maximum time to wait for, in seconds." (while (null ,until) (read-event nil nil 0.1)))) -(defmacro file-notify--test-with-events (n timeout assert-fn &rest body) - "Run BODY collecting N events and then run ASSERT-FN. +(defmacro file-notify--test-with-events (timeout events &rest body) + "Run BODY collecting events and then compare with EVENTS. Don't wait longer than TIMEOUT seconds for the events to be delivered." - (declare (indent 3)) + (declare (indent 2)) (let ((outer (make-symbol "outer"))) `(let ((,outer file-notify--test-events)) (let (file-notify--test-events) ,@body (file-notify--wait-for-events - ,timeout (= ,n (length file-notify--test-events))) - (funcall ,assert-fn file-notify--test-events) + ,timeout (= (length ,events) (length file-notify--test-events))) + (should (equal ,events (mapcar #'cadr file-notify--test-events))) (setq ,outer (append ,outer file-notify--test-events))) (setq file-notify--test-events ,outer)))) @@ -274,67 +274,65 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." ;; Check creation, change, and deletion. (file-notify--test-with-events - 3 (file-notify--test-timeout) - (lambda (events) - (should (equal '(created changed deleted) - (mapcar #'cadr events)))) + (file-notify--test-timeout) '(created changed deleted) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) (delete-file file-notify--test-tmpfile)) ;; Check copy. (file-notify--test-with-events - 3 (file-notify--test-timeout) - (lambda (events) - (should (equal '(created changed deleted) - (mapcar #'cadr events)))) + (file-notify--test-timeout) + ;; w32notify does not distinguish between `changed' and + ;; `attribute-changed'. + (if (eq file-notify--library 'w32notify) + '(created changed changed changed deleted) + '(created changed deleted)) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) ;; The next two events shall not be visible. (set-file-modes file-notify--test-tmpfile 000) + (read-event nil nil 0.1) ; In order to distinguish the events. (set-file-times file-notify--test-tmpfile '(0 0)) (delete-file file-notify--test-tmpfile) (delete-file file-notify--test-tmpfile1)) ;; Check rename. (file-notify--test-with-events - 3 (file-notify--test-timeout) - (lambda (events) - (should (equal '(created changed renamed) - (mapcar #'cadr events)))) + (file-notify--test-timeout) '(created changed renamed) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) ;; After the rename, we won't get events anymore. (delete-file file-notify--test-tmpfile1)) - ;; Check attribute change. - (file-notify-rm-watch file-notify--test-desc) - (setq file-notify--test-desc - (file-notify-add-watch - file-notify--test-tmpfile - '(attribute-change) 'file-notify--test-event-handler)) - (file-notify--test-with-events - 2 (file-notify--test-timeout) - (lambda (events) - (should (equal '(attribute-changed attribute-changed) - (mapcar #'cadr events)))) - (write-region - "any text" nil file-notify--test-tmpfile nil 'no-message) - (set-file-modes file-notify--test-tmpfile 000) - (read-event nil nil 0.1) ; In order to distinguish the events. - (set-file-times file-notify--test-tmpfile '(0 0)) - (delete-file file-notify--test-tmpfile)) + ;; Check attribute change. It doesn't work for w32notify. + (unless (eq file-notify--library 'w32notify) + (file-notify-rm-watch file-notify--test-desc) + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(attribute-change) 'file-notify--test-event-handler)) + (file-notify--test-with-events + (file-notify--test-timeout) '(attribute-changed attribute-changed) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (set-file-modes file-notify--test-tmpfile 000) + (read-event nil nil 0.1) ; In order to distinguish the events. + (set-file-times file-notify--test-tmpfile '(0 0)) + (delete-file file-notify--test-tmpfile))) ;; Check the global sequence again just to make sure that ;; `file-notify--test-events' has been set correctly. (should (equal (mapcar #'cadr file-notify--test-events) - '(created changed deleted - created changed deleted - created changed renamed - attribute-changed attribute-changed))) - + (if (eq file-notify--library 'w32notify) + '(created changed deleted + created changed changed changed deleted + created changed renamed) + '(created changed deleted + created changed deleted + created changed renamed + attribute-changed attribute-changed)))) (should file-notify--test-results) (dolist (result file-notify--test-results) ;;(message "%s" (ert-test-result-messages result)) @@ -414,15 +412,12 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." (unwind-protect (progn (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) - (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) - #'file-notify--test-event-handler)) + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'file-notify--test-event-handler)) (file-notify--test-with-events - 2 (file-notify--test-timeout) - (lambda (events) - (should (equal '(created changed) - (mapcar #'cadr events)))) + (file-notify--test-timeout) '(created changed) (should (file-notify-valid-p file-notify--test-desc)) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -435,33 +430,30 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." ;; Cleanup. (file-notify--test-cleanup)) - ;; The batch-mode operation of w32notify is fragile (there's no - ;; input threads to send the message to). - (skip-unless (not (and noninteractive (eq file-notify--library 'w32notify)))) (unwind-protect - (let ((temporary-file-directory (make-temp-file - "file-notify-test-parent" t))) - (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) - (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) - #'file-notify--test-event-handler)) - (file-notify--test-with-events - 2 (file-notify--test-timeout) - (lambda (events) - (should (equal '(created changed) - (mapcar #'cadr events)))) - (should (file-notify-valid-p file-notify--test-desc)) - (write-region - "any text" nil file-notify--test-tmpfile nil 'no-message) - (should (file-notify-valid-p file-notify--test-desc))) - ;; After deleting the parent, the descriptor must not be valid - ;; anymore. - (delete-directory temporary-file-directory t) - (file-notify--wait-for-events - (file-notify--test-timeout) - (not (file-notify-valid-p file-notify--test-desc))) - (should-not (file-notify-valid-p file-notify--test-desc))) + ;; The batch-mode operation of w32notify is fragile (there's no + ;; input threads to send the message to). + (unless (and noninteractive (eq file-notify--library 'w32notify)) + (let ((temporary-file-directory (make-temp-file + "file-notify-test-parent" t))) + (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'file-notify--test-event-handler)) + (file-notify--test-with-events + (file-notify--test-timeout) '(created changed) + (should (file-notify-valid-p file-notify--test-desc)) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (should (file-notify-valid-p file-notify--test-desc))) + ;; After deleting the parent, the descriptor must not be valid + ;; anymore. + (delete-directory temporary-file-directory t) + (file-notify--wait-for-events + (file-notify--test-timeout) + (not (file-notify-valid-p file-notify--test-desc))) + (should-not (file-notify-valid-p file-notify--test-desc)))) ;; Cleanup. (file-notify--test-cleanup))) @@ -478,10 +470,10 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." (setq file-notify--test-tmpfile (file-name-as-directory (file-notify--test-make-temp-name))) (make-directory file-notify--test-tmpfile) - (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) - #'file-notify--test-event-handler)) + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'file-notify--test-event-handler)) (should (file-notify-valid-p file-notify--test-desc)) ;; After removing the watch, the descriptor must not be valid ;; anymore. @@ -491,18 +483,17 @@ Don't wait longer than TIMEOUT seconds for the events to be delivered." ;; Cleanup. (file-notify--test-cleanup)) - ;; The batch-mode operation of w32notify is fragile (there's no - ;; input threads to send the message to). - (skip-unless (not (and noninteractive (eq file-notify--library 'w32notify)))) (unwind-protect - (progn + ;; The batch-mode operation of w32notify is fragile (there's no + ;; input threads to send the message to). + (unless (and noninteractive (eq file-notify--library 'w32notify)) (setq file-notify--test-tmpfile (file-name-as-directory (file-notify--test-make-temp-name))) (make-directory file-notify--test-tmpfile) - (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) - #'file-notify--test-event-handler)) + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'file-notify--test-event-handler)) (should (file-notify-valid-p file-notify--test-desc)) ;; After deleting the directory, the descriptor must not be ;; valid anymore. commit 127bafdc6dcbcf4b11bff7ec52960bd941613a1c Author: Dima Kogan Date: Mon Sep 21 13:54:21 2015 +0300 Fix setting breakpoints when remote-debugging * lisp/progmodes/gud.el (gud-format-command): Send localized file names to the debugger running on the remote. (Bug#13304) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 9ab0667..8b5d490 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -2855,6 +2855,11 @@ Obeying it means displaying in another window the specified file and line." (defun gud-format-command (str arg) (let ((insource (not (eq (current-buffer) gud-comint-buffer))) (frame (or gud-last-frame gud-last-last-frame)) + (buffer-file-name-localized + (if (and (buffer-file-name) (file-remote-p (buffer-file-name))) + (tramp-file-name-localname (tramp-dissect-file-name + (buffer-file-name) t)) + (buffer-file-name))) result) (while (and str (let ((case-fold-search nil)) @@ -2864,15 +2869,15 @@ Obeying it means displaying in another window the specified file and line." (cond ((eq key ?f) (setq subst (file-name-nondirectory (if insource - (buffer-file-name) + buffer-file-name-localized (car frame))))) ((eq key ?F) (setq subst (file-name-base (if insource - (buffer-file-name) + buffer-file-name-localized (car frame))))) ((eq key ?d) (setq subst (file-name-directory (if insource - (buffer-file-name) + buffer-file-name-localized (car frame))))) ((eq key ?l) (setq subst (int-to-string commit 0a893f0cfa166d7f17d982c3f0503dff2be25f62 Author: Nicolas Petton Date: Sun Sep 13 16:18:24 2015 +0200 Better docstring and parameter name for seq-find * lisp/emacs-lisp/seq.el (seq-find): Improve the docstring and rename the parameter `sentinel' to `default'. * doc/lispref/sequences.texi (Sequence Functions): Update the documentation for `seq-find' accordingly. diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 6292c02..b85d5d4 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -578,15 +578,14 @@ value is the value returned by @var{predicate}. @end example @end defun -@defun seq-find predicate sequence &optional sentinel +@defun seq-find predicate sequence &optional default This function returns the first element for which @var{predicate} returns non-@code{nil} in @var{sequence}. If no element matches -@var{predicate}, @var{sentinel} is returned if non-@code{nil}, -@code{nil} otherwise. +@var{predicate}, @var{default} is returned. Note that this function has an ambiguity if the found element is -@code{nil}, and if no @var{sentinel} is specified, as it cannot be -known if an element was found or not. +identical to @var{default}, as it cannot be known if an element was +found or not. @example @group diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 4b50a0a..e0f17c0 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -270,18 +270,18 @@ If so, return the non-nil value returned by PRED." (throw 'seq--break result)))) nil)) -(cl-defgeneric seq-find (pred seq &optional sentinel) +(cl-defgeneric seq-find (pred seq &optional default) "Return the first element for which (PRED element) is non-nil in SEQ. -If no element is found, return SENTINEL or nil. +If no element is found, return DEFAULT. -Note that `seq-find' has an ambiguity if the found element is nil -and if no SENTINEL is specified, as it cannot be known if an -element was found or not." +Note that `seq-find' has an ambiguity if the found element is +identical to DEFAULT, as it cannot be known if an element was +found or not." (catch 'seq--break (seq-doseq (elt seq) (when (funcall pred elt) (throw 'seq--break elt))) - sentinel)) + default)) (cl-defgeneric seq-count (pred seq) "Return the number of elements for which (PRED element) is non-nil in SEQ." commit e2f0dd2f49d8638d20615bfa38e95a71202dd543 Author: Eli Zaretskii Date: Mon Sep 21 12:35:26 2015 +0300 Avoid infinite recursion while displaying box face * src/xdisp.c (face_before_or_after_it_pos): Fix calculation of the previous string/buffer character position under bidi iteration. (Bug#21428) diff --git a/src/xdisp.c b/src/xdisp.c index 3eff61f..34b5ca3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4014,21 +4014,23 @@ face_before_or_after_it_pos (struct it *it, bool before_p) /* With bidi iteration, the character before the current in the visual order cannot be found by simple iteration, because "reverse" reordering is not - supported. Instead, we need to use the move_it_* - family of functions. */ + supported. Instead, we need to start from the string + beginning and go all the way to the current string + position, remembering the previous position. */ /* Ignore face changes before the first visible character on this display line. */ if (it->current_x <= it->first_visible_x) return it->face_id; SAVE_IT (it_copy, *it, it_copy_data); - /* Implementation note: Since move_it_in_display_line - works in the iterator geometry, and thinks the first - character is always the leftmost, even in R2L lines, - we don't need to distinguish between the R2L and L2R - cases here. */ - move_it_in_display_line (&it_copy, SCHARS (it_copy.string), - it_copy.current_x - 1, MOVE_TO_X); - charpos = IT_STRING_CHARPOS (it_copy); + IT_STRING_CHARPOS (it_copy) = 0; + bidi_init_it (0, 0, FRAME_WINDOW_P (it_copy.f), &it_copy.bidi_it); + while (IT_STRING_CHARPOS (it_copy) != IT_STRING_CHARPOS (*it)) + { + charpos = IT_STRING_CHARPOS (it_copy); + if (charpos >= SCHARS (it->string)) + break; + bidi_move_to_visually_next (&it_copy.bidi_it); + } RESTORE_IT (it, it, it_copy_data); } else @@ -4108,11 +4110,15 @@ face_before_or_after_it_pos (struct it *it, bool before_p) { if (before_p) { + int current_x; + /* With bidi iteration, the character before the current in the visual order cannot be found by simple iteration, because "reverse" reordering is not supported. Instead, we need to use the move_it_* - family of functions. */ + family of functions, and move to the previous + character starting from the beginning of the visual + line. */ /* Ignore face changes before the first visible character on this display line. */ if (it->current_x <= it->first_visible_x) @@ -4123,8 +4129,9 @@ face_before_or_after_it_pos (struct it *it, bool before_p) character is always the leftmost, even in R2L lines, we don't need to distinguish between the R2L and L2R cases here. */ - move_it_in_display_line (&it_copy, ZV, - it_copy.current_x - 1, MOVE_TO_X); + current_x = it_copy.current_x; + move_it_vertically_backward (&it_copy, 0); + move_it_in_display_line (&it_copy, ZV, current_x - 1, MOVE_TO_X); pos = it_copy.current.pos; RESTORE_IT (it, it, it_copy_data); }