This repository has been archived by the owner on Oct 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch-to-previous-buffer-mode.el
59 lines (51 loc) · 1.83 KB
/
switch-to-previous-buffer-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;;; switch-to-previous-buffer-mode.el --- Alt-Tab for Buffers
;;
;;; Copyright (C) 2018 Free Software Foundation, Inc.
;;
;; Author: Eric Crosson <eric.s.crosson@utexas.com>
;; Version: 1.0.3
;; Keywords: convenience
;; URL: https://github.com/EricCrosson/switch-to-previous-buffer-mode
;; Package-Requires: ((emacs "24"))
;;
;;
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;
;;; Commentary:
;;
;; Provides a function `switch-to-previous-buffer' and a minor-mode
;; keymap for binding this function to. There is no current
;; default-binding.
;;; Code:
(defun switch-to-previous-buffer ()
"Switch to previously open buffer.
Repeated invocations toggle between the two most recently opened
buffers."
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
;;;###autoload
(define-minor-mode switch-to-previous-buffer-mode
"Toggle Switch to Previous Buffer mode.
This mode provides a binding to invoke `switch-to-previous-buffer`."
:init-value t
:lighter nil
:keymap (make-sparse-keymap)
:global t
:group 'switch-to-previous-buffer
:require 'switch-to-previous-buffer-mode)
(provide 'switch-to-previous-buffer-mode)
;;; switch-to-previous-buffer-mode.el ends here