(defun dom-previous-sibling (dom node)
"Return the previous sibling of NODE in DOM."
- (when-let (parent (dom-parent dom node))
+ (when-let* ((parent (dom-parent dom node)))
(let ((siblings (dom-children parent))
(previous nil))
(while siblings
(let ((,b-sym (current-buffer)))
(require 'url-handlers)
(unless-error ,body
- (when-let ((er (plist-get status :error)))
+ (when-let* ((er (plist-get status :error)))
(error "Error retrieving: %s %S" ,url-sym er))
(with-current-buffer ,b-sym
(goto-char (point-min))
destructively set to nil in ONLY."
(let ((out))
(dolist (dep (package-desc-reqs package))
- (when-let ((cell (assq (car dep) only))
- (dep-package (cdr-safe cell)))
+ (when-let* ((cell (assq (car dep) only))
+ (dep-package (cdr-safe cell)))
(setcdr cell nil)
(setq out (append (package--sort-deps-in-alist dep-package only)
out))))
(dolist (cell alist out-list)
;; `package--sort-deps-in-alist' destructively changes alist, so
;; some cells might already be empty. We check this here.
- (when-let ((pkg-desc (cdr cell)))
+ (when-let* ((pkg-desc (cdr cell)))
(setcdr cell nil)
(setq out-list
(append (package--sort-deps-in-alist pkg-desc alist)
;; Update the old pkg-desc which will be shown on the description buffer.
(setf (package-desc-signed pkg-desc) t)
;; Update the new (activated) pkg-desc as well.
- (when-let ((pkg-descs (cdr (assq (package-desc-name pkg-desc) package-alist))))
+ (when-let* ((pkg-descs (cdr (assq (package-desc-name pkg-desc) package-alist))))
(setf (package-desc-signed (car pkg-descs)) t))))))))))
(defun package-installed-p (package &optional min-version)
(unless (or dont-select (package--user-selected-p name))
(package--save-selected-packages
(cons name package-selected-packages)))
- (if-let ((transaction
- (if (package-desc-p pkg)
- (unless (package-installed-p pkg)
- (package-compute-transaction (list pkg)
- (package-desc-reqs pkg)))
- (package-compute-transaction () (list (list pkg))))))
+ (if-let* ((transaction
+ (if (package-desc-p pkg)
+ (unless (package-installed-p pkg)
+ (package-compute-transaction (list pkg)
+ (package-desc-reqs pkg)))
+ (package-compute-transaction () (list (list pkg))))))
(package-download-transaction transaction)
(message "`%s' is already installed" name))))
(package--update-selected-packages .install .delete)
(package-menu--perform-transaction install-list delete-list)
(when package-selected-packages
- (if-let ((removable (package--removable-packages)))
+ (if-let* ((removable (package--removable-packages)))
(message "Package menu: Operation finished. %d packages %s"
(length removable)
(substitute-command-keys
(defun package-menu--find-and-notify-upgrades ()
"Notify the user of upgradable packages."
- (when-let ((upgrades (package-menu--find-upgrades)))
+ (when-let* ((upgrades (package-menu--find-upgrades)))
(message "%d package%s can be upgraded; type `%s' to mark %s for upgrading."
(length upgrades)
(if (= (length upgrades) 1) "" "s")
"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
(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)) "")
(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
(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)))
(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)))
(save-excursion
(goto-char (point-min))
(while (not (eobp))
- (when-let ((props (get-text-property (point) 'display)))
+ (when-let* ((props (get-text-property (point) 'display)))
(when (and (consp props)
(eq (car props) 'image))
(put-text-property (point) (1+ (point)) 'display nil)
internal-move-group server message-id
nnimap-request-articles-find-limit)))))
;; Move the article to a different method.
- (when-let ((result (eval accept-form)))
+ (when-let* ((result (eval accept-form)))
(nnimap-change-group group server)
(nnimap-delete-article article)
result))))))
(let ((fixed (ibuffer-update-saved-filters-format ibuffer-saved-filters)))
(prog1
(setq ibuffer-saved-filters (cdr fixed))
- (when-let (old-format-detected (car fixed))
+ (when-let* ((old-format-detected (car fixed)))
(let ((warning-series t)
(updated-form
(with-output-to-string
(let ((dir (file-name-directory (cdr (assq 'file info)))))
;; (debug)
(push `(equal ',dir (file-name-directory (cdr (assq 'file info)))) pred)
- (if-let ((covers '(".folder.png" "cover.jpg" "folder.jpg"))
- (cover (cl-loop for file in (directory-files (mpc-file-local-copy dir))
- if (member (downcase file) covers)
- return (concat dir file)))
- (file (with-demoted-errors "MPC: %s"
- (mpc-file-local-copy cover))))
+ (if-let* ((covers '(".folder.png" "cover.jpg" "folder.jpg"))
+ (cover (cl-loop for file in (directory-files (mpc-file-local-copy dir))
+ if (member (downcase file) covers)
+ return (concat dir file)))
+ (file (with-demoted-errors "MPC: %s"
+ (mpc-file-local-copy cover))))
(let (image)
(if (null size) (setq image (create-image file))
(let ((tempfile (make-temp-file "mpc" nil ".jpg")))
(defun eww-tag-meta (dom)
(when (and (cl-equalp (dom-attr dom 'http-equiv) "refresh")
(< eww-redirect-level 5))
- (when-let (refresh (dom-attr dom 'content))
+ (when-let* ((refresh (dom-attr dom 'content)))
(when (or (string-match "^\\([0-9]+\\) *;.*url=\"\\([^\"]+\\)\"" refresh)
(string-match "^\\([0-9]+\\) *;.*url='\\([^']+\\)'" refresh)
(string-match "^\\([0-9]+\\) *;.*url=\\([^ ]+\\)" refresh))
See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(defun eww-process-text-input (beg end replace-length)
- (when-let (pos (and (< (1+ end) (point-max))
- (> (1- end) (point-min))
- (cond
- ((get-text-property (1+ end) 'eww-form)
- (1+ end))
- ((get-text-property (1- end) 'eww-form)
- (1- end)))))
+ (when-let* ((pos (and (< (1+ end) (point-max))
+ (> (1- end) (point-min))
+ (cond
+ ((get-text-property (1+ end) 'eww-form)
+ (1+ end))
+ ((get-text-property (1- end) 'eww-form)
+ (1- end))))))
(let* ((form (get-text-property pos 'eww-form))
(properties (text-properties-at pos))
(buffer-undo-list t)
(setq eww-data (list :title ""))
;; Don't let the history grow infinitely. We store quite a lot of
;; data per page.
- (when-let (tail (and eww-history-limit
- (nthcdr eww-history-limit eww-history)))
+ (when-let* ((tail (and eww-history-limit
+ (nthcdr eww-history-limit eww-history))))
(setcdr tail nil)))
(defvar eww-current-buffer)
plist)))
(defun shr-tag-base (dom)
- (when-let (base (dom-attr dom 'href))
+ (when-let* ((base (dom-attr dom 'href)))
(setq shr-base (shr-parse-base base)))
(shr-generic dom))
(unless shr-inhibit-images
(let ((start (point))
url multimedia image)
- (when-let (type (dom-attr dom 'type))
+ (when-let* ((type (dom-attr dom 'type)))
(when (string-match "\\`image/svg" type)
(setq url (dom-attr dom 'data)
image t)))
(when (and (not (stringp column))
(or (memq (dom-tag column) '(td th))
(not column)))
- (when-let (span (dom-attr column 'rowspan))
+ (when-let* ((span (dom-attr column 'rowspan)))
(aset rowspans i (+ (aref rowspans i)
(1- (string-to-number span)))))
;; Sanity check for invalid column-spans.
(apply #'font-lock-flush prettify-symbols--current-symbol-bounds)
(setq prettify-symbols--current-symbol-bounds nil))
;; Unprettify the current symbol.
- (when-let ((c (get-prop-as-list 'composition))
- (s (get-prop-as-list 'prettify-symbols-start))
- (e (get-prop-as-list 'prettify-symbols-end))
- (s (apply #'min s))
- (e (apply #'max e)))
+ (when-let* ((c (get-prop-as-list 'composition))
+ (s (get-prop-as-list 'prettify-symbols-start))
+ (e (get-prop-as-list 'prettify-symbols-end))
+ (s (apply #'min s))
+ (e (apply #'max e)))
(with-silent-modifications
(setq prettify-symbols--current-symbol-bounds (list s e))
(remove-text-properties s e '(composition))))))
(defun svg-remove (svg id)
"Remove the element identified by ID from SVG."
- (when-let ((node (car (dom-by-id
- svg
- (concat "\\`" (regexp-quote id)
- "\\'")))))
+ (when-let* ((node (car (dom-by-id
+ svg
+ (concat "\\`" (regexp-quote id)
+ "\\'")))))
(dom-remove-node svg node)))
(provide 'svg)
"Check whether STR, seen at point, is CSS named color.
Returns STR if it is a valid color. Special care is taken
to exclude some SCSS constructs."
- (when-let ((color (assoc str css--color-map)))
+ (when-let* ((color (assoc str css--color-map)))
(save-excursion
(goto-char start-point)
(forward-comment (- (point)))
(defun css--colon-inside-funcall ()
"Return t if point is inside a function call."
- (when-let (opening-paren-pos (nth 1 (syntax-ppss)))
+ (when-let* ((opening-paren-pos (nth 1 (syntax-ppss))))
(save-excursion
(goto-char opening-paren-pos)
(eq (char-after) ?\())))
(classes
(seq-mapcat
(lambda (el)
- (when-let (class-list
- (cdr (assq 'class (dom-attributes el))))
+ (when-let* ((class-list
+ (cdr (assq 'class (dom-attributes el)))))
(split-string class-list)))
(dom-by-class dom ""))))
(setq-local html--buffer-classes-cache (cons tick classes))
(ids
(seq-mapcat
(lambda (el)
- (when-let (id-list
- (cdr (assq 'id (dom-attributes el))))
+ (when-let* ((id-list
+ (cdr (assq 'id (dom-attributes el)))))
(split-string id-list)))
(dom-by-id dom ""))))
(setq-local html--buffer-ids-cache (cons tick ids))