aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey2005-12-20 21:35:03 +0000
committerKaroly Lorentey2005-12-20 21:35:03 +0000
commita18b8cb5070a81da0659275bef52f77f925644c8 (patch)
tree4edd0aa560de4dc08c6e10e649909505b0e9f59f /lisp
parente93b29568add51c918892153759a1fcd440e85be (diff)
downloademacs-a18b8cb5070a81da0659275bef52f77f925644c8.tar.gz
emacs-a18b8cb5070a81da0659275bef52f77f925644c8.zip
Implement full support for frame-local `next-buffer' and `previous-buffer'.
* frame.h (frame): New field `buried_buffer_list'. * alloc.c (mark_object): Mark it. * frame.c (make_frame): Initialize it. * frame.h (Qburied_buffer_list): New symbol declaration. * buffer.c (Fbuffer_list): Handle the buried-buffer-list frame parameter. * buffer.c (record_buffer): Delete the buffer from the buried_buffer_list. * buffer.c (Fbury_buffer): Add buffer to buried_buffer_list. * frame.c (Qburied_buffer_list): New symbol. (syms_of_frame): Initialize and staticpro it. (frames_discard_buffer): Also remove buffer from buried-buffer-list. (store_frame_param): Handle `buried-buffer-list' specially. (Fframe_parameters): Handle `buried-buffer-list' specially. * simple.el (last-buffer): Don't look at buried-buffer-list, rely on `buffer-list' doing that for us. (next-buffer): Simplify. (previous-buffer): Simplify. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-455
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el22
1 files changed, 5 insertions, 17 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 77c008b2805..bfbdaf14d28 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -85,34 +85,22 @@ If the optional third argument FRAME is non-nil, use that frame's
85buffer list instead of the selected frame's buffer list. 85buffer list instead of the selected frame's buffer list.
86If no other buffer exists, the buffer `*scratch*' is returned." 86If no other buffer exists, the buffer `*scratch*' is returned."
87 (setq frame (or frame (selected-frame))) 87 (setq frame (or frame (selected-frame)))
88 (or (get-next-valid-buffer (frame-parameter frame 'buried-buffer-list) 88 (or (get-next-valid-buffer (nreverse (buffer-list frame))
89 buffer visible-ok frame) 89 buffer visible-ok frame)
90 (get-next-valid-buffer (nreverse (buffer-list frame))
91 buffer visible-ok frame)
92 (progn 90 (progn
93 (set-buffer-major-mode (get-buffer-create "*scratch*")) 91 (set-buffer-major-mode (get-buffer-create "*scratch*"))
94 (get-buffer "*scratch*")))) 92 (get-buffer "*scratch*"))))
95
96(defun next-buffer () 93(defun next-buffer ()
97 "Switch to the next buffer in cyclic order." 94 "Switch to the next buffer in cyclic order."
98 (interactive) 95 (interactive)
99 (let ((buffer (current-buffer)) 96 (let ((buffer (current-buffer)))
100 (bbl (frame-parameter nil 'buried-buffer-list)))
101 (switch-to-buffer (other-buffer buffer t)) 97 (switch-to-buffer (other-buffer buffer t))
102 (bury-buffer buffer) 98 (bury-buffer buffer)))
103 (set-frame-parameter nil 'buried-buffer-list
104 (cons buffer (delq buffer bbl)))))
105 99
106(defun previous-buffer () 100(defun previous-buffer ()
107 "Switch to the previous buffer in cyclic order." 101 "Switch to the previous buffer in cyclic order."
108 (interactive) 102 (interactive)
109 (let ((buffer (last-buffer (current-buffer) t)) 103 (switch-to-buffer (last-buffer (current-buffer) t)))
110 (bbl (frame-parameter nil 'buried-buffer-list)))
111 (switch-to-buffer buffer)
112 ;; Clean up buried-buffer-list up to and including the chosen buffer.
113 (while (and bbl (not (eq (car bbl) buffer)))
114 (setq bbl (cdr bbl)))
115 (set-frame-parameter nil 'buried-buffer-list bbl)))
116 104
117 105
118;;; next-error support framework 106;;; next-error support framework