/[emacs]/emacs/lisp/ibuffer.el
ViewVC logotype

Diff of /emacs/lisp/ibuffer.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.69 by lute, Mon Jul 4 23:08:54 2005 UTC revision 1.70 by lektu, Fri Jul 29 15:10:37 2005 UTC
# Line 1  Line 1 
1  ;;; ibuffer.el --- operate on buffers like dired  ;;; ibuffer.el --- operate on buffers like dired
2    
3  ;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.  ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
4    ;;   Free Software Foundation, Inc.
5    
6  ;; Author: Colin Walters <walters@verbum.org>  ;; Author: Colin Walters <walters@verbum.org>
7  ;; Maintainer: John Paul Wallington <jpw@gnu.org>  ;; Maintainer: John Paul Wallington <jpw@gnu.org>
# Line 193  view of the buffers." Line 194  view of the buffers."
194  (defvar ibuffer-sorting-reversep nil)  (defvar ibuffer-sorting-reversep nil)
195    
196  (defcustom ibuffer-elide-long-columns nil  (defcustom ibuffer-elide-long-columns nil
197    "If non-nil, then elide column entries which exceed their max length.    "If non-nil, then elide column entries which exceed their max length."
 This variable is deprecated; use the :elide argument of  
 `ibuffer-formats' to elide just certain columns."  
198    :type 'boolean    :type 'boolean
199    :group 'ibuffer)    :group 'ibuffer)
200    (make-obsolete-variable 'ibuffer-elide-long-columns
201                            "use the :elide argument of `ibuffer-formats'."
202                            "22.1")
203    
204  (defcustom ibuffer-eliding-string "..."  (defcustom ibuffer-eliding-string "..."
205    "The string to use for eliding long columns."    "The string to use for eliding long columns."
# Line 307  directory, like `default-directory'." Line 309  directory, like `default-directory'."
309    "Hook run when `ibuffer' is called."    "Hook run when `ibuffer' is called."
310    :type 'hook    :type 'hook
311    :group 'ibuffer)    :group 'ibuffer)
312  (defvaralias 'ibuffer-hooks 'ibuffer-hook)  (define-obsolete-variable-alias 'ibuffer-hooks
313                                    'ibuffer-hook "22.1")
314    
315  (defcustom ibuffer-mode-hook nil  (defcustom ibuffer-mode-hook nil
316    "Hook run upon entry into `ibuffer-mode'."    "Hook run upon entry into `ibuffer-mode'."
317    :type 'hook    :type 'hook
318    :group 'ibuffer)    :group 'ibuffer)
319  (defvaralias 'ibuffer-mode-hooks 'ibuffer-mode-hook)  (define-obsolete-variable-alias 'ibuffer-mode-hooks
320                                    'ibuffer-mode-hook "22.1")
321    
322  (defcustom ibuffer-load-hook nil  (defcustom ibuffer-load-hook nil
323    "Hook run when Ibuffer is loaded."    "Hook run when Ibuffer is loaded."
# Line 838  width and the longest string in LIST." Line 842  width and the longest string in LIST."
842        (while list        (while list
843          (dotimes (i (1- columns))          (dotimes (i (1- columns))
844            (insert (concat (car list) (make-string (- max (length (car list)))            (insert (concat (car list) (make-string (- max (length (car list)))
845                                                    ? )))                                                    ?\s)))
846            (setq list (cdr list)))            (setq list (cdr list)))
847          (when (not (null list))          (when (not (null list))
848            (insert (pop list)))            (insert (pop list)))
# Line 861  width and the longest string in LIST." Line 865  width and the longest string in LIST."
865            (let ((mark (ibuffer-current-mark)))            (let ((mark (ibuffer-current-mark)))
866              (setq buffer-read-only nil)              (setq buffer-read-only nil)
867              (if (eq mark ibuffer-marked-char)              (if (eq mark ibuffer-marked-char)
868                  (ibuffer-set-mark ? )                  (ibuffer-set-mark ?\s)
869                (ibuffer-set-mark ibuffer-marked-char)))))                (ibuffer-set-mark ibuffer-marked-char)))))
870      (setq buffer-read-only t)))      (setq buffer-read-only t)))
871    
# Line 1153  a new window in the current frame, split Line 1157  a new window in the current frame, split
1157    (if all    (if all
1158        (ibuffer-map-lines-nomodify        (ibuffer-map-lines-nomodify
1159         #'(lambda (buf mark)         #'(lambda (buf mark)
1160             (not (char-equal mark ? ))))             (not (char-equal mark ?\s))))
1161      (ibuffer-map-lines-nomodify      (ibuffer-map-lines-nomodify
1162       #'(lambda (buf mark)       #'(lambda (buf mark)
1163           (char-equal mark ibuffer-marked-char)))))           (char-equal mark ibuffer-marked-char)))))
# Line 1227  a new window in the current frame, split Line 1231  a new window in the current frame, split
1231       ((char-equal mark ibuffer-marked-char)       ((char-equal mark ibuffer-marked-char)
1232        (ibuffer-map-marked-lines        (ibuffer-map-marked-lines
1233         #'(lambda (buf mark)         #'(lambda (buf mark)
1234             (ibuffer-set-mark-1 ? )             (ibuffer-set-mark-1 ?\s)
1235             t)))             t)))
1236       ((char-equal mark ibuffer-deletion-char)       ((char-equal mark ibuffer-deletion-char)
1237        (ibuffer-map-deletion-lines        (ibuffer-map-deletion-lines
1238         #'(lambda (buf mark)         #'(lambda (buf mark)
1239             (ibuffer-set-mark-1 ? )             (ibuffer-set-mark-1 ?\s)
1240             t)))             t)))
1241       (t       (t
1242        (ibuffer-map-lines        (ibuffer-map-lines
1243         #'(lambda (buf mark)         #'(lambda (buf mark)
1244             (when (not (char-equal mark ? ))             (when (not (char-equal mark ?\s))
1245               (ibuffer-set-mark-1 ? ))               (ibuffer-set-mark-1 ?\s))
1246             t)))))             t)))))
1247    (ibuffer-redisplay t))    (ibuffer-redisplay t))
1248    
# Line 1255  group." Line 1259  group."
1259           (ibuffer-map-lines           (ibuffer-map-lines
1260            #'(lambda (buf mark)            #'(lambda (buf mark)
1261                (cond ((eq mark ibuffer-marked-char)                (cond ((eq mark ibuffer-marked-char)
1262                       (ibuffer-set-mark-1 ? )                       (ibuffer-set-mark-1 ?\s)
1263                       nil)                       nil)
1264                      ((eq mark ? )                      ((eq mark ?\s)
1265                       (ibuffer-set-mark-1 ibuffer-marked-char)                       (ibuffer-set-mark-1 ibuffer-marked-char)
1266                       t)                       t)
1267                      (t                      (t
# Line 1276  If point is on a group name, this functi Line 1280  If point is on a group name, this functi
1280    "Unmark the buffer on this line, and move forward ARG lines.    "Unmark the buffer on this line, and move forward ARG lines.
1281  If point is on a group name, this function operates on that group."  If point is on a group name, this function operates on that group."
1282    (interactive "P")    (interactive "P")
1283    (ibuffer-mark-interactive arg ?  1))    (ibuffer-mark-interactive arg ?\s 1))
1284    
1285  (defun ibuffer-unmark-backward (arg)  (defun ibuffer-unmark-backward (arg)
1286    "Unmark the buffer on this line, and move backward ARG lines.    "Unmark the buffer on this line, and move backward ARG lines.
1287  If point is on a group name, this function operates on that group."  If point is on a group name, this function operates on that group."
1288    (interactive "P")    (interactive "P")
1289    (ibuffer-mark-interactive arg ?  -1))    (ibuffer-mark-interactive arg ?\s -1))
1290    
1291  (defun ibuffer-mark-interactive (arg mark movement)  (defun ibuffer-mark-interactive (arg mark movement)
1292    (assert (eq major-mode 'ibuffer-mode))    (assert (eq major-mode 'ibuffer-mode))
# Line 1409  If point is on a group name, this functi Line 1413  If point is on a group name, this functi
1413      `(substring ,strvar 0 ,maxvar)))      `(substring ,strvar 0 ,maxvar)))
1414    
1415  (defun ibuffer-compile-make-format-form (strvar widthform alignment)  (defun ibuffer-compile-make-format-form (strvar widthform alignment)
1416    (let* ((left `(make-string tmp2 ? ))    (let* ((left `(make-string tmp2 ?\s))
1417           (right `(make-string (- tmp1 tmp2) ? )))           (right `(make-string (- tmp1 tmp2) ?\s)))
1418      `(progn      `(progn
1419         (setq tmp1 ,widthform         (setq tmp1 ,widthform
1420               tmp2 (/ tmp1 2))               tmp2 (/ tmp1 2))
# Line 1690  If point is on a group name, this functi Line 1694  If point is on a group name, this functi
1694           (and (boundp 'dired-directory)           (and (boundp 'dired-directory)
1695                (if (stringp dired-directory)                (if (stringp dired-directory)
1696                    dired-directory                    dired-directory
1697                  (car dired-directory)))                  (car dired-directory)))
1698           ""))))           ""))))
1699    
1700  (define-ibuffer-column filename-and-process  (define-ibuffer-column filename-and-process
# Line 1724  If point is on a group name, this functi Line 1728  If point is on a group name, this functi
1728        filename)))        filename)))
1729    
1730  (defun ibuffer-format-column (str width alignment)  (defun ibuffer-format-column (str width alignment)
1731    (let ((left (make-string (/ width 2) ? ))    (let ((left (make-string (/ width 2) ?\s))
1732          (right (make-string (- width (/ width 2)) ? )))          (right (make-string (- width (/ width 2)) ?\s)))
1733      (case alignment      (case alignment
1734        (:right (concat left right str))        (:right (concat left right str))
1735        (:center (concat left str right))        (:center (concat left str right))
# Line 1881  the value of point at the beginning of t Line 1885  the value of point at the beginning of t
1885      (mapcar #'(lambda (buf) (let ((e (assq buf bufs)))      (mapcar #'(lambda (buf) (let ((e (assq buf bufs)))
1886                                (if e                                (if e
1887                                    e                                    e
1888                                  (cons buf ? ))))                                  (cons buf ?\s))))
1889              curbufs)))              curbufs)))
1890    
1891  (defun ibuffer-buf-matches-predicates (buf predicates)  (defun ibuffer-buf-matches-predicates (buf predicates)
# Line 1989  the value of point at the beginning of t Line 1993  the value of point at the beginning of t
1993                        (buffer-substring (point) (line-end-position)))))                        (buffer-substring (point) (line-end-position)))))
1994             (apply #'insert (mapcar             (apply #'insert (mapcar
1995                              #'(lambda (c)                              #'(lambda (c)
1996                                  (if (not (or (char-equal c ? )                                  (if (not (or (char-equal c ?\s)
1997                                               (char-equal c ?\n)))                                               (char-equal c ?\n)))
1998                                      ?-                                      ?-
1999                                    ? ))                                    ?\s))
2000                              str)))                              str)))
2001           (insert "\n"))           (insert "\n"))
2002         (point))         (point))
# Line 2011  the value of point at the beginning of t Line 2015  the value of point at the beginning of t
2015             (dolist (element format)             (dolist (element format)
2016               (insert               (insert
2017                (if (stringp element)                (if (stringp element)
2018                    (make-string (length element) ? )                    (make-string (length element) ?\s)
2019                  (let ((sym (car element)))                  (let ((sym (car element)))
2020                    (let ((min (cadr element))                    (let ((min (cadr element))
2021                          ;; (max (caddr element))                          ;; (max (caddr element))
# Line 2023  the value of point at the beginning of t Line 2027  the value of point at the beginning of t
2027                                          (funcall (get sym 'ibuffer-column-summarizer)                                          (funcall (get sym 'ibuffer-column-summarizer)
2028                                                   (get sym 'ibuffer-column-summary))                                                   (get sym 'ibuffer-column-summary))
2029                                        (make-string (length (get sym 'ibuffer-column-name))                                        (make-string (length (get sym 'ibuffer-column-name))
2030                                                     ? )))                                                     ?\s)))
2031                             (len (length summary)))                             (len (length summary)))
2032                        (if (< len min)                        (if (< len min)
2033                            (ibuffer-format-column summary                            (ibuffer-format-column summary
# Line 2241  buffers which are visiting a file." Line 2245  buffers which are visiting a file."
2245  ;;;###autoload  ;;;###autoload
2246  (defun ibuffer (&optional other-window-p name qualifiers noselect  (defun ibuffer (&optional other-window-p name qualifiers noselect
2247                            shrink filter-groups formats)                            shrink filter-groups formats)
2248    "Begin using `ibuffer' to edit a list of buffers.    "Begin using Ibuffer to edit a list of buffers.
2249  Type 'h' after entering ibuffer for more information.  Type 'h' after entering ibuffer for more information.
2250    
2251  Optional argument OTHER-WINDOW-P says to use another window.  All arguments are optional.
2252  Optional argument NAME specifies the name of the buffer; it defaults  OTHER-WINDOW-P says to use another window.
2253  to \"*Ibuffer*\".  NAME specifies the name of the buffer (defaults to \"*Ibuffer*\").
2254  Optional argument QUALIFIERS is an initial set of filtering qualifiers  QUALIFIERS is an initial set of filtering qualifiers to use;
2255  to use; see `ibuffer-filtering-qualifiers'.    see `ibuffer-filtering-qualifiers'.
2256  Optional argument NOSELECT means don't select the Ibuffer buffer.  NOSELECT means don't select the Ibuffer buffer.
2257  Optional argument SHRINK means shrink the buffer to minimal size.  The  SHRINK means shrink the buffer to minimal size.  The special
2258  special value `onewindow' means always use another window.    value `onewindow' means always use another window.
2259  Optional argument FILTER-GROUPS is an initial set of filtering  FILTER-GROUPS is an initial set of filtering groups to use;
2260  groups to use; see `ibuffer-filter-groups'.    see `ibuffer-filter-groups'.
2261  Optional argument FORMATS is the value to use for `ibuffer-formats'.  FORMATS is the value to use for `ibuffer-formats'.
2262  If specified, then the variable `ibuffer-formats' will have that value    If specified, then the variable `ibuffer-formats' will have
2263  locally in this buffer."    that value locally in this buffer."
2264    (interactive "P")    (interactive "P")
2265    (when ibuffer-use-other-window    (when ibuffer-use-other-window
2266      (setq other-window-p t))      (setq other-window-p t))
# Line 2297  locally in this buffer." Line 2301  locally in this buffer."
2301  (put 'ibuffer-mode 'mode-class 'special)  (put 'ibuffer-mode 'mode-class 'special)
2302  (defun ibuffer-mode ()  (defun ibuffer-mode ()
2303    "A major mode for viewing a list of buffers.    "A major mode for viewing a list of buffers.
2304  In ibuffer, you can conveniently perform many operations on the  In Ibuffer, you can conveniently perform many operations on the
2305  currently open buffers, in addition to filtering your view to a  currently open buffers, in addition to filtering your view to a
2306  particular subset of them, and sorting by various criteria.  particular subset of them, and sorting by various criteria.
2307    

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26