blob: bee0c2a893f1a86049689fa1a57f6779b70e793a (
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
;;; ycp-markup.el -- My config for markup formats -*- 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 config for markup formats.
;;; Code:
;;; parsing and formatting markup and serialization languages: html, markdown,
;;; xml, yaml, etc.
;;; Some parts adapted from prot-dotfiles
(my-package shr
(:delay 30)
(advice-add 'shr-heading :around #'my-shr-add-id-advice)
(setq shr-use-colors nil)
(setq shr-use-fonts nil)
(setq shr-max-image-proportion 0.6)
(setq shr-image-animate nil)
(setq shr-width fill-column)
(setq shr-max-width fill-column)
(setq shr-discard-aria-hidden t)
(setq shr-cookie-policy nil)
)
(my-package tex-mode
(:delay 60)
(setq latex-run-command "pdflatex")
(setq tex-print-file-extension ".pdf"))
(my-package texinfo
(:delay 60)
(my-keybind texinfo-mode-map "C-c C-c" #'makeinfo-buffer))
(my-package yaml-mode
(:delay 60)
(:install t)
(add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode))
(add-hook 'yaml-mode-hook #'display-line-numbers-mode))
;;; markdown
(my-package markdown-mode
(:delay 60)
(my-keybind markdown-mode-map "C-c C-l" 'markdown-insert-link)
(setq markdown-hide-urls t)
(put 'markdown-translate-filename-function 'safe-local-variable 'functionp)
(require 'my-markdown)
(my-keybind markdown-mode-map "<ret>" 'my-markdown-maybe-follow-thing-at-point))
(my-package wiki
(my-keybind wiki-mode-map
"C-'" #'my-wiki-grok-wikipedia)
(my-setq-from-local wiki-sites)
(wiki-define-site-commands)
(add-to-list 'browse-url-handlers
`(wiki-engine-entry-url-p
. ,(lambda (url &rest _) (wiki-open-url url))))
)
(my-package ledger-mode
(:install t)
(:delay 60)
(add-hook 'ledger-mode-hook
(lambda ()
(setq-local tab-always-indent 'complete)
(setq-local completion-cycle-threshold t)
(setq-local ledger-complete-in-steps t)
(setq-local company-mode nil)))
(setq ledger-binary-path "hledger")
(require 'my-ledger)
(my-keybind ledger-mode-map
"M-<down>" #'my-ledger-move-xact-down
"M-<up>" #'my-ledger-move-xact-up
"C-c C-c" #'compile)
(add-to-list 'compilation-error-regexp-alist 'ledger)
(add-to-list 'compilation-error-regexp-alist-alist my-ledger-compilation-error-re)
(add-hook 'ledger-mode-hook 'my-ledger-set-compile-command)
)
;;; todo: open epub in emacs client with nov
(my-package nov
(:delay 15)
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
;; No fill, so it requires visual line mode to look nice
(setq nov-text-width t)
(add-hook 'nov-mode-hook 'visual-line-mode)
(add-hook 'nov-mode-hook 'follow-mode)
(add-hook 'nov-mode-hook (lambda ()
(setq next-screen-context-lines 4
line-spacing .1)))
(add-hook 'nov-post-html-render-hook 'my-nov-set-margins)
(require 'my-nov)
(my-override nov-render-title)
(my-override nov-scroll-up)
(my-keybind nov-mode-map
"Q" #'my-nov-copy-buffer-file-with-staging
"i" #'imenu)
)
;;; json-mode
(my-package json-mode
(:delay 30)
(:install t)
(require 'my-prog)
(add-hook 'json-mode-hook 'my-json-setup-hook)
)
(provide 'ycp-markup)
;;; ycp-markup.el ends here
|