aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Paul Wallington2003-07-05 11:24:00 +0000
committerJohn Paul Wallington2003-07-05 11:24:00 +0000
commit34a4faa04b8ad2d969fabd543b62c6c244a7fa17 (patch)
tree7dacc891622082409a08d4f1ce519f75930ba74e
parent2bf1ab74960f65e3e77d60ce02115493e8cd9018 (diff)
downloademacs-34a4faa04b8ad2d969fabd543b62c6c244a7fa17.tar.gz
emacs-34a4faa04b8ad2d969fabd543b62c6c244a7fa17.zip
(ibuffer-backward-line, ibuffer-forward-line)
(ibuffer-mark-interactive): Use `or' instead of `unless'. (define-ibuffer-column name): Add summarizer. (define-ibuffer-column size): Likewise. (define-ibuffer-column filename): Likewise. (define-ibuffer-column process): Likewise. Change BODY's output too. (define-ibuffer-column filename-and-process): Likewise, likewise. (ibuffer): Remove local vars `already-in' and `need-update'.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/ibuffer.el111
2 files changed, 92 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index aa12b55cf7a..9776891068c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12003-07-05 John Paul Wallington <jpw@gnu.org>
2
3 * ibuffer.el (ibuffer-backward-line, ibuffer-forward-line)
4 (ibuffer-mark-interactive): Use `or' instead of `unless'.
5 (define-ibuffer-column name): Add summarizer.
6 (define-ibuffer-column size): Likewise.
7 (define-ibuffer-column filename): Likewise.
8 (define-ibuffer-column process): Likewise. Change BODY's output too.
9 (define-ibuffer-column filename-and-process): Likewise, likewise.
10 (ibuffer): Remove local vars `already-in' and `need-update'.
11
12 * ibuf-ext.el: Don't require `derived' at compile-time.
13
12003-07-05 Kim F. Storm <storm@cua.dk> 142003-07-05 Kim F. Storm <storm@cua.dk>
2 15
3 * info.el: Disable paragraph refilling. 16 * info.el: Disable paragraph refilling.
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 2b996490fad..23bf4e55d68 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -757,11 +757,13 @@ directory, like `default-directory'."
757(define-key ibuffer-mode-groups-popup [kill-filter-group] 757(define-key ibuffer-mode-groups-popup [kill-filter-group]
758 '(menu-item "Kill filter group" 758 '(menu-item "Kill filter group"
759 ibuffer-kill-line 759 ibuffer-kill-line
760 :enable (and (featurep 'ibuf-ext) ibuffer-filter-groups))) 760 :enable (and (featurep 'ibuf-ext)
761 ibuffer-filter-groups)))
761(define-key ibuffer-mode-groups-popup [yank-filter-group] 762(define-key ibuffer-mode-groups-popup [yank-filter-group]
762 '(menu-item "Yank last killed filter group" 763 '(menu-item "Yank last killed filter group"
763 ibuffer-yank 764 ibuffer-yank
764 :enable (and (featurep 'ibuf-ext) ibuffer-filter-group-kill-ring))) 765 :enable (and (featurep 'ibuf-ext)
766 ibuffer-filter-group-kill-ring)))
765 767
766(defvar ibuffer-name-map 768(defvar ibuffer-name-map
767 (let ((map (make-sparse-keymap))) 769 (let ((map (make-sparse-keymap)))
@@ -904,15 +906,15 @@ width and the longest string in LIST."
904(defun ibuffer-backward-line (&optional arg skip-group-names) 906(defun ibuffer-backward-line (&optional arg skip-group-names)
905 "Move backwards ARG lines, wrapping around the list if necessary." 907 "Move backwards ARG lines, wrapping around the list if necessary."
906 (interactive "P") 908 (interactive "P")
907 (unless arg 909 (or arg (setq arg 1))
908 (setq arg 1))
909 (beginning-of-line) 910 (beginning-of-line)
910 (while (> arg 0) 911 (while (> arg 0)
911 (forward-line -1) 912 (forward-line -1)
912 (when (and ibuffer-movement-cycle 913 (when (and ibuffer-movement-cycle
913 (or (get-text-property (point) 'ibuffer-title) 914 (or (get-text-property (point) 'ibuffer-title)
914 (and skip-group-names 915 (and skip-group-names
915 (get-text-property (point) 'ibuffer-filter-group-name)))) 916 (get-text-property (point)
917 'ibuffer-filter-group-name))))
916 (goto-char (point-max)) 918 (goto-char (point-max))
917 (beginning-of-line)) 919 (beginning-of-line))
918 (ibuffer-skip-properties (append '(ibuffer-summary) 920 (ibuffer-skip-properties (append '(ibuffer-summary)
@@ -928,8 +930,7 @@ width and the longest string in LIST."
928(defun ibuffer-forward-line (&optional arg skip-group-names) 930(defun ibuffer-forward-line (&optional arg skip-group-names)
929 "Move forward ARG lines, wrapping around the list if necessary." 931 "Move forward ARG lines, wrapping around the list if necessary."
930 (interactive "P") 932 (interactive "P")
931 (unless arg 933 (or arg (setq arg 1))
932 (setq arg 1))
933 (beginning-of-line) 934 (beginning-of-line)
934 (when (and ibuffer-movement-cycle 935 (when (and ibuffer-movement-cycle
935 (or (eobp) 936 (or (eobp)
@@ -1266,8 +1267,7 @@ If point is on a group name, this function operates on that group."
1266 1267
1267(defun ibuffer-mark-interactive (arg mark movement) 1268(defun ibuffer-mark-interactive (arg mark movement)
1268 (assert (eq major-mode 'ibuffer-mode)) 1269 (assert (eq major-mode 'ibuffer-mode))
1269 (unless arg 1270 (or arg (setq arg 1))
1270 (setq arg 1))
1271 (ibuffer-forward-line 0) 1271 (ibuffer-forward-line 0)
1272 (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name) 1272 (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name)
1273 (progn 1273 (progn
@@ -1391,7 +1391,7 @@ If point is on a group name, this function operates on that group."
1391 1391
1392(defun ibuffer-compile-make-format-form (strvar widthform alignment) 1392(defun ibuffer-compile-make-format-form (strvar widthform alignment)
1393 (let* ((left `(make-string tmp2 ? )) 1393 (let* ((left `(make-string tmp2 ? ))
1394 (right `(make-string (- tmp1 tmp2) ? ))) 1394 (right `(make-string (- tmp1 tmp2) ? )))
1395 `(progn 1395 `(progn
1396 (setq tmp1 ,widthform 1396 (setq tmp1 ,widthform
1397 tmp2 (/ tmp1 2)) 1397 tmp2 (/ tmp1 2))
@@ -1602,7 +1602,7 @@ If point is on a group name, this function operates on that group."
1602 1602
1603(define-ibuffer-column read-only (:name "R" :inline t) 1603(define-ibuffer-column read-only (:name "R" :inline t)
1604 (if buffer-read-only 1604 (if buffer-read-only
1605 "%" 1605 (string ibuffer-read-only-char)
1606 " ")) 1606 " "))
1607 1607
1608(define-ibuffer-column modified (:name "M" :inline t) 1608(define-ibuffer-column modified (:name "M" :inline t)
@@ -1610,16 +1610,33 @@ If point is on a group name, this function operates on that group."
1610 (string ibuffer-modified-char) 1610 (string ibuffer-modified-char)
1611 " ")) 1611 " "))
1612 1612
1613(define-ibuffer-column name (:inline t 1613(define-ibuffer-column name
1614 :props 1614 (:inline t
1615 ('mouse-face 'highlight 'keymap ibuffer-name-map 1615 :props
1616 'ibuffer-name-column t 1616 ('mouse-face 'highlight 'keymap ibuffer-name-map
1617 'help-echo '(if tooltip-mode 1617 'ibuffer-name-column t
1618 "mouse-1: mark this buffer\nmouse-2: select this buffer\nmouse-3: operate on this buffer" 1618 'help-echo '(if tooltip-mode
1619 "mouse-1: mark buffer mouse-2: select buffer mouse-3: operate"))) 1619 "mouse-1: mark this buffer\nmouse-2: select this buffer\nmouse-3: operate on this buffer"
1620 "mouse-1: mark buffer mouse-2: select buffer mouse-3: operate"))
1621 :summarizer
1622 (lambda (strings)
1623 (let ((bufs (length strings)))
1624 (cond ((zerop bufs) "No buffers")
1625 ((= 1 bufs) "1 buffer")
1626 (t (format "%s buffers" bufs))))))
1620 (propertize (buffer-name) 'font-lock-face (ibuffer-buffer-name-face buffer mark))) 1627 (propertize (buffer-name) 'font-lock-face (ibuffer-buffer-name-face buffer mark)))
1621 1628
1622(define-ibuffer-column size (:inline t) 1629(define-ibuffer-column size
1630 (:inline t
1631 :summarizer
1632 (lambda (column-strings)
1633 (let ((total 0))
1634 (dolist (string column-strings)
1635 (setq total
1636 ;; like, ewww ...
1637 (+ (float (string-to-int string))
1638 total)))
1639 (format "%.0f" total))))
1623 (format "%s" (buffer-size))) 1640 (format "%s" (buffer-size)))
1624 1641
1625(define-ibuffer-column mode (:inline t 1642(define-ibuffer-column mode (:inline t
@@ -1629,12 +1646,24 @@ If point is on a group name, this function operates on that group."
1629 'help-echo "mouse-2: filter by this mode")) 1646 'help-echo "mouse-2: filter by this mode"))
1630 (format "%s" mode-name)) 1647 (format "%s" mode-name))
1631 1648
1632(define-ibuffer-column process () 1649(define-ibuffer-column process
1650 (:summarizer
1651 (lambda (strings)
1652 (let ((total (length (delete "" strings))))
1653 (cond ((zerop total) "No processes")
1654 ((= 1 total) "1 process")
1655 (t (format "%d processes" total))))))
1633 (ibuffer-aif (get-buffer-process buffer) 1656 (ibuffer-aif (get-buffer-process buffer)
1634 (format "(%s %s)" it (process-status it)) 1657 (format "(%s %s)" it (process-status it))
1635 "none")) 1658 ""))
1636 1659
1637(define-ibuffer-column filename () 1660(define-ibuffer-column filename
1661 (:summarizer
1662 (lambda (strings)
1663 (let ((total (length (delete "" strings))))
1664 (cond ((zerop total) "No files")
1665 ((= 1 total) "1 file")
1666 (t (format "%d files" total))))))
1638 (let ((directory-abbrev-alist ibuffer-directory-abbrev-alist)) 1667 (let ((directory-abbrev-alist ibuffer-directory-abbrev-alist))
1639 (abbreviate-file-name 1668 (abbreviate-file-name
1640 (or buffer-file-name 1669 (or buffer-file-name
@@ -1642,13 +1671,34 @@ If point is on a group name, this function operates on that group."
1642 dired-directory) 1671 dired-directory)
1643 "")))) 1672 ""))))
1644 1673
1645(define-ibuffer-column filename-and-process (:name "Filename/Process") 1674(define-ibuffer-column filename-and-process
1675 (:name "Filename/Process"
1676 :summarizer
1677 (lambda (strings)
1678 (setq strings (delete "" strings))
1679 (let ((procs 0)
1680 (files 0))
1681 (dolist (string strings)
1682 (if (string-match "\\(\?:\\`(\[\[:ascii:\]\]\+)\\)" string)
1683 (progn (setq procs (1+ procs))
1684 (if (< (match-end 0) (length string))
1685 (setq files (1+ files))))
1686 (setq files (1+ files))))
1687 (concat (cond ((zerop files) "No files")
1688 ((= 1 files) "1 file")
1689 (t (format "%d files" files)))
1690 ", "
1691 (cond ((zerop procs) "no processes")
1692 ((= 1 procs) "1 process")
1693 (t (format "%d processes" procs)))))))
1646 (let ((proc (get-buffer-process buffer)) 1694 (let ((proc (get-buffer-process buffer))
1647 (filename (ibuffer-make-column-filename buffer mark))) 1695 (filename (ibuffer-make-column-filename buffer mark)))
1648 (if proc 1696 (if proc
1649 (concat (propertize (format "(%s %s) " proc (process-status proc)) 1697 (concat (propertize (format "(%s %s)" proc (process-status proc))
1650 'font-lock-face 'italic) 1698 'font-lock-face 'italic)
1651 filename) 1699 (if (> (length filename) 0)
1700 (format " %s" filename)
1701 ""))
1652 filename))) 1702 filename)))
1653 1703
1654(defun ibuffer-format-column (str width alignment) 1704(defun ibuffer-format-column (str width alignment)
@@ -2182,9 +2232,7 @@ locally in this buffer."
2182 (interactive "P") 2232 (interactive "P")
2183 (when ibuffer-use-other-window 2233 (when ibuffer-use-other-window
2184 (setq other-window-p t)) 2234 (setq other-window-p t))
2185 (let* ((buf (get-buffer-create (or name "*Ibuffer*"))) 2235 (let ((buf (get-buffer-create (or name "*Ibuffer*"))))
2186 (already-in (eq (current-buffer) buf))
2187 (need-update nil))
2188 (if other-window-p 2236 (if other-window-p
2189 (funcall (if noselect #'(lambda (buf) (display-buffer buf t)) #'pop-to-buffer) buf) 2237 (funcall (if noselect #'(lambda (buf) (display-buffer buf t)) #'pop-to-buffer) buf)
2190 (funcall (if noselect #'display-buffer #'switch-to-buffer) buf)) 2238 (funcall (if noselect #'display-buffer #'switch-to-buffer) buf))
@@ -2193,9 +2241,8 @@ locally in this buffer."
2193 ;; We switch to the buffer's window in order to be able 2241 ;; We switch to the buffer's window in order to be able
2194 ;; to modify the value of point 2242 ;; to modify the value of point
2195 (select-window (get-buffer-window buf)) 2243 (select-window (get-buffer-window buf))
2196 (unless (eq major-mode 'ibuffer-mode) 2244 (or (eq major-mode 'ibuffer-mode)
2197 (ibuffer-mode) 2245 (ibuffer-mode))
2198 (setq need-update t))
2199 (setq ibuffer-delete-window-on-quit other-window-p) 2246 (setq ibuffer-delete-window-on-quit other-window-p)
2200 (when shrink 2247 (when shrink
2201 (setq ibuffer-shrink-to-minimum-size shrink)) 2248 (setq ibuffer-shrink-to-minimum-size shrink))