diff options
author | Stefan Kangas <stefan@marxist.se> | 2022-08-09 18:15:56 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2022-08-09 18:15:56 +0200 |
commit | 3ef18c7a213f4f3c03eec033fcb8219fb17cd53d (patch) | |
tree | 889cecf146a27847abc3c71ea23985083d19365f /lisp/ibuf-ext.el | |
parent | b0653b27e25bfad2416364c33e1a5994285435c4 (diff) | |
download | emacs-3ef18c7a213f4f3c03eec033fcb8219fb17cd53d.tar.gz |
Make ibuffer-aif obsolete in favor of if-let
* lisp/ibuf-macs.el (ibuffer-aif): Make obsolete in favor of 'if-let'.
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-mark-interactive, ibuffer-compile-format, process):
Prefer 'if-let' to above obsolete macro.
(ibuffer-toggle-marks, ibuffer-map-lines): Prefer 'when-let'
to above obsolete macro.
Diffstat (limited to 'lisp/ibuf-ext.el')
-rw-r--r-- | lisp/ibuf-ext.el | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index a56c1a87212..44c1ae867d4 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -865,7 +865,7 @@ specification, with the same structure as an element of the list "Move point to the filter group whose name is NAME." (interactive (list (ibuffer-read-filter-group-name "Jump to filter group: "))) - (ibuffer-aif (assoc name (ibuffer-current-filter-groups-with-position)) + (if-let ((it (assoc name (ibuffer-current-filter-groups-with-position)))) (goto-char (cdr it)) (error "No filter group with name %s" name))) @@ -876,7 +876,7 @@ The group will be added to `ibuffer-filter-group-kill-ring'." (interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t))) (when (equal name "Default") (error "Can't kill default filter group")) - (ibuffer-aif (assoc name ibuffer-filter-groups) + (if-let ((it (assoc name ibuffer-filter-groups))) (progn (push (copy-tree it) ibuffer-filter-group-kill-ring) (setq ibuffer-filter-groups (ibuffer-remove-alist @@ -891,13 +891,12 @@ The group will be added to `ibuffer-filter-group-kill-ring'." "Kill the filter group at point. See also `ibuffer-kill-filter-group'." (interactive "P\np") - (ibuffer-aif (save-excursion - (ibuffer-forward-line 0) - (get-text-property (point) 'ibuffer-filter-group-name)) - (progn - (ibuffer-kill-filter-group it)) - (funcall (if interactive-p #'call-interactively #'funcall) - #'kill-line arg))) + (if-let ((it (save-excursion + (ibuffer-forward-line 0) + (get-text-property (point) 'ibuffer-filter-group-name)))) + (ibuffer-kill-filter-group it) + (funcall (if interactive-p #'call-interactively #'funcall) + #'kill-line arg))) (defun ibuffer-insert-filter-group-before (newgroup group) (let* ((found nil) @@ -953,7 +952,7 @@ prompt for NAME, and use the current filters." (list (read-from-minibuffer "Save current filter groups as: ") ibuffer-filter-groups))) - (ibuffer-aif (assoc name ibuffer-saved-filter-groups) + (if-let ((it (assoc name ibuffer-saved-filter-groups))) (setcdr it groups) (push (cons name groups) ibuffer-saved-filter-groups)) (ibuffer-maybe-save-stuff)) @@ -1125,7 +1124,7 @@ Interactively, prompt for NAME, and use the current filters." (list (read-from-minibuffer "Save current filters as: ") ibuffer-filtering-qualifiers))) - (ibuffer-aif (assoc name ibuffer-saved-filters) + (if-let ((it (assoc name ibuffer-saved-filters))) (setcdr it filters) (push (cons name filters) ibuffer-saved-filters)) (ibuffer-maybe-save-stuff)) @@ -1337,11 +1336,11 @@ pattern. For example, for a buffer associated with file For a buffer associated with file '/a/b/c.d', this matches against '/a/b'. For a buffer not associated with a file, this matches against the value of `default-directory' in that buffer." - (:description "directory name" - :reader (read-from-minibuffer "Filter by directory name (regex): ")) - (ibuffer-aif (with-current-buffer buf (ibuffer-buffer-file-name)) - (let ((dirname (file-name-directory it))) - (when dirname (string-match qualifier dirname))) + ( :description "directory name" + :reader (read-from-minibuffer "Filter by directory name (regex): ")) + (if-let ((it (with-current-buffer buf (ibuffer-buffer-file-name)))) + (when-let ((dirname (file-name-directory it))) + (string-match qualifier dirname)) (when default-directory (string-match qualifier default-directory)))) ;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext") |