summaryrefslogtreecommitdiff
path: root/lisp/ibuffer.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ibuffer.el')
-rw-r--r--lisp/ibuffer.el88
1 files changed, 42 insertions, 46 deletions
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index adb7a12243a..33fab8c9948 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -31,7 +31,7 @@
;;; Code:
(eval-when-compile
- (require 'cl)
+ (require 'cl-lib)
(require 'ibuf-macs)
(require 'dired))
@@ -1017,7 +1017,7 @@ width and the longest string in LIST."
(when (get-text-property (point) 'ibuffer-title)
(forward-line 1)
(setq arg 1))
- (decf arg)))
+ (cl-decf arg)))
(defun ibuffer-forward-line (&optional arg skip-group-names)
"Move forward ARG lines, wrapping around the list if necessary."
@@ -1032,7 +1032,7 @@ width and the longest string in LIST."
(and skip-group-names
(get-text-property (point) 'ibuffer-filter-group-name)))
(when (> arg 0)
- (decf arg))
+ (cl-decf arg))
(ibuffer-skip-properties (append '(ibuffer-title)
(when skip-group-names
'(ibuffer-filter-group-name)))
@@ -1045,7 +1045,7 @@ width and the longest string in LIST."
(or (eobp)
(get-text-property (point) 'ibuffer-summary)))
(goto-char (point-min)))
- (decf arg)
+ (cl-decf arg)
(ibuffer-skip-properties (append '(ibuffer-title)
(when skip-group-names
'(ibuffer-filter-group-name)))
@@ -1190,7 +1190,7 @@ a new window in the current frame, splitting vertically."
(setq trying nil))
(error
;; Handle a failure
- (if (or (> (incf attempts) 4)
+ (if (or (> (cl-incf attempts) 4)
(and (stringp (cadr err))
;; This definitely falls in the
;; ghetto hack category...
@@ -1243,7 +1243,7 @@ a new window in the current frame, splitting vertically."
(ibuffer-map-on-mark ibuffer-deletion-char func))
(defsubst ibuffer-assert-ibuffer-mode ()
- (assert (derived-mode-p 'ibuffer-mode)))
+ (cl-assert (derived-mode-p 'ibuffer-mode)))
(defun ibuffer-buffer-file-name ()
(or buffer-file-name
@@ -1504,11 +1504,11 @@ If point is on a group name, this function operates on that group."
`(progn
(setq tmp1 ,widthform
tmp2 (/ tmp1 2))
- ,(case alignment
+ ,(pcase alignment
(:right `(concat ,left ,right ,strvar))
(:center `(concat ,left ,strvar ,right))
(:left `(concat ,strvar ,left ,right))
- (t (error "Invalid alignment %s" alignment))))))
+ (_ (error "Invalid alignment %s" alignment))))))
(defun ibuffer-compile-format (format)
(let ((result nil)
@@ -1529,7 +1529,7 @@ If point is on a group name, this function operates on that group."
(max (nth 2 form))
(align (nth 3 form))
(elide (nth 4 form)))
- (let* ((from-end-p (when (minusp min)
+ (let* ((from-end-p (when (cl-minusp min)
(setq min (- min))
t))
(letbindings nil)
@@ -1812,10 +1812,10 @@ If point is on a group name, this function operates on that group."
(defun ibuffer-format-column (str width alignment)
(let ((left (make-string (/ width 2) ?\s))
(right (make-string (- width (/ width 2)) ?\s)))
- (case alignment
+ (pcase alignment
(:right (concat left right str))
(:center (concat left str right))
- (t (concat str left right)))))
+ (_ (concat str left right)))))
(defun ibuffer-buffer-name-face (buf mark)
(cond ((char-equal mark ibuffer-marked-char)
@@ -1913,18 +1913,18 @@ the buffer object itself and the current mark symbol."
;; `nil' if it chose not to affect the buffer
;; `kill' means the remove line from the buffer list
;; `t' otherwise
- (incf ibuffer-map-lines-total)
+ (cl-incf ibuffer-map-lines-total)
(cond ((null result)
(forward-line 1))
((eq result 'kill)
(delete-region (line-beginning-position)
(1+ (line-end-position)))
- (incf ibuffer-map-lines-count)
+ (cl-incf ibuffer-map-lines-count)
(when (< ibuffer-map-lines-total
orig-target-line)
- (decf target-line-offset)))
+ (cl-decf target-line-offset)))
(t
- (incf ibuffer-map-lines-count)
+ (cl-incf ibuffer-map-lines-count)
(forward-line 1)))))
ibuffer-map-lines-count)
(progn
@@ -2054,12 +2054,9 @@ the value of point at the beginning of the line for that buffer."
(insert
(if (stringp element)
element
- (let ((sym (car element))
- (min (cadr element))
- ;; (max (caddr element))
- (align (cadddr element)))
+ (pcase-let ((`(,sym ,min ,_max ,align) element))
;; Ignore a negative min when we're inserting the title
- (when (minusp min)
+ (when (cl-minusp min)
(setq min (- min)))
(let* ((name (or (get sym 'ibuffer-column-name)
(error "Unknown column %s in ibuffer-formats" sym)))
@@ -2107,24 +2104,23 @@ the value of point at the beginning of the line for that buffer."
(insert
(if (stringp element)
(make-string (length element) ?\s)
- (let ((sym (car element)))
- (let ((min (cadr element))
- ;; (max (caddr element))
- (align (cadddr element)))
- ;; Ignore a negative min when we're inserting the title
- (when (minusp min)
- (setq min (- min)))
- (let* ((summary (if (get sym 'ibuffer-column-summarizer)
- (funcall (get sym 'ibuffer-column-summarizer)
- (get sym 'ibuffer-column-summary))
- (make-string (length (get sym 'ibuffer-column-name))
- ?\s)))
- (len (length summary)))
- (if (< len min)
- (ibuffer-format-column summary
- (- min len)
- align)
- summary)))))))
+ (pcase-let ((`(,sym ,min ,_max ,align) element))
+ ;; Ignore a negative min when we're inserting the title.
+ (when (cl-minusp min)
+ (setq min (- min)))
+ (let* ((summary
+ (if (get sym 'ibuffer-column-summarizer)
+ (funcall (get sym 'ibuffer-column-summarizer)
+ (get sym 'ibuffer-column-summary))
+ (make-string
+ (length (get sym 'ibuffer-column-name))
+ ?\s)))
+ (len (length summary)))
+ (if (< len min)
+ (ibuffer-format-column summary
+ (- min len)
+ align)
+ summary))))))
(point))
`(ibuffer-summary t)))))
@@ -2168,7 +2164,7 @@ If optional arg SILENT is non-nil, do not display progress messages."
(eq ibuffer-always-show-last-buffer
:nomini)
(minibufferp (cadr bufs)))
- (caddr bufs)
+ (cl-caddr bufs)
(cadr bufs))
(ibuffer-current-buffers-with-marks bufs)
ibuffer-display-maybe-show-predicates)))
@@ -2200,7 +2196,7 @@ If optional arg SILENT is non-nil, do not display progress messages."
(require 'ibuf-ext))
(let* ((sortdat (assq ibuffer-sorting-mode
ibuffer-sorting-functions-alist))
- (func (caddr sortdat)))
+ (func (cl-caddr sortdat)))
(let ((result
;; actually sort the buffers
(if (and sortdat func)
@@ -2574,11 +2570,11 @@ will be inserted before the group at point."
;; `ibuffer-update' puts this on header-line-format when needed.
(setq ibuffer-header-line-format
;; Display the part that won't be in the mode-line.
- (list* "" mode-name
- (mapcar (lambda (elem)
- (if (eq (car-safe elem) 'header-line-format)
- (nth 2 elem) elem))
- mode-line-process)))
+ `("" ,mode-name
+ ,@(mapcar (lambda (elem)
+ (if (eq (car-safe elem) 'header-line-format)
+ (nth 2 elem) elem))
+ mode-line-process)))
(setq buffer-read-only t)
(buffer-disable-undo)
@@ -2645,7 +2641,7 @@ will be inserted before the group at point."
;;;;;; ibuffer-backward-filter-group ibuffer-forward-filter-group
;;;;;; ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
;;;;;; ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
-;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "296999191b08d76d9763a8ebf510d5d8")
+;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "c255d1ebe80ccabd8385f40bdd0b5451")
;;; Generated autoloads from ibuf-ext.el
(autoload 'ibuffer-auto-mode "ibuf-ext" "\