This repository was 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
Expand file tree
/
Copy pathclone-indirect-buffer-other-frame-mode.el
More file actions
66 lines (59 loc) · 2.32 KB
/
Copy pathclone-indirect-buffer-other-frame-mode.el
File metadata and controls
66 lines (59 loc) · 2.32 KB
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
60
61
62
63
64
65
66
;;; clone-indirect-buffer-other-frame-mode.el --- Provide implementation and keybinding to clone-indirect-buffer-other-frame
;;
;;; Copyright (C) 2018 Free Software Foundation, Inc.
;;
;; Author: Eric Crosson <eric.s.crosson@utexas.com>
;; Version: 1.0.0
;; Keywords: convenience
;; URL: https://github.com/EricCrosson/clone-indirect-buffer-other-frame-mode
;; Package-Requires: ((emacs "24"))
;;
;; This file is not a part of GNU Emacs.
;;
;;
;; 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:
;;
;; Thanks to https://stackoverflow.com/a/47333316
;;; Code:
(defun clone-indirect-buffer-other-frame (newname display-flag &optional norecord)
"Like `clone-indirect-buffer' but display in another window.
NEWNAME, DISPLAY-FLAG, and NORECORD passed directly to
`clone-indirect-buffer'."
(interactive
(progn
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
(list (if current-prefix-arg
(read-buffer "Name of indirect buffer: " (current-buffer)))
t)))
(let ((pop-up-frames t))
(clone-indirect-buffer newname display-flag norecord)))
;;;###autoload
(define-minor-mode clone-indirect-buffer-other-frame-mode
"Minor-mode providing default keybinding for `clone-indirect-buffer-other-frame'."
:init-value t
:lighter nil
:keymap (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-x 5 c") 'clone-indirect-buffer-other-frame)
map)
:global t
:group 'clone-indirect-buffer-other-frame
:require 'clone-indirect-buffer-other-frame-mode)
(provide 'clone-indirect-buffer-other-frame-mode)
;;; clone-indirect-buffer-other-frame-mode.el ends here