Make ibuffer-awhen obsolete in favor of when-let
* lisp/ibuf-macs.el (ibuffer-awhen): Make obsolete in favor of 'when-let'. Update callers.
This commit is contained in:
parent
d3f6edf5aa
commit
accb1d1132
3 changed files with 8 additions and 9 deletions
|
@ -48,7 +48,7 @@
|
|||
;;; Utility functions
|
||||
(defun ibuffer-remove-alist (key alist)
|
||||
"Remove all entries in ALIST that have a key equal to KEY."
|
||||
(while (ibuffer-awhen (assoc key alist)
|
||||
(while (when-let ((it (assoc key alist)))
|
||||
(setq alist (remove it alist)) it))
|
||||
alist)
|
||||
|
||||
|
@ -1313,7 +1313,7 @@ For example, for a buffer associated with file '/a/b/c.d', this
|
|||
matches against '/a/b/c.d'."
|
||||
(:description "full file name"
|
||||
:reader (read-from-minibuffer "Filter by full file name (regexp): "))
|
||||
(ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
|
||||
(when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
|
||||
(string-match qualifier it)))
|
||||
|
||||
;;;###autoload (autoload 'ibuffer-filter-by-basename "ibuf-ext")
|
||||
|
@ -1325,7 +1325,7 @@ matches against `c.d'."
|
|||
(:description "file basename"
|
||||
:reader (read-from-minibuffer
|
||||
"Filter by file name, without directory part (regex): "))
|
||||
(ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
|
||||
(when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
|
||||
(string-match qualifier (file-name-nondirectory it))))
|
||||
|
||||
;;;###autoload (autoload 'ibuffer-filter-by-file-extension "ibuf-ext")
|
||||
|
@ -1338,7 +1338,7 @@ pattern. For example, for a buffer associated with file
|
|||
(:description "filename extension"
|
||||
:reader (read-from-minibuffer
|
||||
"Filter by filename extension without separator (regex): "))
|
||||
(ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
|
||||
(when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
|
||||
(string-match qualifier (or (file-name-extension it) ""))))
|
||||
|
||||
;;;###autoload (autoload 'ibuffer-filter-by-directory "ibuf-ext")
|
||||
|
|
|
@ -47,10 +47,9 @@ Compare with `if'."
|
|||
(defmacro ibuffer-awhen (test &rest body)
|
||||
"Evaluate BODY if TEST returns non-nil.
|
||||
During evaluation of body, bind `it' to the value returned by TEST."
|
||||
(declare (indent 1))
|
||||
`(ibuffer-aif ,test
|
||||
(progn ,@body)
|
||||
nil))
|
||||
(declare (indent 1) (obsolete when-let "29.1"))
|
||||
`(when-let ((it ,test))
|
||||
,@body))
|
||||
|
||||
(defmacro ibuffer-save-marks (&rest body)
|
||||
"Save the marked status of the buffers and execute BODY; restore marks."
|
||||
|
|
|
@ -132,7 +132,7 @@
|
|||
(ibuffer-switch-to-saved-filter-groups "saved-filters")
|
||||
(should (assoc "Elisp" (cdar ibuffer-saved-filter-groups))))
|
||||
(setq ibuffer-saved-filter-groups orig-filters)
|
||||
(ibuffer-awhen (get-buffer "*Ibuffer*")
|
||||
(when-let ((it (get-buffer "*Ibuffer*")))
|
||||
(and (buffer-live-p it) (kill-buffer it))))))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue