aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/init/ycp-markup.el
blob: e03fd86e011f3a24eb4a149f52a86c5556aba594 (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
;;; 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))

(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"))

;;; todo: open epub in emacs client with nov
(my-package nov
  (:delay 15)
  (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
  (setq nov-text-width fill-column)
  (add-hook 'nov-mode-hook 'follow-mode)
  (require 'my-nov)
  (my-override nov-render-title)
  (my-override nov-scroll-up)
  )

;;; 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