mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Update uses of if-let and when-let
* lisp/dom.el (dom-previous-sibling): * lisp/emacs-lisp/package.el (package--with-work-buffer): (package--sort-deps-in-alist, package--sort-by-dependence): (package-install-from-archive, package-install): (package-menu-execute, package-menu--populate-new-package-list): * lisp/filenotify.el (file-notify--rm-descriptor): (file-notify--event-watched-file, file-notify--event-file-name): (file-notify--event-file1-name, file-notify-rm-watch): (file-notify-valid-p): * lisp/gnus/message.el (message-toggle-image-thumbnails): * lisp/gnus/nnimap.el (nnimap-request-move-article): * lisp/ibuf-ext.el (ibuffer-repair-saved-filters): * lisp/mpc.el (mpc-format): * lisp/net/eww.el (eww-tag-meta, eww-process-text-input): (eww-save-history): * lisp/net/shr.el (shr-tag-base, shr-tag-object, shr-make-table-1): * lisp/progmodes/prog-mode.el (prettify-symbols--post-command-hook): * lisp/svg.el (svg-remove): * lisp/textmodes/css-mode.el (css--named-color): (css--colon-inside-funcall): * lisp/textmodes/sgml-mode.el (html-current-buffer-classes): (html-current-buffer-ids): Use if-let* and when-let* instead.
This commit is contained in:
parent
4612b2a2b3
commit
370d0e7aa7
13 changed files with 57 additions and 57 deletions
|
|
@ -71,7 +71,7 @@ struct.")
|
|||
"Remove DESCRIPTOR from `file-notify-descriptors'.
|
||||
DESCRIPTOR should be an object returned by `file-notify-add-watch'.
|
||||
If it is registered in `file-notify-descriptors', a stopped event is sent."
|
||||
(when-let (watch (gethash descriptor file-notify-descriptors))
|
||||
(when-let* ((watch (gethash descriptor file-notify-descriptors)))
|
||||
;; Send `stopped' event.
|
||||
(unwind-protect
|
||||
(funcall
|
||||
|
|
@ -106,12 +106,12 @@ It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).")
|
|||
(defun file-notify--event-watched-file (event)
|
||||
"Return file or directory being watched.
|
||||
Could be different from the directory watched by the backend library."
|
||||
(when-let (watch (gethash (car event) file-notify-descriptors))
|
||||
(when-let* ((watch (gethash (car event) file-notify-descriptors)))
|
||||
(file-notify--watch-absolute-filename watch)))
|
||||
|
||||
(defun file-notify--event-file-name (event)
|
||||
"Return file name of file notification event, or nil."
|
||||
(when-let (watch (gethash (car event) file-notify-descriptors))
|
||||
(when-let* ((watch (gethash (car event) file-notify-descriptors)))
|
||||
(directory-file-name
|
||||
(expand-file-name
|
||||
(or (and (stringp (nth 2 event)) (nth 2 event)) "")
|
||||
|
|
@ -121,7 +121,7 @@ Could be different from the directory watched by the backend library."
|
|||
(defun file-notify--event-file1-name (event)
|
||||
"Return second file name of file notification event, or nil.
|
||||
This is available in case a file has been moved."
|
||||
(when-let (watch (gethash (car event) file-notify-descriptors))
|
||||
(when-let* ((watch (gethash (car event) file-notify-descriptors)))
|
||||
(and (stringp (nth 3 event))
|
||||
(directory-file-name
|
||||
(expand-file-name
|
||||
|
|
@ -375,7 +375,7 @@ FILE is the name of the file whose event is being reported."
|
|||
(defun file-notify-rm-watch (descriptor)
|
||||
"Remove an existing watch specified by its DESCRIPTOR.
|
||||
DESCRIPTOR should be an object returned by `file-notify-add-watch'."
|
||||
(when-let (watch (gethash descriptor file-notify-descriptors))
|
||||
(when-let* ((watch (gethash descriptor file-notify-descriptors)))
|
||||
(let ((handler (find-file-name-handler
|
||||
(file-notify--watch-directory watch)
|
||||
'file-notify-rm-watch)))
|
||||
|
|
@ -399,7 +399,7 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'."
|
|||
(defun file-notify-valid-p (descriptor)
|
||||
"Check a watch specified by its DESCRIPTOR.
|
||||
DESCRIPTOR should be an object returned by `file-notify-add-watch'."
|
||||
(when-let (watch (gethash descriptor file-notify-descriptors))
|
||||
(when-let* ((watch (gethash descriptor file-notify-descriptors)))
|
||||
(let ((handler (find-file-name-handler
|
||||
(file-notify--watch-directory watch)
|
||||
'file-notify-valid-p)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue