comparison lisp/ibuf-ext.el @ 90037:0fe073a08cef

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-65 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-634 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-639 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-640 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-641 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-59 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-60 Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 27 Oct 2004 05:42:04 +0000
parents 0796fc36c2bd ba7d42763f73
children e4694597cbf4
comparison
equal deleted inserted replaced
90036:af754c88f187 90037:0fe073a08cef
643 (delete name ibuffer-hidden-filter-groups))) 643 (delete name ibuffer-hidden-filter-groups)))
644 (error "No filter group with name \"%s\"" name)) 644 (error "No filter group with name \"%s\"" name))
645 (ibuffer-update nil t)) 645 (ibuffer-update nil t))
646 646
647 ;;;###autoload 647 ;;;###autoload
648 (defun ibuffer-kill-line (&optional arg) 648 (defun ibuffer-kill-line (&optional arg interactive-p)
649 "Kill the filter group at point. 649 "Kill the filter group at point.
650 See also `ibuffer-kill-filter-group'." 650 See also `ibuffer-kill-filter-group'."
651 (interactive "P") 651 (interactive "P\np")
652 (ibuffer-aif (save-excursion 652 (ibuffer-aif (save-excursion
653 (ibuffer-forward-line 0) 653 (ibuffer-forward-line 0)
654 (get-text-property (point) 'ibuffer-filter-group-name)) 654 (get-text-property (point) 'ibuffer-filter-group-name))
655 (progn 655 (progn
656 (ibuffer-kill-filter-group it)) 656 (ibuffer-kill-filter-group it))
657 (funcall (if (interactive-p) #'call-interactively #'funcall) 657 (funcall (if interactive-p #'call-interactively #'funcall)
658 #'kill-line arg))) 658 #'kill-line arg)))
659 659
660 (defun ibuffer-insert-filter-group-before (newgroup group) 660 (defun ibuffer-insert-filter-group-before (newgroup group)
661 (let* ((found nil) 661 (let* ((found nil)
662 (pos (let ((groups (mapcar #'car ibuffer-filter-groups)) 662 (pos (let ((groups (mapcar #'car ibuffer-filter-groups))
1235 hidden group filter, open it. 1235 hidden group filter, open it.
1236 1236
1237 If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer 1237 If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer
1238 visible buffers in the completion list. Calling the command with 1238 visible buffers in the completion list. Calling the command with
1239 a prefix argument reverses the meaning of that variable." 1239 a prefix argument reverses the meaning of that variable."
1240 (interactive (list nil)) 1240 (interactive (list
1241 (let ((only-visible ibuffer-jump-offer-only-visible-buffers)) 1241 (let ((only-visible ibuffer-jump-offer-only-visible-buffers))
1242 (when current-prefix-arg 1242 (when current-prefix-arg
1243 (setq only-visible (not only-visible))) 1243 (setq only-visible (not only-visible)))
1244 (if only-visible 1244 (if only-visible
1245 (let ((table (mapcar #'(lambda (x) 1245 (let ((table (mapcar #'(lambda (x)
1246 (buffer-name (car x))) 1246 (buffer-name (car x)))
1247 (ibuffer-current-state-list)))) 1247 (ibuffer-current-state-list))))
1248 (when (null table) 1248 (when (null table)
1249 (error "No buffers!")) 1249 (error "No buffers!"))
1250 (when (interactive-p) 1250 (completing-read "Jump to buffer: "
1251 (setq name (completing-read "Jump to buffer: " 1251 table nil t))
1252 table nil t)))) 1252 (read-buffer "Jump to buffer: " nil t)))))
1253 (when (interactive-p) 1253 (when (not (string= "" name))
1254 (setq name (read-buffer "Jump to buffer: " nil t)))) 1254 (let (buf-point)
1255 (when (not (string= "" name)) 1255 ;; Blindly search for our buffer: it is very likely that it is
1256 (let (buf-point) 1256 ;; not in a hidden filter group.
1257 ;; Blindly search for our buffer: it is very likely that it is 1257 (ibuffer-map-lines #'(lambda (buf marks)
1258 ;; not in a hidden filter group. 1258 (when (string= (buffer-name buf) name)
1259 (ibuffer-map-lines #'(lambda (buf marks) 1259 (setq buf-point (point))
1260 (when (string= (buffer-name buf) name) 1260 nil))
1261 (setq buf-point (point)) 1261 t nil)
1262 nil)) 1262 (when (and
1263 t nil) 1263 (null buf-point)
1264 (when (and 1264 (not (null ibuffer-hidden-filter-groups)))
1265 (null buf-point) 1265 ;; We did not find our buffer. It must be in a hidden filter
1266 (not (null ibuffer-hidden-filter-groups))) 1266 ;; group, so go through all hidden filter groups to find it.
1267 ;; We did not find our buffer. It must be in a hidden filter 1267 (catch 'found
1268 ;; group, so go through all hidden filter groups to find it. 1268 (dolist (group ibuffer-hidden-filter-groups)
1269 (catch 'found 1269 (ibuffer-jump-to-filter-group group)
1270 (dolist (group ibuffer-hidden-filter-groups) 1270 (ibuffer-toggle-filter-group)
1271 (ibuffer-jump-to-filter-group group) 1271 (ibuffer-map-lines #'(lambda (buf marks)
1272 (ibuffer-toggle-filter-group) 1272 (when (string= (buffer-name buf) name)
1273 (ibuffer-map-lines #'(lambda (buf marks) 1273 (setq buf-point (point))
1274 (when (string= (buffer-name buf) name) 1274 nil))
1275 (setq buf-point (point)) 1275 t group)
1276 nil)) 1276 (if buf-point
1277 t group) 1277 (throw 'found nil)
1278 (if buf-point 1278 (ibuffer-toggle-filter-group)))))
1279 (throw 'found nil) 1279 (if (null buf-point)
1280 (ibuffer-toggle-filter-group))))) 1280 ;; Still not found even though we expanded all hidden filter
1281 (if (null buf-point) 1281 ;; groups: that must be because it's hidden by predicate:
1282 ;; Still not found even though we expanded all hidden filter 1282 ;; we won't bother trying to display it.
1283 ;; groups: that must be because it's hidden by predicate: 1283 (error "No buffer with name %s" name)
1284 ;; we won't bother trying to display it. 1284 (goto-char buf-point)))))
1285 (error "No buffer with name %s" name)
1286 (goto-char buf-point))))))
1287 1285
1288 ;;;###autoload 1286 ;;;###autoload
1289 (defun ibuffer-diff-with-file () 1287 (defun ibuffer-diff-with-file ()
1290 "View the differences between this buffer and its associated file. 1288 "View the differences between this buffer and its associated file.
1291 This requires the external program \"diff\" to be in your `exec-path'." 1289 This requires the external program \"diff\" to be in your `exec-path'."