-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
;;; prev-next-buffer.el - Surrogates of `next-buffer' and `previous-buffer' | ||
|
||
;; prev-next-buffer.el - Provides lightweight surrogates of Emacs 22's | ||
;; functions `next-buffer' and `previous-buffer' to other Emacsen | ||
;; Harmless if said functions are already defined, so inserting | ||
;; | ||
; (require 'prev-next-buffer) | ||
;; | ||
;; in your .emacs shouldn't cause any incompatibility. | ||
;; | ||
;; Stewarded by [email protected] for Emacs Wiki; copyright might be traceable | ||
;; to some guy in Ecole Normale Superieure (http://www.eleves.ens.fr/) circa 1990 (!). | ||
|
||
(if (not (fboundp 'switch-to-other-buffer)) | ||
;; Code stolen Xemacs' files.el | ||
(defun switch-to-other-buffer (arg) | ||
"Switch to the previous buffer. With a numeric arg, n, switch to the nth | ||
most recent buffer. With an arg of 0, buries the current buffer at the | ||
bottom of the buffer stack." | ||
(interactive "p") | ||
(if (eq arg 0) | ||
(bury-buffer (current-buffer))) | ||
(switch-to-buffer | ||
(if (<= arg 1) (other-buffer (current-buffer)) | ||
(nth (1+ arg) (buffer-list))))) | ||
) | ||
|
||
(if (not (fboundp 'next-buffer)) | ||
(defun next-buffer () | ||
"Switch to the next buffer in cyclic order." | ||
(interactive) | ||
(switch-to-other-buffer 0))) | ||
|
||
(if (not (fboundp 'previous-buffer)) | ||
(defun previous-buffer () | ||
"Switch to the previous buffer in cyclic order." | ||
(interactive) | ||
(while (string-match "\\` " | ||
(buffer-name (switch-to-other-buffer | ||
(- (length (buffer-list)) 2))))))) | ||
|
||
(provide 'prev-next-buffer) | ||
|
||
;;; prev-next-buffer.el ends here |