aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2016-03-03 23:52:26 -0800
committerJohn Wiegley2016-03-03 23:52:26 -0800
commit68ed6bfb6599104e5f1635a862a373735d818722 (patch)
tree2488b3f959d3dbff87745fb265cd564445616b2a
parenteced64b2f76d1f85fb6fd54c67deadf1978cb344 (diff)
parentbd58c136d6ef33a24423720b5cf3c4e8c03fd4a9 (diff)
downloademacs-68ed6bfb6599104e5f1635a862a373735d818722.tar.gz
emacs-68ed6bfb6599104e5f1635a862a373735d818722.zip
Merge from origin/emacs-25
bd58c13 Improve documentation of focus-related hooks 00a4720 Further improve doc string of 'disable-point-adjustment' c582def Further adaptions in file-notify-tests.el for w32notify a1585e1 Don't bug out on localised dates in gnus-icalendar
-rw-r--r--doc/lispref/commands.texi3
-rw-r--r--lisp/gnus/gnus-icalendar.el9
-rw-r--r--src/keyboard.c8
-rw-r--r--test/lisp/filenotify-tests.el145
4 files changed, 87 insertions, 78 deletions
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 3ea6ea045eb..2048e28d959 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1664,7 +1664,8 @@ gets keyboard input. This choice of window is called the @dfn{focus}.
1664When the user does something to switch between Emacs frames, that 1664When the user does something to switch between Emacs frames, that
1665generates a @dfn{focus event}. The normal definition of a focus event, 1665generates a @dfn{focus event}. The normal definition of a focus event,
1666in the global keymap, is to select a new frame within Emacs, as the user 1666in the global keymap, is to select a new frame within Emacs, as the user
1667would expect. @xref{Input Focus}. 1667would expect. @xref{Input Focus}, which also describes hooks related
1668to focus events.
1668 1669
1669Focus events are represented in Lisp as lists that look like this: 1670Focus events are represented in Lisp as lists that look like this:
1670 1671
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 96697b22791..dea6523a541 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -412,10 +412,11 @@ Return nil for non-recurring EVENT."
412 (end-date (format-time-string "%Y-%m-%d" end)) 412 (end-date (format-time-string "%Y-%m-%d" end))
413 (end-time (format-time-string "%H:%M" end)) 413 (end-time (format-time-string "%H:%M" end))
414 (end-at-midnight (string= end-time "00:00")) 414 (end-at-midnight (string= end-time "00:00"))
415 (start-end-date-diff (/ (float-time (time-subtract 415 (start-end-date-diff
416 (date-to-time end-date) 416 (/ (float-time (time-subtract
417 (date-to-time start-date))) 417 (org-time-string-to-time end-date)
418 86400)) 418 (org-time-string-to-time start-date)))
419 86400))
419 (org-repeat (gnus-icalendar-event:org-repeat event)) 420 (org-repeat (gnus-icalendar-event:org-repeat event))
420 (repeat (if org-repeat (concat " " org-repeat) "")) 421 (repeat (if org-repeat (concat " " org-repeat) ""))
421 (time-1-day '(0 86400))) 422 (time-1-day '(0 86400)))
diff --git a/src/keyboard.c b/src/keyboard.c
index 4d107277634..6535e04d826 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11624,8 +11624,8 @@ It's called with one argument, the help string to display. */);
11624 11624
11625After a command is executed, if point moved into a region that has 11625After a command is executed, if point moved into a region that has
11626special properties (e.g. composition, display), Emacs adjusts point to 11626special properties (e.g. composition, display), Emacs adjusts point to
11627the boundary of the region. But when a command binds this variable to 11627the boundary of the region. But when a command leaves this variable at
11628non-nil, this point adjustment is suppressed. 11628a non-nil value (e.g., with a setq), this point adjustment is suppressed.
11629 11629
11630This variable is set to nil before reading a command, and is checked 11630This variable is set to nil before reading a command, and is checked
11631just after executing the command. */); 11631just after executing the command. */);
@@ -11636,8 +11636,8 @@ just after executing the command. */);
11636 doc: /* If non-nil, always suppress point adjustments. 11636 doc: /* If non-nil, always suppress point adjustments.
11637 11637
11638The default value is nil, in which case point adjustments are 11638The default value is nil, in which case point adjustments are
11639suppressed only after special commands that set 11639suppressed only after special commands that leave
11640`disable-point-adjustment' (which see) to non-nil. */); 11640`disable-point-adjustment' (which see) at a non-nil value. */);
11641 Vglobal_disable_point_adjustment = Qnil; 11641 Vglobal_disable_point_adjustment = Qnil;
11642 11642
11643 DEFVAR_LISP ("minibuffer-message-timeout", Vminibuffer_message_timeout, 11643 DEFVAR_LISP ("minibuffer-message-timeout", Vminibuffer_message_timeout,
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index a16de7fb058..9f0c0ed0dc1 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -64,7 +64,7 @@
64(defvar file-notify--test-event nil) 64(defvar file-notify--test-event nil)
65(defvar file-notify--test-events nil) 65(defvar file-notify--test-events nil)
66 66
67(defconst file-notify--test-read-event-timeout 0.02 67(defconst file-notify--test-read-event-timeout 0.01
68 "Timeout for `read-event' calls. 68 "Timeout for `read-event' calls.
69It is different for local and remote file notification libraries.") 69It is different for local and remote file notification libraries.")
70 70
@@ -72,7 +72,7 @@ It is different for local and remote file notification libraries.")
72 "Timeout to wait for arriving events, in seconds." 72 "Timeout to wait for arriving events, in seconds."
73 (cond 73 (cond
74 ((file-remote-p temporary-file-directory) 6) 74 ((file-remote-p temporary-file-directory) 6)
75 ((string-equal (file-notify--test-library) "w32notify") 10) 75 ((string-equal (file-notify--test-library) "w32notify") 4)
76 ((eq system-type 'cygwin) 10) 76 ((eq system-type 'cygwin) 10)
77 (t 3))) 77 (t 3)))
78 78
@@ -417,8 +417,8 @@ longer than timeout seconds for the events to be delivered."
417 '(change) 'file-notify--test-event-handler))) 417 '(change) 'file-notify--test-event-handler)))
418 (file-notify--test-with-events 418 (file-notify--test-with-events
419 (cond 419 (cond
420 ;; w32notify does raise a `stopped' event when a 420 ;; w32notify does not raise `deleted' and `stopped'
421 ;; watched directory is deleted. 421 ;; events for the watched directory.
422 ((string-equal (file-notify--test-library) "w32notify") 422 ((string-equal (file-notify--test-library) "w32notify")
423 '(created changed deleted)) 423 '(created changed deleted))
424 ;; cygwin recognizes only `deleted' and `stopped' events. 424 ;; cygwin recognizes only `deleted' and `stopped' events.
@@ -449,9 +449,11 @@ longer than timeout seconds for the events to be delivered."
449 (file-notify--test-with-events 449 (file-notify--test-with-events
450 (cond 450 (cond
451 ;; w32notify does not distinguish between `changed' and 451 ;; w32notify does not distinguish between `changed' and
452 ;; `attribute-changed'. 452 ;; `attribute-changed'. It does not raise `deleted'
453 ;; and `stopped' events for the watched directory.
453 ((string-equal (file-notify--test-library) "w32notify") 454 ((string-equal (file-notify--test-library) "w32notify")
454 '(created changed created changed changed changed changed 455 '(created changed created changed
456 changed changed changed
455 deleted deleted)) 457 deleted deleted))
456 ;; cygwin recognizes only `deleted' and `stopped' events. 458 ;; cygwin recognizes only `deleted' and `stopped' events.
457 ((eq system-type 'cygwin) 459 ((eq system-type 'cygwin)
@@ -488,8 +490,8 @@ longer than timeout seconds for the events to be delivered."
488 '(change) 'file-notify--test-event-handler))) 490 '(change) 'file-notify--test-event-handler)))
489 (file-notify--test-with-events 491 (file-notify--test-with-events
490 (cond 492 (cond
491 ;; w32notify does not distinguish between `changed' and 493 ;; w32notify does not raise `deleted' and `stopped'
492 ;; `attribute-changed'. 494 ;; events for the watched directory.
493 ((string-equal (file-notify--test-library) "w32notify") 495 ((string-equal (file-notify--test-library) "w32notify")
494 '(created changed renamed deleted)) 496 '(created changed renamed deleted))
495 ;; cygwin recognizes only `deleted' and `stopped' events. 497 ;; cygwin recognizes only `deleted' and `stopped' events.
@@ -604,31 +606,29 @@ longer than timeout seconds for the events to be delivered."
604 (should (string-match "another text" (buffer-string))) 606 (should (string-match "another text" (buffer-string)))
605 607
606 ;; Stop file notification. Autorevert shall still work via polling. 608 ;; Stop file notification. Autorevert shall still work via polling.
607 ;; It doesn't work for w32notify. 609 (file-notify-rm-watch auto-revert-notify-watch-descriptor)
608 (unless (string-equal (file-notify--test-library) "w32notify") 610 (file-notify--wait-for-events
609 (file-notify-rm-watch auto-revert-notify-watch-descriptor) 611 timeout (null auto-revert-use-notify))
612 (should-not auto-revert-use-notify)
613 (should-not auto-revert-notify-watch-descriptor)
614
615 ;; Modify file. We wait for two seconds, in order to
616 ;; have another timestamp. One second seems to be too
617 ;; short.
618 (with-current-buffer (get-buffer-create "*Messages*")
619 (narrow-to-region (point-max) (point-max)))
620 (sleep-for 2)
621 (write-region
622 "foo bla" nil file-notify--test-tmpfile nil 'no-message)
623
624 ;; Check, that the buffer has been reverted.
625 (with-current-buffer (get-buffer-create "*Messages*")
610 (file-notify--wait-for-events 626 (file-notify--wait-for-events
611 timeout (null auto-revert-use-notify)) 627 timeout
612 (should-not auto-revert-use-notify) 628 (string-match
613 (should-not auto-revert-notify-watch-descriptor) 629 (format-message "Reverting buffer `%s'." (buffer-name buf))
614 630 (buffer-string))))
615 ;; Modify file. We wait for two seconds, in order to 631 (should (string-match "foo bla" (buffer-string)))))
616 ;; have another timestamp. One second seems to be too
617 ;; short.
618 (with-current-buffer (get-buffer-create "*Messages*")
619 (narrow-to-region (point-max) (point-max)))
620 (sleep-for 2)
621 (write-region
622 "foo bla" nil file-notify--test-tmpfile nil 'no-message)
623
624 ;; Check, that the buffer has been reverted.
625 (with-current-buffer (get-buffer-create "*Messages*")
626 (file-notify--wait-for-events
627 timeout
628 (string-match
629 (format-message "Reverting buffer `%s'." (buffer-name buf))
630 (buffer-string))))
631 (should (string-match "foo bla" (buffer-string))))))
632 632
633 ;; Cleanup. 633 ;; Cleanup.
634 (with-current-buffer "*Messages*" (widen)) 634 (with-current-buffer "*Messages*" (widen))
@@ -699,36 +699,37 @@ longer than timeout seconds for the events to be delivered."
699 (file-notify--test-cleanup)) 699 (file-notify--test-cleanup))
700 700
701 (unwind-protect 701 (unwind-protect
702 ;; w32notify does not send a `stopped' event when deleting a 702 (let ((temporary-file-directory
703 ;; directory. The test does not work, therefore. 703 (make-temp-file "file-notify-test-parent" t)))
704 (unless (string-equal (file-notify--test-library) "w32notify") 704 (should
705 (let ((temporary-file-directory 705 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
706 (make-temp-file "file-notify-test-parent" t))) 706 file-notify--test-desc
707 (should 707 (file-notify-add-watch
708 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) 708 temporary-file-directory
709 file-notify--test-desc 709 '(change) #'file-notify--test-event-handler)))
710 (file-notify-add-watch 710 (file-notify--test-with-events
711 temporary-file-directory 711 (cond
712 '(change) #'file-notify--test-event-handler))) 712 ;; w32notify does not raise `deleted' and `stopped' events
713 (file-notify--test-with-events 713 ;; for the watched directory.
714 (cond 714 ((string-equal (file-notify--test-library) "w32notify")
715 ;; cygwin recognizes only `deleted' and `stopped' events. 715 '(created changed deleted))
716 ((eq system-type 'cygwin) 716 ;; cygwin recognizes only `deleted' and `stopped' events.
717 '(deleted stopped)) 717 ((eq system-type 'cygwin)
718 ;; There are two `deleted' events, for the file and for 718 '(deleted stopped))
719 ;; the directory. Except for kqueue. 719 ;; There are two `deleted' events, for the file and for the
720 ((string-equal (file-notify--test-library) "kqueue") 720 ;; directory. Except for kqueue.
721 '(created changed deleted stopped)) 721 ((string-equal (file-notify--test-library) "kqueue")
722 (t '(created changed deleted deleted stopped))) 722 '(created changed deleted stopped))
723 (should (file-notify-valid-p file-notify--test-desc)) 723 (t '(created changed deleted deleted stopped)))
724 (read-event nil nil file-notify--test-read-event-timeout) 724 (should (file-notify-valid-p file-notify--test-desc))
725 (write-region 725 (read-event nil nil file-notify--test-read-event-timeout)
726 "any text" nil file-notify--test-tmpfile nil 'no-message) 726 (write-region
727 (read-event nil nil file-notify--test-read-event-timeout) 727 "any text" nil file-notify--test-tmpfile nil 'no-message)
728 (delete-directory temporary-file-directory t)) 728 (read-event nil nil file-notify--test-read-event-timeout)
729 ;; After deleting the parent directory, the descriptor must 729 (delete-directory temporary-file-directory t))
730 ;; not be valid anymore. 730 ;; After deleting the parent directory, the descriptor must
731 (should-not (file-notify-valid-p file-notify--test-desc)))) 731 ;; not be valid anymore.
732 (should-not (file-notify-valid-p file-notify--test-desc)))
732 733
733 ;; Cleanup. 734 ;; Cleanup.
734 (file-notify--test-cleanup))) 735 (file-notify--test-cleanup)))
@@ -763,11 +764,8 @@ longer than timeout seconds for the events to be delivered."
763 (file-notify--test-cleanup)) 764 (file-notify--test-cleanup))
764 765
765 (unwind-protect 766 (unwind-protect
766 ;; The batch-mode operation of w32notify is fragile (there's no 767 (progn
767 ;; input threads to send the message to). 768 (setq file-notify--test-tmpfile
768 (unless (and noninteractive
769 (string-equal (file-notify--test-library) "w32notify"))
770 (setq file-notify--test-tmpfile
771 (file-name-as-directory (file-notify--test-make-temp-name))) 769 (file-name-as-directory (file-notify--test-make-temp-name)))
772 (make-directory file-notify--test-tmpfile) 770 (make-directory file-notify--test-tmpfile)
773 (should 771 (should
@@ -1045,7 +1043,11 @@ the file watch."
1045 directory-files-no-dot-files-regexp 'nosort)) 1043 directory-files-no-dot-files-regexp 'nosort))
1046 'deleted) 1044 'deleted)
1047 ;; The events of the directory itself. 1045 ;; The events of the directory itself.
1048 '(deleted stopped)))) 1046 (cond
1047 ;; w32notify does not raise `deleted' and `stopped'
1048 ;; events for the watched directory.
1049 ((string-equal (file-notify--test-library) "w32notify") '())
1050 (t '(deleted stopped))))))
1049 (delete-directory file-notify--test-tmpfile 'recursive)) 1051 (delete-directory file-notify--test-tmpfile 'recursive))
1050 (should-not (file-notify-valid-p file-notify--test-desc1)) 1052 (should-not (file-notify-valid-p file-notify--test-desc1))
1051 (should-not (file-notify-valid-p file-notify--test-desc2))) 1053 (should-not (file-notify-valid-p file-notify--test-desc2)))
@@ -1065,7 +1067,12 @@ the file watch."
1065 1067
1066;; TODO: 1068;; TODO:
1067 1069
1068;; * For w32notify, no stopped events arrive when a directory is removed. 1070;; * kqueue does not send all expected `deleted' events. Maybe due to
1071;; the missing directory monitor.
1072;; * For w32notify, no `deleted' and `stopped' events arrive when a
1073;; directory is removed.
1074;; * For w32notify, no `attribute-changed' events arrive. Its sends
1075;; `changed' events instead.
1069;; * Check, why cygwin recognizes only `deleted' and `stopped' events. 1076;; * Check, why cygwin recognizes only `deleted' and `stopped' events.
1070 1077
1071(provide 'file-notify-tests) 1078(provide 'file-notify-tests)