aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters2002-04-17 22:38:10 +0000
committerColin Walters2002-04-17 22:38:10 +0000
commitd246cabf2d1ac99fe4204152f1067e3730ea246a (patch)
tree51a690c779d5c31a1eae32d64a4d40b496ed6c87
parent3de7b1bde8c4d4fa76c5424a5a91fb0d54c56286 (diff)
downloademacs-d246cabf2d1ac99fe4204152f1067e3730ea246a.tar.gz
emacs-d246cabf2d1ac99fe4204152f1067e3730ea246a.zip
(ibuffer-visit-buffer): Optionally allow reducing to one window.
(ibuffer-visit-buffer-1-window): Simply call `ibuffer-visit-buffer'. (ibuffer-current-state-list): Reinstate optional argument; now just call `point' inside the mapping function.
-rw-r--r--lisp/ibuffer.el44
1 files changed, 27 insertions, 17 deletions
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index b981ac304da..66e9f47302f 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -842,14 +842,21 @@ width and the longest string in LIST."
842 (forward-line 1)) 842 (forward-line 1))
843 (decf arg)))) 843 (decf arg))))
844 844
845(defun ibuffer-visit-buffer () 845(defun ibuffer-visit-buffer (&optional single)
846 "Visit the buffer on this line." 846 "Visit the buffer on this line.
847 (interactive) 847
848If optional argument SINGLE is non-nil, then also ensure there is only
849one window."
850 (interactive "P")
848 (let ((buf (ibuffer-current-buffer))) 851 (let ((buf (ibuffer-current-buffer)))
849 (unless (buffer-live-p buf) 852 (if (bufferp buf)
850 (error "Buffer %s has been killed!" buf)) 853 (unless (buffer-live-p buf)
854 (error "Buffer %s has been killed!" buf))
855 (error "No buffer on this line"))
851 (bury-buffer (current-buffer)) 856 (bury-buffer (current-buffer))
852 (switch-to-buffer buf))) 857 (switch-to-buffer buf)
858 (when single
859 (delete-other-windows))))
853 860
854(defun ibuffer-visit-buffer-other-window (&optional noselect) 861(defun ibuffer-visit-buffer-other-window (&optional noselect)
855 "Visit the buffer on this line in another window." 862 "Visit the buffer on this line in another window."
@@ -881,11 +888,7 @@ width and the longest string in LIST."
881(defun ibuffer-visit-buffer-1-window () 888(defun ibuffer-visit-buffer-1-window ()
882 "Visit the buffer on this line, and delete other windows." 889 "Visit the buffer on this line, and delete other windows."
883 (interactive) 890 (interactive)
884 (let ((buf (ibuffer-current-buffer))) 891 (ibuffer-visit-buffer t))
885 (unless (buffer-live-p buf)
886 (error "Buffer %s has been killed!" buf))
887 (switch-to-buffer buf)
888 (delete-other-windows)))
889 892
890(defun ibuffer-bury-buffer () 893(defun ibuffer-bury-buffer ()
891 "Bury the buffer on this line." 894 "Bury the buffer on this line."
@@ -1668,15 +1671,22 @@ current mark symbol, and the beginning and ending line positions."
1668 (car e))) 1671 (car e)))
1669 (ibuffer-current-state-list)))) 1672 (ibuffer-current-state-list))))
1670 1673
1671(defun ibuffer-current-state-list () 1674(defun ibuffer-current-state-list (&optional pos)
1672 "Return a list like (BUF . MARK) of all buffers in an ibuffer." 1675 "Return a list like (BUF . MARK) of all buffers in an ibuffer.
1676If POS is non-nil, return a list like (BUF MARK POINT), where POINT is
1677the value of point at the beginning of the line for that buffer."
1673 (let ((ibuffer-current-state-list-tmp '())) 1678 (let ((ibuffer-current-state-list-tmp '()))
1674 ;; ah, if only we had closures. I bet this will mysteriously 1679 ;; ah, if only we had closures. I bet this will mysteriously
1675 ;; break later. Don't blame me. 1680 ;; break later. Don't blame me.
1676 (ibuffer-map-lines-nomodify 1681 (if pos
1677 #'(lambda (buf mark) 1682 (ibuffer-map-lines-nomodify
1678 (when (buffer-live-p buf) 1683 #'(lambda (buf mark)
1679 (push (cons buf mark) ibuffer-current-state-list-tmp)))) 1684 (when (buffer-live-p buf)
1685 (push (list buf mark (point)) ibuffer-current-state-list-tmp))))
1686 (ibuffer-map-lines-nomodify
1687 #'(lambda (buf mark)
1688 (when (buffer-live-p buf)
1689 (push (cons buf mark) ibuffer-current-state-list-tmp)))))
1680 (nreverse ibuffer-current-state-list-tmp))) 1690 (nreverse ibuffer-current-state-list-tmp)))
1681 1691
1682(defun ibuffer-current-buffers-with-marks (curbufs) 1692(defun ibuffer-current-buffers-with-marks (curbufs)