275 |
|
|
276 |
(defun last-buffer () "\ |
(defun last-buffer () "\ |
277 |
Return the last non-hidden buffer in the buffer list." |
Return the last non-hidden buffer in the buffer list." |
278 |
(let ((list (reverse (buffer-list)))) |
;; This logic is more or less copied from bury-buffer, |
279 |
(while (eq (aref (buffer-name (car list)) 0) ? ) |
;; except that we reverse the buffer list. |
280 |
(setq list (cdr list))) |
(let ((fbl (frame-parameter 'buffer-list)) |
281 |
(car list))) |
(list (buffer-list)) |
282 |
|
(pred (frame-parameter nil 'buffer-predicate)) |
283 |
|
found notsogood) |
284 |
|
;; Merge the frame buffer list with the whole buffer list, |
285 |
|
;; and reverse it. |
286 |
|
(dolist (buffer fbl) |
287 |
|
(setq list (delq buffer list))) |
288 |
|
(setq list (nreverse (append fbl list))) |
289 |
|
(while (not found) |
290 |
|
(unless (or (eq (aref (buffer-name (car list)) 0) ? ) |
291 |
|
;; If the selected frame has a buffer_predicate, |
292 |
|
;; disregard buffers that don't fit the predicate. |
293 |
|
(and pred (not (funcall pred (car list))))) |
294 |
|
(if (get-buffer-window (car list) 'visible) |
295 |
|
(unless notsogood (setq notsogood (car list))) |
296 |
|
(setq found (car list))))) |
297 |
|
(or found notsogood))) |
298 |
|
|
299 |
(defun unbury-buffer () "\ |
(defun unbury-buffer () "\ |
300 |
Switch to the last buffer in the buffer list." |
Switch to the last buffer in the buffer list." |