commit 543532313a1d9570d6a74a7846b4e776a2282964 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Dec 30 11:36:07 2016 +0200 Attempt to fix crashes with threads in GTK builds * src/xgselect.c (xg_select): Call pselect via thread_select, not directly, to avoid running Lisp (via unblock_input) when more than one thread could be running. (Bug#25247) * src/process.c (wait_reading_process_output) [HAVE_GLIB]: Call xg_select directly instead of through thread_select. * src/xgselect.h (xg_select): Last 2 arguments are no longer 'const', for consistency with thread_select. diff --git a/src/process.c b/src/process.c index c5a46f992d..c0c52c232b 100644 --- a/src/process.c +++ b/src/process.c @@ -5341,18 +5341,23 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, } #endif +/* HAVE_GLIB builds call thread_select in xgselect.c. */ +#ifdef HAVE_GLIB + nfds = xg_select (max_desc + 1, + &Available, (check_write ? &Writeok : 0), + NULL, &timeout, NULL); +#else /* !HAVE_GLIB */ nfds = thread_select ( -#if defined (HAVE_NS) +# ifdef HAVE_NS ns_select -#elif defined (HAVE_GLIB) - xg_select -#else +# else pselect -#endif +# endif , max_desc + 1, &Available, (check_write ? &Writeok : 0), NULL, &timeout, NULL); +#endif /* !HAVE_GLIB */ #ifdef HAVE_GNUTLS /* GnuTLS buffers data internally. In lowat mode it leaves diff --git a/src/xgselect.c b/src/xgselect.c index a9461a5df5..c73ef7ce5f 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see . */ #include #include +#include "lisp.h" #include "blockinput.h" #include "systime.h" @@ -41,11 +42,11 @@ along with GNU Emacs. If not, see . */ int xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, - struct timespec const *timeout, sigset_t const *sigmask) + struct timespec *timeout, sigset_t *sigmask) { fd_set all_rfds, all_wfds; struct timespec tmo; - struct timespec const *tmop = timeout; + struct timespec *tmop = timeout; GMainContext *context; bool have_wfds = wfds != NULL; @@ -113,9 +114,9 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, } fds_lim = max_fds + 1; - nfds = pselect (fds_lim, &all_rfds, have_wfds ? &all_wfds : NULL, - efds, tmop, sigmask); - + nfds = thread_select (pselect, fds_lim, + &all_rfds, have_wfds ? &all_wfds : NULL, efds, + tmop, sigmask); if (nfds < 0) retval = nfds; else if (nfds > 0) diff --git a/src/xgselect.h b/src/xgselect.h index 4c56633e96..a56694229e 100644 --- a/src/xgselect.h +++ b/src/xgselect.h @@ -27,7 +27,6 @@ struct timespec; extern int xg_select (int max_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, - struct timespec const *timeout, - sigset_t const *sigmask); + struct timespec *timeout, sigset_t *sigmask); #endif /* XGSELECT_H */ commit d9b126890dd729e18cb5522c38f33fc70daadd79 Author: Arash Esbati Date: Fri Dec 30 07:44:41 2016 +0100 Add entry for biblatex * lisp/textmodes/reftex-vars.el (reftex-cite-format-builtin): Add entry for biblatex macros. diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index d6de53b246..11dcdd5a18 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el @@ -151,6 +151,22 @@ distribution. Mixed-case symbols are convenience aliases.") (?A . "\\citeauthor*{%l}") (?y . "\\citeyear{%l}") (?n . "\\nocite{%l}"))) + (biblatex "The Biblatex package" + ((?\C-m . "\\cite[][]{%l}") + (?C . "\\cite*[][]{%l}") + (?t . "\\textcite[][]{%l}") + (?T . "\\textcite*[][]{%l}") + (?p . "\\parencite[][]{%l}") + (?P . "\\parencite*[][]{%l}") + (?f . "\\footcite[][]{%l}") + (?s . "\\smartcite[][]{%l}") + (?u . "\\autocite[][]{%l}") + (?U . "\\autocite*[][]{%l}") + (?a . "\\citeauthor{%l}") + (?A . "\\citeauthor*{%l}") + (?y . "\\citeyear{%l}") + (?Y . "\\citeyear*{%l}") + (?n . "\\nocite{%l}"))) (amsrefs "The AMSRefs package" ((?\C-m . "\\cite{%l}") (?p . "\\cite{%l}") commit c336420d9f2ffe5270d7deec360d84e1f45b4a55 Author: Tino Calancha Date: Fri Dec 30 15:31:01 2016 +0900 ffap-string-at-point: Limit max length of active region Prevents that 'ffap-guesser' waste time checking large strings which are likely not valid candidates (Bug#25243). * lisp/ffap.el (ffap-max-region-length): New variable. (ffap-string-at-point): Use it. * test/lisp/ffap-tests.el: New test suite. (ffap-tests-25243): Add test for this bug. diff --git a/lisp/ffap.el b/lisp/ffap.el index 3d7cebadcf..99bb65faaf 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -203,6 +203,11 @@ Sensible values are nil, \"news\", or \"mailto\"." ) :group 'ffap) +(defvar ffap-max-region-length 1024 + "Maximum active region length. +When the region is active and larger than this value, +`ffap-string-at-point' returns an empty string.") + ;;; Peanut Gallery (More User Variables): ;; @@ -1101,8 +1106,10 @@ MODE (defaults to value of `major-mode') is a symbol used to look up string syntax parameters in `ffap-string-at-point-mode-alist'. If MODE is not found, we use `file' instead of MODE. If the region is active, return a string from the region. -Sets the variable `ffap-string-at-point' and the variable -`ffap-string-at-point-region'." +Set the variable `ffap-string-at-point' and the variable +`ffap-string-at-point-region'. +When the region is active and larger than `ffap-max-region-length', +return an empty string, and set `ffap-string-at-point-region' to '(1 1)." (let* ((args (cdr (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) @@ -1119,11 +1126,15 @@ Sets the variable `ffap-string-at-point' and the variable (save-excursion (skip-chars-forward (car args)) (skip-chars-backward (nth 2 args) pt) - (point))))) - (setq ffap-string-at-point - (buffer-substring-no-properties - (setcar ffap-string-at-point-region beg) - (setcar (cdr ffap-string-at-point-region) end))))) + (point)))) + (region-len (- (max beg end) (min beg end)))) + (if (and (natnump ffap-max-region-length) + (< region-len ffap-max-region-length)) ; Bug#25243. + (setf ffap-string-at-point-region (list beg end) + ffap-string-at-point + (buffer-substring-no-properties beg end)) + (setf ffap-string-at-point-region (list 1 1) + ffap-string-at-point "")))) (defun ffap-string-around () ;; Sometimes useful to decide how to treat a string. diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el new file mode 100644 index 0000000000..61fa891fe7 --- /dev/null +++ b/test/lisp/ffap-tests.el @@ -0,0 +1,54 @@ +;;; ffap-tests.el --- Test suite for ffap.el -*- lexical-binding: t -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Tino Calancha + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'ffap) + +(ert-deftest ffap-tests-25243 () + "Test for http://debbugs.gnu.org/25243 ." + (let ((file (make-temp-file "test-Bug#25243"))) + (unwind-protect + (with-temp-file file + (let ((str "diff --git b/lisp/ffap.el a/lisp/ffap.el +index 3d7cebadcf..ad4b70d737 100644 +--- b/lisp/ffap.el ++++ a/lisp/ffap.el +@@ -203,6 +203,9 @@ ffap-foo-at-bar-prefix +")) + (transient-mark-mode 1) + (when (natnump ffap-max-region-length) + (insert + (concat + str + (make-string ffap-max-region-length #xa) + (format "%s ENDS HERE" file))) + (mark-whole-buffer) + (should (equal "" (ffap-string-at-point))) + (should (equal '(1 1) ffap-string-at-point-region))))) + (and (file-exists-p file) (delete-file file))))) + +(provide 'ffap-tests) + +;;; ffap-tests.el ends here commit 9672f2c916b5909cc5836f67edc4d66842cce7cd Author: Thien-Thi Nguyen Date: Fri Dec 30 07:13:17 2016 +0100 last-chance: Also ignore NEWS files + typo fixes * admin/last-chance.el: Fix typo in copyright notice. (last-chance-uninteresting-regexps): Add entry to match NEWS files. (last-chance-cleanup): Fix typo in docstring. diff --git a/admin/last-chance.el b/admin/last-chance.el index 5151a7562d..02df7dea81 100644 --- a/admin/last-chance.el +++ b/admin/last-chance.el @@ -1,6 +1,6 @@ ;;; last-chance.el --- dangling deterrence -*- lexical-binding: t; -*- -;; Copyright (C) 2000-2016 Free Software Foundation, Inc. +;; Copyright (C) 2016 Free Software Foundation, Inc. ;; Author: Thien-Thi Nguyen ;; Maintainer: emacs-devel@gnu.org @@ -58,6 +58,7 @@ This should include -n, -H, -F.") (defvar last-chance-uninteresting-regexps '("ChangeLog[.0-9]*:" + "NEWS[-.0-9]*:" ;; Add more ‘flush-lines’ args here. ) "List of regexps that match uninteresting \"git grep\" hits.") @@ -67,7 +68,7 @@ This should include -n, -H, -F.") (defun last-chance-cleanup (buffer status) "Filter lines in BUFFER; append STATUS and count of removed lines. -If BUFFER is not seem to be one created by ‘last-chance’, do nothing. +If BUFFER does not seem to be one created by ‘last-chance’, do nothing. This function is intended to be added to ‘compilation-finish-functions’." (let ((name (buffer-local-value 'last-chance-symbol buffer)) bef aft) commit b5b4c4938bcd710ab857505e04424fca39a13624 Author: Mike Kupfer Date: Wed Dec 28 15:46:19 2016 -0800 * mh-e.el (mh-fetch-x-image-url): Fix a docstring typo. diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 12c674d08f..dfaf317fb6 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -2330,7 +2330,7 @@ retracted--without question." (defcustom-mh mh-fetch-x-image-url nil "Control fetching of \"X-Image-URL:\" header field image. -Ths option controls the fetching of the \"X-Image-URL:\" header +This option controls the fetching of the \"X-Image-URL:\" header field image with the following values: Ask Before Fetching commit 8295e97f18490a535d1188a3daf0b0fd1bf4fa0d Author: Alan Mackenzie Date: Thu Dec 29 20:52:02 2016 +0000 Remove an ambiguity from defvar's doc string. Fixes bug #25292. The ambiguity was whether INITVALUE is evaluated when it's not going to be used to set SYMBOL's value. * src/eval.c (defvar): Rewrite a paragraph of the doc string. diff --git a/src/eval.c b/src/eval.c index e50e26a11d..240b0ff380 100644 --- a/src/eval.c +++ b/src/eval.c @@ -716,10 +716,11 @@ can be referred to by the Emacs help facilities and other programming tools. The `defvar' form also declares the variable as \"special\", so that it is always dynamically bound even if `lexical-binding' is t. -The optional argument INITVALUE is evaluated, and used to set SYMBOL, -only if SYMBOL's value is void. If SYMBOL is buffer-local, its -default value is what is set; buffer-local values are not affected. -If INITVALUE is missing, SYMBOL's value is not set. +If SYMBOL's value is void and the optional argument INITVALUE is +provided, INITVALUE is evaluated and the result used to set SYMBOL's +value. If SYMBOL is buffer-local, its default value is what is set; +buffer-local values are not affected. If INITVALUE is missing, +SYMBOL's value is not set. If SYMBOL has a local binding, then this form affects the local binding. This is usually not what you want. Thus, if you need to commit b9cacf044902df441dc7cbd9a21f36833dc40a30 Author: Michael Albinus Date: Thu Dec 29 19:48:17 2016 +0100 Improve filenotify-tests.el * src/inotify.c (Finotify_valid_p): * src/kqueue.c (Fkqueue_valid_p): * src/w32notify.c (Fw32notify_valid_p): * src/gfilenotify.c (Fgfile_valid_p): Fix typo in docstring. (Fgfile_monitor_name): New defun. (syms_of_gfilenotify): Declare Sgfile_monitor_name. * test/lisp/filenotify-tests.el (file-notify--test-read-event): New defun, derived from `file-notify--test-read-event-timeout'. Replace all calls of `read-event' by this. (file-notify--test-timeout): Fix docstring. (file-notify--test-monitor): New defun. (file-notify--deftest-remote): Do not bind `file-notify--test-read-event-timeout' anymore. (file-notify-test00-availability): Print also monitor, if existent. (file-notify--test-with-events): Add an additional `file-notify--test-read-event' call, in order to get it work after `file-notify-add-watch'. Remove special timeout for cygwin. (file-notify-test02-events): Make a better check for cygwin. (file-notify-test06-many-events): Improve event list for cygwin. (file-notify-test08-watched-file-in-watched-dir): Add cygwin case. diff --git a/src/gfilenotify.c b/src/gfilenotify.c index 30d0753f7e..1ad989a0d9 100644 --- a/src/gfilenotify.c +++ b/src/gfilenotify.c @@ -258,7 +258,7 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) } DEFUN ("gfile-valid-p", Fgfile_valid_p, Sgfile_valid_p, 1, 1, 0, - doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. + doc: /* Check a watch specified by its WATCH-DESCRIPTOR. WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. @@ -278,6 +278,26 @@ invalid. */) } } +DEFUN ("gfile-monitor-name", Fgfile_monitor_name, Sgfile_monitor_name, 1, 1, 0, + doc: /* Return the internal monitor name for WATCH-DESCRIPTOR. + +The result is a string, either "GInotifyFileMonitor", +"GKqueueFileMonitor", or "GPollFileMonitor". + +WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. +If WATCH-DESCRIPTOR is not valid, nil is returned. */) + (Lisp_Object watch_descriptor) +{ + if (NILP (Fgfile_valid_p (watch_descriptor))) + return Qnil; + else + { + Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); + GFileMonitor *monitor = XINTPTR (watch_descriptor); + return build_string (G_OBJECT_TYPE_NAME (monitor)); + } +} + void globals_of_gfilenotify (void) @@ -294,6 +314,7 @@ syms_of_gfilenotify (void) defsubr (&Sgfile_add_watch); defsubr (&Sgfile_rm_watch); defsubr (&Sgfile_valid_p); + defsubr (&Sgfile_monitor_name); /* Filter objects. */ DEFSYM (Qchange, "change"); diff --git a/src/inotify.c b/src/inotify.c index 38c8df5a29..cacc6dca14 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -364,7 +364,7 @@ See inotify_rm_watch(2) for more information. } DEFUN ("inotify-valid-p", Finotify_valid_p, Sinotify_valid_p, 1, 1, 0, - doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. + doc: /* Check a watch specified by its WATCH-DESCRIPTOR. WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. diff --git a/src/kqueue.c b/src/kqueue.c index d1d0a61204..8ebd132fdc 100644 --- a/src/kqueue.c +++ b/src/kqueue.c @@ -491,7 +491,7 @@ WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. */) } DEFUN ("kqueue-valid-p", Fkqueue_valid_p, Skqueue_valid_p, 1, 1, 0, - doc: /* "Check a watch specified by its WATCH-DESCRIPTOR. + doc: /* Check a watch specified by its WATCH-DESCRIPTOR. WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. diff --git a/src/w32notify.c b/src/w32notify.c index 32a03f70a6..e23e2b8740 100644 --- a/src/w32notify.c +++ b/src/w32notify.c @@ -670,7 +670,7 @@ w32_get_watch_object (void *desc) } DEFUN ("w32notify-valid-p", Fw32notify_valid_p, Sw32notify_valid_p, 1, 1, 0, - doc: /* "Check a watch specified by its WATCH-DESCRIPTOR for validity. + doc: /* Check a watch specified by its WATCH-DESCRIPTOR for validity. WATCH-DESCRIPTOR should be an object returned by `w32notify-add-watch'. diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 1ed764fb97..e2bcc6b0f7 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -64,16 +64,22 @@ (defvar file-notify--test-event nil) (defvar file-notify--test-events nil) -(defconst file-notify--test-read-event-timeout - (cond - ;; Some events take several seconds to arrive on cygwin. - ((eq system-type 'cygwin) 7) - (t 0.01)) - "Timeout for `read-event' calls. -It is different for local and remote file notification libraries.") +(defun file-notify--test-read-event () + "Read one event. +There are different timeouts for local and remote file notification libraries." + (read-event + nil nil + (cond + ;; gio/gpollfilemonitor.c declares POLL_TIME_SECS 5. So we must + ;; wait at least this time. + ((and (string-equal (file-notify--test-library) "gfilenotify") + (string-equal (file-notify--test-monitor) "GPollFileMonitor")) + 7) + ((file-remote-p temporary-file-directory) 0.1) + (t 0.01)))) (defun file-notify--test-timeout () - "Timeout to wait for arriving events, in seconds." + "Timeout to wait for arriving a bunch of events, in seconds." (cond ((file-remote-p temporary-file-directory) 6) ((string-equal (file-notify--test-library) "w32notify") 4) @@ -85,7 +91,7 @@ It is different for local and remote file notification libraries.") TIMEOUT is the maximum time to wait for, in seconds." `(with-timeout (,timeout (ignore)) (while (null ,until) - (read-event nil nil file-notify--test-read-event-timeout)))) + (file-notify--test-read-event)))) (defun file-notify--test-no-descriptors () "Check that `file-notify-descriptors' is an empty hash table. @@ -197,6 +203,15 @@ remote host, or nil." "<[[:digit:]]+>\\'" "" (process-name (cdr file-notify--test-remote-enabled-checked)))))) +(defun file-notify--test-monitor () + "The used monitor for the test, as a string. +This returns only for the local case and gfilenotify; otherwise it is nil. +`file-notify--test-desc' must be a valid watch descriptor." + (and file-notify--test-desc + (null (file-remote-p temporary-file-directory)) + (functionp 'gfile-monitor-name) + (gfile-monitor-name file-notify--test-desc))) + (defmacro file-notify--deftest-remote (test docstring) "Define ert `TEST-remote' for remote files." (declare (indent 1)) @@ -205,7 +220,6 @@ remote host, or nil." :tags '(:expensive-test) (let* ((temporary-file-directory file-notify-test-remote-temporary-file-directory) - (file-notify--test-read-event-timeout 0.1) (ert-test (ert-get-test ',test))) (skip-unless (file-notify--test-remote-enabled)) (tramp-cleanup-connection @@ -224,6 +238,8 @@ remote host, or nil." (setq file-notify--test-desc (file-notify-add-watch temporary-file-directory '(change) #'ignore))) + (when (file-notify--test-monitor) + (message "Monitor: `%s'" (file-notify--test-monitor))) (file-notify-rm-watch file-notify--test-desc) ;; The environment shall be cleaned up. @@ -387,15 +403,12 @@ delivered." events))) create-lockfiles) ;; Flush pending events. + (file-notify--test-read-event) (file-notify--wait-for-events (file-notify--test-timeout) (not (input-pending-p))) (setq file-notify--test-events nil file-notify--test-results nil) - ;; cygwin needs a delay between setting a watch and beginning - ;; file activity, or else the first event is not sent. - (if (eq system-type 'cygwin) - (sleep-for 1)) ,@body (file-notify--wait-for-events ;; More events need more time. Use some fudge factor. @@ -434,7 +447,7 @@ delivered." (t '(created changed deleted stopped))) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) (file-notify-rm-watch file-notify--test-desc)) @@ -452,7 +465,7 @@ delivered." (changed changed deleted stopped)) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) (file-notify-rm-watch file-notify--test-desc) @@ -483,7 +496,7 @@ delivered." (t '(created changed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-directory temporary-file-directory 'recursive)) (file-notify-rm-watch file-notify--test-desc)) @@ -516,14 +529,14 @@ delivered." deleted deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) ;; The next two events shall not be visible. - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-modes file-notify--test-tmpfile 000) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-times file-notify--test-tmpfile '(0 0)) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-directory temporary-file-directory 'recursive)) (file-notify-rm-watch file-notify--test-desc)) @@ -554,15 +567,16 @@ delivered." (t '(created changed renamed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) ;; After the rename, we won't get events anymore. - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-directory temporary-file-directory 'recursive)) (file-notify-rm-watch file-notify--test-desc)) ;; Check attribute change. Does not work for cygwin. - (unless (eq system-type 'cygwin) + (unless (and (eq system-type 'cygwin) + (not (file-remote-p temporary-file-directory))) (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -588,11 +602,11 @@ delivered." (t '(attribute-changed attribute-changed))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-modes file-notify--test-tmpfile 000) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-times file-notify--test-tmpfile '(0 0)) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) (file-notify-rm-watch file-notify--test-desc)) @@ -736,7 +750,7 @@ delivered." (changed changed deleted stopped)) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) ;; After deleting the file, the descriptor is not valid anymore. (should-not (file-notify-valid-p file-notify--test-desc)) @@ -774,7 +788,7 @@ delivered." (t '(created changed deleted deleted stopped))) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-directory temporary-file-directory t)) ;; After deleting the parent directory, the descriptor must ;; not be valid anymore. @@ -876,9 +890,9 @@ delivered." (let ((source-file-list source-file-list) (target-file-list target-file-list)) (while (and source-file-list target-file-list) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (write-region "" nil (pop source-file-list) nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (write-region "" nil (pop target-file-list) nil 'no-message)))) (file-notify--test-with-events (cond @@ -890,19 +904,19 @@ delivered." ;; cygwin fires `changed' and `deleted' events, sometimes ;; in random order. ((eq system-type 'cygwin) - (let ((r '(:random))) - (dotimes (_i n r) - (setq r (append r '(changed deleted)))))) + (let (r) + (dotimes (_i n (cons :random r)) + (setq r (append '(changed deleted) r))))) (t (make-list n 'renamed))) (let ((source-file-list source-file-list) (target-file-list target-file-list)) (while (and source-file-list target-file-list) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (rename-file (pop source-file-list) (pop target-file-list) t)))) (file-notify--test-with-events (make-list n 'deleted) (dolist (file target-file-list) - (read-event nil nil file-notify--test-read-event-timeout) - (delete-file file) file-notify--test-read-event-timeout)) + (file-notify--test-read-event) + (delete-file file))) (delete-directory file-notify--test-tmpfile) ;; The environment shall be cleaned up. @@ -1040,6 +1054,12 @@ the file watch." (file-notify--test-with-events ;; There could be one or two `changed' events. (list + ;; cygwin. + (append + '(:random) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed)) (append '(:random) ;; Directory monitor and file monitor. @@ -1059,7 +1079,7 @@ the file watch." (make-list (/ n 2) 'created) (make-list (/ n 2) 'changed))) (dotimes (i n) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (if (zerop (mod i 2)) (write-region "any text" nil file-notify--test-tmpfile1 t 'no-message) @@ -1081,9 +1101,10 @@ the file watch." ;; Now we delete the directory. (file-notify--test-with-events (cond - ;; In kqueue, just one `deleted' event for the directory - ;; is received. - ((string-equal (file-notify--test-library) "kqueue") + ;; In kqueue and for cygwin, just one `deleted' event for + ;; the directory is received. + ((or (eq system-type 'cygwin) + (string-equal (file-notify--test-library) "kqueue")) '(deleted stopped)) (t (append ;; The directory monitor raises a `deleted' event for commit 11b81a54d538e8deca3cd64521cf85409efb617b Author: Alan Mackenzie Date: Thu Dec 29 15:34:36 2016 +0000 Partially correct fontification of "(b*3)", and the like, in C++ Mode This problem is caused by the fundamental ambiguity in C++ between argument declarations and initialisation clauses. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): If we have an open paren preceded by an arithmetic operator, we give this the context nil, not 'arglist. * lisp/progmodes/cc-langs.el (c-arithmetic-operators, c-arithmetic-op-regexp): New lang consts and vars. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 26a002ac8a..39e68f0b87 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1311,6 +1311,13 @@ casts and declarations are fontified. Used on level 2 and higher." ;; multiline declaration. (c-put-char-property (1- match-pos) 'c-type 'c-decl-arg-start)) + ;; Got an open paren preceded by an arith operator. + ((and (eq (char-before match-pos) ?\() + (save-excursion + (and (zerop (c-backward-token-2 2)) + (looking-at c-arithmetic-op-regexp)))) + (setq context nil + c-restricted-<>-arglists nil)) (t (setq context 'arglist c-restricted-<>-arglists t)))) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 3c328489ec..83b8db3657 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1248,6 +1248,22 @@ operators." (c-lang-defvar c-assignment-op-regexp (c-lang-const c-assignment-op-regexp)) +(c-lang-defconst c-arithmetic-operators + "List of all arithmetic operators, including \"+=\", etc." + ;; Note: in the following, there are too many operators for AWK and IDL. + t (append (c-lang-const c-assignment-operators) + '("+" "-" "*" "/" "%" + "<<" ">>" + "<" ">" "<=" ">=" + "==" "!=" + "&" "^" "|" + "&&" "||"))) + +(c-lang-defconst c-arithmetic-op-regexp + t (c-make-keywords-re nil + (c-lang-const c-arithmetic-operators))) +(c-lang-defvar c-arithmetic-op-regexp (c-lang-const c-arithmetic-op-regexp)) + (c-lang-defconst c-:$-multichar-token-regexp ;; Regexp matching all tokens ending in ":" which are longer than one char. ;; Currently (2016-01-07) only used in C++ Mode.