aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/init/ycp-help.el
blob: 5cbbed0d7ca29d8a37cd2d06d337aacb4bd8bf50 (plain) (blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
;;; ycp-help.el -- My configs for help -*- lexical-binding: t -*-

;; Copyright (C) 2023 Free Software Foundation.

;; Author: Yuchen Pei <id@ypei.org>
;; Package-Requires: ((emacs "28.2"))

;; This file is part of dotfiles.

;; dotfiles is free software: you can redistribute it and/or modify it under
;; the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; dotfiles 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 Affero General
;; Public License for more details.

;; You should have received a copy of the GNU Affero General Public
;; License along with dotfiles.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; My configs for help. Covers help, man, woman, eldoc, info etc.

;;; Code:


(my-package help-mode
  (my-keybind help-mode-map
    "x" #'describe-command
    "v" #'describe-variable
    "f" #'describe-function)
  (setq help-window-select t)
  (my-keybind global-map
    "C-h h" nil
    "C-h K" #'describe-keymap ; overrides `Info-goto-emacs-key-command-node'
    "C-h c" #'describe-char ; overrides `describe-key-briefly'
    "C-h D" #'shortdoc-display-group
    "C-h X" #'Info-goto-emacs-command-node
    "C-h F" #'describe-face
    )
  )

(my-package info
  ;; TODO consider using `Info-additional-directory-list' instead
  (add-to-list 'Info-directory-list (locate-user-emacs-file "info")))

(my-keybind global-map
  "C-h C-f" #'find-function
  "C-h C-l" #'find-library
  "C-h C-v" #'find-variable
  "C-h C-p" #'list-packages)
(my-setq-from-local find-function-C-source-directory)

(my-package eldoc
  (:delay 5)
  (setq eldoc-echo-area-prefer-doc-buffer t
        eldoc-idle-delay .1)
  )

(my-package man
  (:delay 10)
  (setq Man-notify-method 'pushy)
  (require 'my-buffer)
  (add-to-list 'my-buffer-create-functions
               '(Man-mode . man)))

(my-package woman
  (:delay 10)
  (require 'my-buffer)
  (add-to-list 'my-buffer-create-functions
               '(woman-mode . woman)))

(my-package help-at-pt
  (setq help-at-pt-timer-delay .2)
  (setq help-at-pt-display-when-idle t)
  (help-at-pt-set-timer))

(my-package my-help
  (:delay 10)
  (my-keybind global-map
    "C-h M" #'man
    "C-h i" #'my-info-display-manual
    "C-h ." #'my-describe-symbol-at-point
    "\C-h!" #'my-external-command-open-source)
  (my-keybind help-mode-map
    "o" #'my-help-goto-symbol
    "j" #'my-help-goto-symbol)
  )

(my-configure
  (:delay 10)
  (add-to-list 'my-buffer-create-functions '(Info-mode . 'my-info-display-manual)))

;;;; Tooltips (tooltip-mode)
(my-package tooltip
  (:delay 15)
  (setq tooltip-delay 0.5
        tooltip-short-delay 0.5
        x-gtk-use-system-tooltips nil
        tooltip-frame-parameters
        '((name . "tooltip")
          (internal-border-width . 6)
          (border-width . 0)
          (no-special-glyphs . t)))
  (autoload #'tooltip-mode "tooltip")
  (tooltip-mode 1))

(my-package my-utils
  (:delay 15)
  (my-setq-from-local my-docs-root-dir))

(provide 'ycp-help)