blob: 004e4d7a8050d4ac04cef5070be0345ffc471a3b (
plain)
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
|
;;; appearance.el -*- lexical-binding: t; -*-
;;;
;;; Author: Jakob L. Kreuze <zerodaysfordays@sdf.org>
;;; URL: https://git.sr.ht/~jakob/.emacs.d/
;;;
;;; Configuration for making Emacs look pretty.
;;;
(require 'scroll-bar)
(require 'fringe)
;; Use soft wrapping instead of "scrolling" when overflowing the width of a frame.
(global-visual-line-mode t)
;; The menu bar can be accessed with <M-`> if I really need it, so I don't see
;; the point in having it take up the space at the top. The rest of these rarely
;; see use from me, and I'd prefer to disable them and have access to the extra
;; screen real estate.
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(fringe-mode -1)
;; Hacking is a lot more serene when visual stimulus is kept to a minimum.
(blink-cursor-mode 0)
;; Enable `prettify-symbols' globally.
(global-prettify-symbols-mode t)
;; This is snippet was taken verbatim from Emacs StackExchange [1] to enable
;; `prettify-symbols in Org source code blocks. Sadly, I can't think of a way to
;; implement this as advice.
;;
;; [1]: https://emacs.stackexchange.com/questions/17283/is-it-possible-to-get-prettified-symbols-in-org-mode-source-blocks
(defun org-src-font-lock-fontify-block (lang start end)
"Fontify code block.
This function is called by emacs automatic fontification, as long
as `org-src-fontify-natively' is non-nil."
(let ((lang-mode (org-src-get-lang-mode lang)))
(when (fboundp lang-mode)
(let ((string (buffer-substring-no-properties start end))
(modified (buffer-modified-p))
(org-buffer (current-buffer)))
(remove-text-properties start end '(face nil))
(with-current-buffer
(get-buffer-create
(format " *org-src-fontification:%s*" lang-mode))
(let ((inhibit-modification-hooks nil))
(erase-buffer)
;; Add string and a final space to ensure property change.
(insert string " "))
(unless (eq major-mode lang-mode) (funcall lang-mode))
(org-font-lock-ensure)
(let ((pos (point-min)) next)
(while (setq next (next-property-change pos))
;; Handle additional properties from font-lock, so as to
;; preserve, e.g., composition.
(dolist (prop (cons 'face font-lock-extra-managed-props))
(let ((new-prop (get-text-property pos prop)))
(put-text-property
(+ start (1- pos)) (1- (+ start next)) prop new-prop
org-buffer)))
(setq pos next))
;; Addition: also copy 'composition info for prettified symbols
(setq pos (point-min))
(while (setq next (next-single-property-change pos 'composition))
(put-text-property
(+ start (1- pos)) (1- (+ start next)) 'composition
(get-text-property pos 'composition) org-buffer)
(setq pos next)))
;; End addition
)
;; Add Org faces.
(let ((src-face (nth 1 (assoc-string lang org-src-block-faces t))))
(when (or (facep src-face) (listp src-face))
(font-lock-append-text-property start end 'face src-face))
(font-lock-append-text-property start end 'face 'org-block))
(add-text-properties
start end
'(font-lock-fontified t fontified t font-lock-multiline t))
(set-buffer-modified-p modified)))))
;; Although I'm usually not a fan of treating non-printable ASCII like this, the
;; lines act as sort more of a cue for me to use <C-x [> and <C-x ]> than a
;; plain ol' '^L'.
(use-package page-break-lines
:demand t
:config
(global-page-break-lines-mode))
|
© 2015 - 2026 Jakob L. Kreuze