-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcc-info-mode.el
54 lines (41 loc) · 1.87 KB
/
cc-info-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
;;; cc-info-mode.el --- Info mode customization -*- lexical-binding: t; -*-
;; Copyright (C) 2024-2025 Charles Choi
;; Author: Charles Choi <[email protected]>
;; Keywords: tools
;; This program 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 3 of the License, or
;; (at your option) any later version.
;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(require 'info)
(require 'cc-main-tmenu)
(require 'casual-info)
(defun cc/clone-in-new-tab ()
(interactive)
(unless (fboundp #'tab-bar-mode) (error "Error: tab-bar-mode not available."))
(unless (derived-mode-p 'Info-mode) (error "Error: must only be run in Info."))
(tab-new-to -1)
(clone-buffer nil t)
(delete-other-windows))
(defun cc/rename-to-info-manual ()
"Rename buffer to *info <manual name>*."
(interactive)
(unless (derived-mode-p 'Info-mode) (error "Error: can only run in Info buffer."))
(let ((manual-name (file-name-nondirectory Info-current-file)))
(rename-buffer (format "*info %s*" manual-name))))
(keymap-set Info-mode-map "C-o" #'casual-info-tmenu)
(keymap-set Info-mode-map "C-M-o" #'casual-editkit-main-tmenu)
(keymap-set Info-mode-map "<mouse-5>" #'Info-history-forward)
(keymap-set Info-mode-map "<mouse-4>" #'Info-history-back)
(keymap-set Info-mode-map "s-<tab>" #'cc/clone-in-new-tab)
(keymap-set Info-mode-map "M-t" #'cc/clone-in-new-tab)
(provide 'cc-info-mode)
;;; cc-info-mode.el ends here