/[emacs]/emacs/lisp/ibuf-ext.el
ViewVC logotype

Diff of /emacs/lisp/ibuf-ext.el

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

revision 1.23.2.2 by miles, Tue Oct 14 23:51:06 2003 UTC revision 1.23.2.3 by miles, Tue Jul 6 09:39:53 2004 UTC
# Line 1  Line 1 
1  ;;; ibuf-ext.el --- extensions for ibuffer  ;;; ibuf-ext.el --- extensions for ibuffer
2    
3  ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.  ;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4    
5  ;; Author: Colin Walters <walters@verbum.org>  ;; Author: Colin Walters <walters@verbum.org>
6  ;; Maintainer: John Paul Wallington <jpw@gnu.org>  ;; Maintainer: John Paul Wallington <jpw@gnu.org>
# Line 1224  to move by.  The default is `ibuffer-mar Line 1224  to move by.  The default is `ibuffer-mar
1224    
1225  ;;;###autoload  ;;;###autoload
1226  (defun ibuffer-jump-to-buffer (name)  (defun ibuffer-jump-to-buffer (name)
1227    "Move point to the buffer whose name is NAME."    "Move point to the buffer whose name is NAME.
1228    
1229    If called interactively, prompt for a buffer name and go to the
1230    corresponding line in the Ibuffer buffer.  If said buffer is in a
1231    hidden group filter, open it.
1232    
1233    If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer
1234    visible buffers in the completion list.  Calling the command with
1235    a prefix argument reverses the meaning of that variable."
1236    (interactive (list nil))    (interactive (list nil))
1237    (let ((table (mapcar #'(lambda (x)    (let ((only-visible ibuffer-jump-offer-only-visible-buffers))
1238                             (cons (buffer-name (car x))      (when current-prefix-arg
1239                                   (caddr x)))        (setq only-visible (not only-visible)))
1240                         (ibuffer-current-state-list t))))      (if only-visible
1241      (when (null table)          (let ((table (mapcar #'(lambda (x)
1242        (error "No buffers!"))                                   (buffer-name (car x)))
1243      (when (interactive-p)                               (ibuffer-current-state-list))))
1244        (setq name (completing-read "Jump to buffer: " table nil t)))            (when (null table)
1245      (ibuffer-aif (assoc name table)              (error "No buffers!"))
1246          (goto-char (cdr it))            (when (interactive-p)
1247        (error "No buffer with name %s" name))))              (setq name (completing-read "Jump to buffer: "
1248                                            table nil t))))
1249          (when (interactive-p)
1250            (setq name (read-buffer "Jump to buffer: " nil t))))
1251        (when (not (string= "" name))
1252          (let (buf-point)
1253            ;; Blindly search for our buffer: it is very likely that it is
1254            ;; not in a hidden filter group.
1255            (ibuffer-map-lines #'(lambda (buf marks)
1256                                   (when (string= (buffer-name buf) name)
1257                                     (setq buf-point (point))
1258                                     nil))
1259                               t nil)
1260            (when (and
1261                   (null buf-point)
1262                   (not (null ibuffer-hidden-filter-groups)))
1263              ;; We did not find our buffer.  It must be in a hidden filter
1264              ;; group, so go through all hidden filter groups to find it.
1265              (catch 'found
1266                (dolist (group ibuffer-hidden-filter-groups)
1267                  (ibuffer-jump-to-filter-group group)
1268                  (ibuffer-toggle-filter-group)
1269                  (ibuffer-map-lines #'(lambda (buf marks)
1270                                         (when (string= (buffer-name buf) name)
1271                                           (setq buf-point (point))
1272                                           nil))
1273                                     t group)
1274                  (if buf-point
1275                      (throw 'found nil)
1276                    (ibuffer-toggle-filter-group)))))
1277            (if (null buf-point)
1278                ;; Still not found even though we expanded all hidden filter
1279                ;; groups: that must be because it's hidden by predicate:
1280                ;; we won't bother trying to display it.
1281                (error "No buffer with name %s" name)
1282              (goto-char buf-point))))))
1283    
1284  ;;;###autoload  ;;;###autoload
1285  (defun ibuffer-diff-with-file ()  (defun ibuffer-diff-with-file ()

Legend:
Removed from v.1.23.2.2  
changed lines
  Added in v.1.23.2.3

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