[Emacs Lisp] Personal ~/.emacs.d/ configuration folder.
Byte-compiled literate config! <3
Changed files
init.el
@@ -5,18 +5,17 @@
5
5
6
6
;;; Code:
7
7
8
Removed:
9
8
;; First of all, we indicate the path to our literate configuration file.
10
Removed:
(setq my/literate-config (concat user-emacs-directory "smart-documents"))
9
Added:
(setq my/literate-config (concat user-emacs-directory "smart-documents.org"))
11
10
12
11
;; Emacs will startup faster next time, because it will load
13
12
;; a byte-compiled version of our literate configuration file.
14
Removed:
(cond ((file-exists-p (concat my/literate-config ".elc"))
15
Removed:
(load (concat my/literate-config ".elc")))
16
Removed:
((file-exists-p (concat my/literate-config ".el"))
17
Removed:
(load (concat my/literate-config ".el")))
18
Removed:
((file-exists-p (concat my/literate-config ".org"))
19
Removed:
(org-babel-load-file (concat my/literate-config ".org")))
13
Added:
(cond ((file-exists-p (concat (file-name-sans-extension my/literate-config) ".elc"))
14
Added:
(load (concat (file-name-sans-extension my/literate-config) ".elc")))
15
Added:
((file-exists-p (concat (file-name-sans-extension my/literate-config) ".el"))
16
Added:
(load (concat (file-name-sans-extension my/literate-config) ".el")))
17
Added:
((file-exists-p my/literate-config)
18
Added:
(org-babel-load-file my/literate-config))
20
19
(t (message "There appears to be no literate configuration file. Reinstall?")))
21
20
22
21
(provide 'init)
smart-documents.org
@@ -8,6 +8,9 @@
8
8
#+SETUPFILE: ~/.emacs.d/templates/documents/general.org
9
9
#+INCLUDE: ~/.emacs.d/templates/documents/general.org_title
10
10
11
Added:
# By default, Org Babel does not tangle blocks.
12
Added:
#+PROPERTY: header-args :tangle yes
13
Added:
11
14
#+LATEX_HEADER: \setmainfont{urw gothic}
12
15
13
16
#+LATEX: \begin{abstract}
@@ -61,16 +64,16 @@
61
64
#+BEGIN_SRC emacs-lisp
62
65
(defun my/tokenize-user-details ()
63
66
"Tokenize user details."
64
Removed:
67
Added:
65
68
(cons 'user-full-name user-full-name))
66
69
67
Removed:
(unless (file-exists-p (concat user-emacs-directory
68
Removed:
"meta/user-details"))
69
Removed:
(setq user-full-name (read-string "Enter full user name:"))
70
Removed:
(setq user-mail-address (read-string "Enter user e-mail address:"))
71
Removed:
(setq user-details '(user-full-name
72
Removed:
user-mail-address))
73
Removed:
(append-to-file "Foobar\n" nil "~/.emacs.d/meta/foobar"))
70
Added:
(unless (file-exists-p (concat user-emacs-directory
71
Added:
"meta/user-details"))
72
Added:
(setq user-full-name (read-string "Enter full user name:"))
73
Added:
(setq user-mail-address (read-string "Enter user e-mail address:"))
74
Added:
(setq user-details '(user-full-name
75
Added:
user-mail-address))
76
Added:
(append-to-file "Foobar\n" nil "~/.emacs.d/meta/foobar"))
74
77
#+END_SRC
75
78
76
79
** File system paths
@@ -89,23 +92,27 @@
89
92
90
93
** The first file to load, =early-init.el=
91
94
92
Removed:
This is the very first user-writable file loaded by Emacs.[fn::This feature
95
Added:
This is the very first user-editable file loaded by Emacs.[fn::This feature
93
96
became available in version 27.1.] In it, we disable GUI elements that would
94
97
otherwise be loaded and displayed once Emacs is ready to accept user input.
95
98
96
99
#+BEGIN_SRC emacs-lisp
97
100
(setq my/early-init-file (concat user-emacs-directory "early-init.el"))
98
101
99
Removed:
(unless (file-exists-p my/early-init-file)
102
Added:
(defun my/create-early-init-file ()
103
Added:
"Create `early-init.el' file in `user-emacs-directory'."
100
104
(write-region
101
105
"(menu-bar-mode -1)
102
106
(tool-bar-mode -1)
103
107
(menu-bar-bottom-and-right-window-divider)
104
Removed:
(setq gc-cons-threshold 100000000)" nil my/early-init-file)
108
Added:
(setq gc-cons-threshold 100000000)" nil my/early-init-file))
109
Added:
110
Added:
(unless (file-exists-p my/early-init-file)
105
111
(menu-bar-mode -1)
106
112
(tool-bar-mode -1)
107
113
(menu-bar-bottom-and-right-window-divider)
108
Removed:
(setq gc-cons-threshold 100000000))
114
Added:
(setq gc-cons-threshold 100000000)
115
Added:
(my/create-early-init-file))
109
116
#+END_SRC
110
117
111
118
** The second file to load, =init.el=
@@ -118,19 +125,25 @@
118
125
#+END_QUOTE
119
126
120
127
#+BEGIN_SRC emacs-lisp
121
Removed:
(setq my/init-file (concat user-emacs-directory "init.el"))
128
Added:
(setq my/init-file (concat user-emacs-directory "init.el"))
122
129
123
Removed:
(unless (file-exists-p my/init-file)
124
Removed:
(write-region
125
Removed:
"(menu-bar-mode -1)
126
Removed:
(tool-bar-mode -1)
127
Removed:
(menu-bar-bottom-and-right-window-divider)" nil my/early-init-file)
128
Removed:
(menu-bar-mode -1)
130
Added:
(defun my/create-init-file ()
131
Added:
"Create `init.el' file in `user-emacs-directory'."
132
Added:
(write-region
133
Added:
"(menu-bar-mode -1)
129
134
(tool-bar-mode -1)
130
Removed:
(menu-bar-bottom-and-right-window-divider))
135
Added:
(menu-bar-bottom-and-right-window-divider)" nil my/init-file))
136
Added:
137
Added:
;; TODO This is a copy paste of `early.init.el'. Should be changed.
138
Added:
(unless (file-exists-p my/init-file)
139
Added:
(menu-bar-mode -1)
140
Added:
(tool-bar-mode -1)
141
Added:
(menu-bar-bottom-and-right-window-divider)
142
Added:
(my/create-init-file))
131
143
#+END_SRC
132
144
133
Removed:
If no file is found, Emacs then loads in its purely vanilla state.
145
Added:
If no file is found, Emacs then loads in its purely vanilla state.
146
Added:
134
147
** Profiling --- start
135
148
136
149
We start the profiler now , and will interrupt it in Section [[Profiling ---
@@ -157,20 +170,20 @@
157
170
158
171
#+NAME: shortcut-config
159
172
#+BEGIN_SRC emacs-lisp
160
Removed:
(defun my/find-literate-config ()
173
Added:
(defun my/find-literate-config ()
161
174
"Jump to this very file."
162
175
(interactive)
163
Removed:
(find-file (concat my/literate-config ".org"))
176
Added:
(find-file my/literate-config))
164
177
165
Removed:
(global-set-key (kbd "C-c c") 'my/find-literate-config)
178
Added:
(global-set-key (kbd "C-c c") 'my/find-literate-config)
166
179
#+END_SRC
167
180
168
181
Now, different shortcuts for other customization actions:
169
182
170
183
#+NAME: shortcuts-customization
171
184
#+BEGIN_SRC emacs-lisp
172
Removed:
(global-set-key (kbd "C-c v") 'customize-variable)
173
Removed:
(global-set-key (kbd "C-c f") 'customize-face)
185
Added:
(global-set-key (kbd "C-c v") 'customize-variable)
186
Added:
(global-set-key (kbd "C-c f") 'customize-face)
174
187
#+END_SRC
175
188
176
189
** Locations
@@ -417,9 +430,9 @@
417
430
418
431
Org base directory is in user home on GNU/Linux, or in =AppData= in MS Windows.
419
432
420
Removed:
#+NAME: org-basic
433
Added:
#+NAME: org-directory
421
434
#+BEGIN_SRC emacs-lisp
422
Removed:
(setq org-directory (concat user-emacs-directory "~/org"))
435
Added:
(setq org-directory (concat user-emacs-directory "~/org"))
423
436
#+END_SRC
424
437
425
438
First, we hide markup symbols for *bold*, /italic/, _underlined_ and
@@ -430,27 +443,33 @@
430
443
For the time being, I will in fact display emphasis markers, because hiding
431
444
them corrupts tables.
432
445
433
Removed:
#+NAME: org-basic
446
Added:
#+NAME: org-format
434
447
#+BEGIN_SRC emacs-lisp
435
Removed:
(setq org-hide-emphasis-markers nil)
436
Removed:
(setq org-startup-indented t)
448
Added:
(setq org-hide-emphasis-markers nil
449
Added:
org-startup-indented t
450
Added:
org-src-preserve-indentation nil
451
Added:
org-edit-src-content-indentation 0)
437
452
#+END_SRC
438
453
454
Added:
#+BEGIN_SRC emacs-lisp
455
Added:
456
Added:
#+END_SRC
457
Added:
439
458
*** Languages executable in smart documents
440
459
441
460
The following languages can be written inside =SRC= blocks, in view of being
442
461
executed by the Org Babel backend.
443
462
444
463
#+BEGIN_SRC emacs-lisp
445
Removed:
(setq org-babel-load-languages
446
Removed:
'((shell . t)
447
Removed:
(python . t)
448
Removed:
(plantuml . t)
449
Removed:
(emacs-lisp . t)
450
Removed:
(awk . t)
451
Removed:
(ledger . t)
452
Removed:
(gnuplot . t)
453
Removed:
(latex . t)))
464
Added:
(setq org-babel-load-languages
465
Added:
'((shell . t)
466
Added:
(python . t)
467
Added:
(plantuml . t)
468
Added:
(emacs-lisp . t)
469
Added:
(awk . t)
470
Added:
(ledger . t)
471
Added:
(gnuplot . t)
472
Added:
(latex . t)))
454
473
#+END_SRC
455
474
456
475
*** Prevent or warn on invisible edits
@@ -466,14 +485,14 @@
466
485
=org-time-stamp= can be inserted with ~C-c .~ (period)]
467
486
468
487
#+BEGIN_SRC emacs-lisp
469
Removed:
(global-set-key (kbd "C-c a") 'org-agenda-list)
488
Added:
(global-set-key (kbd "C-c a") 'org-agenda-list)
470
489
471
Removed:
(defun my/find-diary-file ()
490
Added:
(defun my/find-diary-file ()
472
491
"Load `org-agenda-diary-file'."
473
492
(interactive)
474
493
(find-file org-agenda-diary-file))
475
494
476
Removed:
(global-set-key (kbd "C-c d") 'my/find-diary-file)
495
Added:
(global-set-key (kbd "C-c d") 'my/find-diary-file)
477
496
#+END_SRC
478
497
479
498
*** Timestamps
@@ -482,7 +501,7 @@
482
501
format:
483
502
484
503
#+BEGIN_SRC emacs-lisp
485
Removed:
(setq org-time-stamp-custom-formats
504
Added:
(setq org-time-stamp-custom-formats
486
505
'("%d %b. %Y (%a)" . "%d %b. %Y (%a), at %H:%M"))
487
506
#+END_SRC
488
507
@@ -1069,17 +1088,14 @@
1069
1088
** TODO Speeding up the next startup
1070
1089
1071
1090
#+BEGIN_SRC emacs-lisp
1072
Removed:
(defun byte-compile-if-literate-config ()
1073
Removed:
"Byte compile the current file if it is `my/literate-config-org'."
1074
Removed:
(interactive)
1075
Removed:
(when (string-equal
1076
Removed:
buffer-file-name
1077
Removed:
"/home/blendux/.emacs.d/smart-documents.org")
1078
Removed:
(delete-file (concat my/literate-config ".elc"))
1079
Removed:
(byte-compile (concat my/literate-config ".el")))
1080
Removed:
(message "c'mon work fucker"))
1091
Added:
(defun byte-compile-literate-config ()
1092
Added:
"Byte compile our literate configuration file."
1093
Added:
(delete-file (concat (file-name-sans-extension my/literate-config) ".elc"))
1094
Added:
(org-babel-tangle-file my/literate-config)
1095
Added:
(byte-compile-file (concat (file-name-sans-extension my/literate-config) ".el"))
1096
Added:
(message "c'mon work fucker"))
1081
1097
1082
Removed:
(add-hook 'after-save-file 'byte-compile-if-literate-config)
1098
Added:
(add-hook 'kill-emacs-hook 'byte-compile-literate-config)
1083
1099
#+END_SRC
1084
1100
1085
1101
** Profiling --- stop