Improve emacs config some more
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
__init__.py
|
__init__.py
|
||||||
/fonts/.uuid
|
/fonts/.uuid
|
||||||
init.el
|
|
||||||
|
|||||||
4
files/init.el
Normal file
4
files/init.el
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
(require 'org)
|
||||||
|
(find-file (concat user-emacs-directory "init.org"))
|
||||||
|
(org-babel-tangle)
|
||||||
|
(load-file (concat user-emacs-directory "init.el"))
|
||||||
@@ -9,11 +9,40 @@ All changes to the configuration should be done in =init.org=, *not* in
|
|||||||
is replaced the first time Emacs is started (assuming it has been renamed
|
is replaced the first time Emacs is started (assuming it has been renamed
|
||||||
to =~/.emacs.d=).
|
to =~/.emacs.d=).
|
||||||
|
|
||||||
To use the tangled =init.el=, you should link it to =~/.emacs.d/init.el=:
|
To use the tangled =init.el=, I link it to =~/.emacs.d/init.el=:
|
||||||
#+begin_src sh :tangle no
|
#+begin_src sh :tangle no
|
||||||
ln -s ~/dots/files/init.el ~/.emacs.d/init.el
|
ln -s ~/dots/files/init.el ~/.emacs.d/init.el
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
This file replaces itself with the actual configuration at first run.
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle no
|
||||||
|
(require 'org)
|
||||||
|
(find-file (concat (getenv "HOME") "dots/files/init.org"))
|
||||||
|
(org-babel-tangle)
|
||||||
|
(load-file (concat (getenv "HOME") "dots/files/init.el"))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
It tangles the org-file, so that this file is overwritten with the actual
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
There is no reason to track the =init.el= that is generated; by running
|
||||||
|
the following command =git= will not bother tracking it:
|
||||||
|
#+BEGIN_SRC sh :tangle no
|
||||||
|
git update-index --assume-unchanged init.el
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
If one wishes to make changes to the repo-version of =init.el= start
|
||||||
|
tracking again with:
|
||||||
|
#+BEGIN_SRC sh :tangle no
|
||||||
|
git update-index --no-assume-unchanged init.el
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Startup
|
||||||
|
=lexical-binding= can improve speed.
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||||
|
;;; -*- lexical-binding: t -*-
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
** Tangle
|
** Tangle
|
||||||
The =init.el= should (after the first run) mirror the source blocks in
|
The =init.el= should (after the first run) mirror the source blocks in
|
||||||
the =init.org=. We can use =C-c C-v t= to run =org-babel-tangle=, which
|
the =init.org=. We can use =C-c C-v t= to run =org-babel-tangle=, which
|
||||||
@@ -26,10 +55,8 @@ the =after-save-hook= ensuring to always tangle and byte-compile the
|
|||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle yes
|
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||||
(defun tangle-init ()
|
(defun tangle-init ()
|
||||||
"If the current buffer is 'init.org' the code-blocks are
|
|
||||||
tangled, and the tangled file is compiled."
|
|
||||||
(when (equal (buffer-file-name)
|
(when (equal (buffer-file-name)
|
||||||
(expand-file-name "/home/marc/dots/files/init.org"))
|
(expand-file-name (concat (getenv "HOME") "/dots/files/init.org")))
|
||||||
;; Avoid running hooks when tangling.
|
;; Avoid running hooks when tangling.
|
||||||
(let ((prog-mode-hook nil))
|
(let ((prog-mode-hook nil))
|
||||||
(org-babel-tangle))))
|
(org-babel-tangle))))
|
||||||
@@ -92,8 +119,7 @@ Default is 0.5.
|
|||||||
Introduced in Emacs HEAD (b2f8c9f), this inhibits fontification while
|
Introduced in Emacs HEAD (b2f8c9f), this inhibits fontification while
|
||||||
receiving input, which should help a little with scrolling performance.
|
receiving input, which should help a little with scrolling performance.
|
||||||
#+begin_src emacs-lisp :tangle yes
|
#+begin_src emacs-lisp :tangle yes
|
||||||
(setq idle-update-delay 1.0
|
(setq redisplay-skip-fontification-on-input t)
|
||||||
redisplay-skip-fontification-on-input t)
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
@@ -111,6 +137,19 @@ Some defaults, which i forget the reason of using it.
|
|||||||
fast-but-imprecise-scrolling t)
|
fast-but-imprecise-scrolling t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** Auto revert
|
||||||
|
Automaticly revert =doc-view=-buffers when the file changes on disk.
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||||
|
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Short yes/no
|
||||||
|
Answering /yes/ and /no/ to each question from Emacs can be tedious, a
|
||||||
|
single /y/ or /n/ will suffice.
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
*** Quit prompts
|
*** Quit prompts
|
||||||
Make ESC quit prompts.
|
Make ESC quit prompts.
|
||||||
#+begin_src emacs-lisp :tangle yes
|
#+begin_src emacs-lisp :tangle yes
|
||||||
@@ -752,7 +791,7 @@ Python's lsp has auto configuration for =lsp-mode=
|
|||||||
** Input methods
|
** Input methods
|
||||||
*** spelling
|
*** spelling
|
||||||
Sjoe my speling misttakes.
|
Sjoe my speling misttakes.
|
||||||
#+begin_src emacs-lisp :tanlge yes
|
#+begin_src emacs-lisp :tangle yes
|
||||||
(use-package ispell
|
(use-package ispell
|
||||||
:straight t
|
:straight t
|
||||||
:if (executable-find "hunspell")
|
:if (executable-find "hunspell")
|
||||||
|
|||||||
Reference in New Issue
Block a user