@code{file-notify-add-watch}.
@end defun
+@deffn Command file-notify-rm-all-watches
+Removes all existing file notification watches from Emacs.
+@end deffn
+
@defun file-notify-valid-p descriptor
Checks a watch specified by its @var{descriptor} for validity.
@var{descriptor} should be an object returned by
* Startup Changes in Emacs 29.1
+++
-** Emacs now has a --fingerprint option.
+** Emacs now has a '--fingerprint' option.
This will output a string identifying the current Emacs build.
+++
---
*** Improved mouse behavior with auto-scrolling modes.
-When clicking inside the `scroll-margin' or `hscroll-margin' region
+When clicking inside the 'scroll-margin' or 'hscroll-margin' region
the point is now moved only when releasing the mouse button. This no
longer results in a bogus selection, unless the mouse has been
effectively dragged.
The new command 'image-dired-unmark-all-marks' has been added with a
binding in the menu.
+** info-look
+
---
*** info-look specs can now be expanded at run time instead of a load time.
The new ':doc-spec-function' element can be used to compute the
** subr-x
+++
-*** New macro 'with-memoization' provides a very primitive form of memoization
+*** New macro 'with-memoization' provides a very primitive form of memoization.
-** ansi-color.el
+** ansi-color
---
*** Support for ANSI 256-color and 24-bit colors.
*** Support for ANSI 256-color and 24-bit colors, italic and other fonts.
Term-mode can now display 256-color and 24-bit color codes. It can
also handle ANSI codes for faint, italic and blinking text, displaying
-it with new 'ansi-term-faint/italic/slow-blinking/fast-blinking'
-faces.
+it with new 'term-{faint,italic,slow-blink,fast-blink}' faces.
** Xref
*** 'project-find-file' and 'project-or-external-find-file' now accept
a prefix argument which is interpreted to mean "include all files".
+** File notifications
+
++++
+*** The new command 'file-notify-rm-all-watches' removes all file notifications.
+
\f
* New Modes and Packages in Emacs 29.1
local variables.
+++
-** Third 'mapconcat' argument 'separator' is now optional.
+** Third 'mapconcat' argument SEPARATOR is now optional.
An explicit nil always meant the empty string, now it can be left out.
---
;; Modify `file-notify-descriptors' and send a `stopped' event.
(file-notify--rm-descriptor descriptor))))
+(defun file-notify-rm-all-watches ()
+ "Remove all existing file notification watches from Emacs."
+ (interactive)
+ (maphash
+ (lambda (key _value)
+ (file-notify-rm-watch key))
+ file-notify-descriptors))
+
(defun file-notify-valid-p (descriptor)
"Check a watch specified by its DESCRIPTOR.
DESCRIPTOR should be an object returned by `file-notify-add-watch'."
(defun file-notify--test-cleanup ()
"Cleanup after a test."
- (file-notify-rm-watch file-notify--test-desc)
- (file-notify-rm-watch file-notify--test-desc1)
- (file-notify-rm-watch file-notify--test-desc2)
+ (file-notify-rm-all-watches)
(ignore-errors
(delete-file (file-newest-backup file-notify--test-tmpfile)))
;; This test is inspired by Bug#26126 and Bug#26127.
(ert-deftest file-notify-test02-rm-watch ()
- "Check `file-notify-rm-watch'."
+ "Check `file-notify-rm-watch' and `file-notify-rm-all-watches'."
(skip-unless (file-notify--test-local-enabled))
(unwind-protect
;; The environment shall be cleaned up.
(file-notify--test-cleanup-p))))
+ ;; Cleanup.
+ (file-notify--test-cleanup))
+
+ (unwind-protect
+ ;; Check `file-notify-rm-all-watches'.
+ (progn
+ (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
+ file-notify--test-tmpfile1 (file-notify--test-make-temp-name))
+ (write-region "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message)
+ (should
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile '(change) #'ignore)))
+ (should
+ (setq file-notify--test-desc1
+ (file-notify-add-watch
+ file-notify--test-tmpfile1 '(change) #'ignore)))
+ (file-notify-rm-all-watches)
+ (delete-file file-notify--test-tmpfile)
+ (delete-file file-notify--test-tmpfile1)
+
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
+
;; Cleanup.
(file-notify--test-cleanup)))