[Emacs] Cleaner init file export, fix some elisp code
However, I currently have the issue of the packages `org' having two straight recipies and I cannot find the dependency that’s causing this.
This commit is contained in:
parent
644f96305b
commit
e30ca77fbe
@ -383,7 +383,7 @@ Doom-Emacs has some really nice macros that can come in really handy,
|
||||
but since I prefer to rely on my own configuration, I’ll instead just
|
||||
copy their code here. First we get the ~after!~ macro:
|
||||
#+begin_src emacs-lisp
|
||||
(require 'cl)
|
||||
(require 'cl-lib)
|
||||
(defmacro after! (package &rest body)
|
||||
"Evaluate BODY after PACKAGE have loaded.
|
||||
|
||||
@ -1403,7 +1403,7 @@ Paris 8 (my university).
|
||||
|
||||
Next I need an inbox dedicated to the association I’m part of.
|
||||
#+name: mu4e-bookmarks-filter-asso
|
||||
#+headers: tangle no :cache yes
|
||||
#+headers: :tangle no :cache yes
|
||||
#+begin_src emacs-lisp
|
||||
(let ((regex "/.*supran\\.fr/"))
|
||||
<<mu4e-bookmarks-from-copy-to-gen>>)
|
||||
@ -1637,7 +1637,7 @@ Let’s enable them and set them:
|
||||
#+end_src
|
||||
|
||||
#+name: mu4e-vertical-split
|
||||
#+begin_src emacs-lisp
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun my/set-mu4e-headers-width ()
|
||||
(let ((width (window-body-width))
|
||||
(threshold (+ 120 80)))
|
||||
@ -2276,6 +2276,7 @@ since been archived. New implementations then appeared, one of them is
|
||||
#+begin_src emacs-lisp
|
||||
(use-package parinfer-rust-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:diminish parinfer-rust-mode
|
||||
:hook emacs-lisp-mode common-lisp-mode scheme-mode
|
||||
:init
|
||||
@ -2407,7 +2408,8 @@ display the latest commit message and its age about a file in the file
|
||||
tree. And by default, I want ~dired-git-info~ to hide file details.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package dired-git-info
|
||||
:after dired
|
||||
:after (dired)
|
||||
:straight (:build t)
|
||||
:hook (dired-after-reading . dired-git-info-auto-enable)
|
||||
:general
|
||||
(:keymaps 'dired-mode-map
|
||||
@ -2420,8 +2422,8 @@ tree. And by default, I want ~dired-git-info~ to hide file details.
|
||||
Diredfl makes dired colorful, and much more readable in my opinion.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package diredfl
|
||||
:after (dired all-the-icons)
|
||||
:straight (:build t)
|
||||
:after dired
|
||||
:init
|
||||
(diredfl-global-mode 1))
|
||||
#+end_src
|
||||
@ -2429,13 +2431,16 @@ Diredfl makes dired colorful, and much more readable in my opinion.
|
||||
And let’s add some fancy icons in dired!
|
||||
#+begin_src emacs-lisp
|
||||
(use-package all-the-icons-dired
|
||||
:after (all-the-icons)
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (dired-mode . all-the-icons-dired-mode))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package image-dired+
|
||||
:after image-dired
|
||||
:after (image-dired)
|
||||
:straight (:build t)
|
||||
:init (image-diredx-adjust-mode 1))
|
||||
#+end_src
|
||||
|
||||
@ -2485,19 +2490,27 @@ Eshell is a built-in shell available from Emacs which I use almost as
|
||||
often as fish. Some adjustments are necessary to make it fit my taste
|
||||
though.
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
:keymaps 'eshell-mode-map
|
||||
(use-package eshell
|
||||
:defer t
|
||||
:straight (:type built-in :build t)
|
||||
:general
|
||||
(:keymaps 'eshell-mode-map
|
||||
:states 'normal
|
||||
"c" #'evil-backward-char
|
||||
"t" #'evil-next-line
|
||||
"s" #'evil-previous-line
|
||||
"r" #'evil-forward-char)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'eshell-mode-map
|
||||
(:keymaps 'eshell-mode-map
|
||||
:states 'insert
|
||||
"C-a" #'eshell-bol
|
||||
"C-e" #'end-of-line)
|
||||
:config
|
||||
<<eshell-alias-file>>
|
||||
<<eshell-concat-shell-command>>
|
||||
<<eshell-alias-open>>
|
||||
<<eshell-alias-buffers>>
|
||||
<<eshell-alias-emacs>>
|
||||
<<eshell-alias-mkcd>>)
|
||||
#+end_src
|
||||
|
||||
**** Aliases
|
||||
@ -2506,14 +2519,16 @@ though.
|
||||
:END:
|
||||
First, let’s declare our list of “dumb” aliases we’ll use in
|
||||
Eshell. You can find them here.
|
||||
#+begin_src emacs-lisp
|
||||
#+name: eshell-alias-file
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(setq eshell-aliases-file (expand-file-name "eshell-aliases" user-emacs-directory))
|
||||
#+end_src
|
||||
|
||||
A couple of other aliases will be defined through custom Elisp
|
||||
functions, but first I’ll need a function for concatenating a shell
|
||||
command into a single string:
|
||||
#+begin_src emacs-lisp
|
||||
#+name: eshell-concat-shell-command
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun phundrak/concatenate-shell-command (&rest command)
|
||||
"Concatenate an eshell COMMAND into a single string.
|
||||
All elements of COMMAND will be joined in a single
|
||||
@ -2524,7 +2539,8 @@ space-separated string."
|
||||
I’ll also declare some aliases here, such as ~open~ and ~openo~ that
|
||||
respectively allow me to open a file in Emacs, and same but in another
|
||||
window.
|
||||
#+begin_src emacs-lisp
|
||||
#+name: eshell-alias-open
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defalias 'open 'find-file)
|
||||
(defalias 'openo 'find-file-other-window)
|
||||
#+end_src
|
||||
@ -2535,7 +2551,8 @@ my aliases file for stuff that could work too with other shells were
|
||||
the syntax a bit different, and aliases related to Elisp are kept
|
||||
programmatically. I’ll also declare ~list-buffers~ an alias of ~ibuffer~
|
||||
because naming it that way kind of makes more sense to me.
|
||||
#+begin_src emacs-lisp
|
||||
#+name: eshell-alias-buffers
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defalias 'list-buffers 'ibuffer)
|
||||
#+end_src
|
||||
|
||||
@ -2543,7 +2560,8 @@ I still have some stupid muscle memory telling me to open ~emacs~, ~vim~
|
||||
or ~nano~ in Eshell, which is stupid: I’m already inside Emacs and I
|
||||
have all its power available instantly. So, let’s open each file
|
||||
passed to these commands.
|
||||
#+begin_src emacs-lisp
|
||||
#+name: eshell-alias-emacs
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun eshell/emacs (&rest file)
|
||||
"Open each FILE and kill eshell.
|
||||
Old habits die hard."
|
||||
@ -2556,7 +2574,8 @@ Finally, I’ll declare ~mkcd~ which allows the simultaneous creation of a
|
||||
directory and moving into this newly created directory. And of course,
|
||||
it will also work if the directory also exists or if parent
|
||||
directories don’t, similarly to the ~-p~ option passed to ~mkdir~.
|
||||
#+begin_src emacs-lisp
|
||||
#+name: eshell-alias-mkcd
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun eshell/mkcd (dir)
|
||||
"Create the directory DIR and move there.
|
||||
If the directory DIR doesn’t exist, create it and its parents
|
||||
@ -2651,6 +2670,7 @@ I fire up a terminal. I haven’t found anything that does that the way
|
||||
I like it, so [[https://github.com/Phundrak/eshell-info-banner.el][I’ve written a package]]!
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eshell-info-banner
|
||||
:after (eshell)
|
||||
:defer t
|
||||
:straight (eshell-info-banner :build t
|
||||
:type git
|
||||
@ -2666,8 +2686,9 @@ Another feature I like is fish-like syntax highlight, which brings
|
||||
some more colors to Eshell.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eshell-syntax-highlighting
|
||||
:after esh-mode
|
||||
:after (esh-mode eshell)
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:config
|
||||
(eshell-syntax-highlighting-global-mode +1))
|
||||
#+end_src
|
||||
@ -2699,36 +2720,19 @@ a more human-readable name, see [[https://protesilaos.com/codelog/2021-10-15-ema
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Packages-Configuration-Emacs-built-ins-Info-r7x90j20c5j0
|
||||
:END:
|
||||
Something that irks me as I use evil and a leader key is that the
|
||||
space bar is already bound to a function, ~Info-scroll-up~. Same goes
|
||||
for my local leader ~,~ which is bound to ~Info-index-next~. I don’t want
|
||||
that, so let’s unbind them:
|
||||
Let’s define some more intuitive keybinds for ~info-mode~.
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
:keymaps '(Info-mode-map)
|
||||
"SPC" nil
|
||||
"," nil)
|
||||
(general-define-key
|
||||
:keymaps '(Info-mode-map)
|
||||
:states 'normal
|
||||
"SPC" nil
|
||||
"," nil)
|
||||
#+end_src
|
||||
|
||||
Alright, now that we correctly unbound them, my global leader key
|
||||
works again, and I’m free to use the comma as a local leader, so let’s
|
||||
do that:
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
:keymaps 'Info-mode-map
|
||||
(use-package info
|
||||
:defer t
|
||||
:straight (info :type built-in :build t)
|
||||
:general
|
||||
(:keymaps 'Info-mode-map
|
||||
:states 'normal
|
||||
"c" #'Info-prev
|
||||
"t" #'evil-scroll-down
|
||||
"s" #'evil-scroll-up
|
||||
"r" #'Info-next)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'Info-mode-map
|
||||
(:keymaps 'Info-mode-map
|
||||
:states 'normal
|
||||
:prefix ","
|
||||
"?" #'Info-toc
|
||||
@ -2736,7 +2740,7 @@ do that:
|
||||
"f" #'Info-history-forward
|
||||
"m" #'Info-menu
|
||||
"t" #'Info-top-node
|
||||
"u" #'Info-up)
|
||||
"u" #'Info-up))
|
||||
#+end_src
|
||||
|
||||
*** Tramp
|
||||
@ -2749,6 +2753,10 @@ various hosts using various protocols, such as ~ssh~ and
|
||||
supported natively. I will describe them here.
|
||||
#+begin_src emacs-lisp
|
||||
(require 'tramp)
|
||||
(use-package tramp
|
||||
:straight (tramp :type built-in :build t)
|
||||
:init
|
||||
<<tramp-add-yadm>>)
|
||||
#+end_src
|
||||
|
||||
**** Yadm
|
||||
@ -2760,7 +2768,8 @@ loads of features I don’t use (the main one I like but don’t use is
|
||||
its [[https://yadm.io/docs/templates][Jinja-like host and OS-aware syntax]]), but unfortunately Magit
|
||||
doesn’t play nice with it. Tramp to the rescue, and this page explains
|
||||
how! Let’s just insert in my config this code snippet:
|
||||
#+begin_src emacs-lisp
|
||||
#+name: tramp-add-yadm
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(add-to-list 'tramp-methods
|
||||
'("yadm"
|
||||
(tramp-login-program "yadm")
|
||||
@ -2844,6 +2853,15 @@ enhances a couple of built-in functions from Emacs, namely:
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Packages-Configuration-Org-modedw35fl6184j0
|
||||
:END:
|
||||
Since recently, in order to make ~org-cite~ compile properly, we need
|
||||
the ~citeproc~ package, a citation processor.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package citeproc
|
||||
:after (org)
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
Org is the main reason I am using Emacs. It is an extremely powerfu
|
||||
tool when you want to write anything that is not necessarily primarily
|
||||
programming-related, though it absolutely can be! Org can be a
|
||||
@ -2906,7 +2924,9 @@ extended however we like!
|
||||
<<org-latex-listings>>
|
||||
<<org-latex-default-packages>>
|
||||
<<org-export-latex-hyperref-format>>
|
||||
<<org-export-latex-minted-options>>
|
||||
<<org-latex-pdf-process>>
|
||||
<<org-latex-logfiles-add-extensions>>
|
||||
<<org-re-reveal-root>>
|
||||
<<org-html-validation>>
|
||||
<<org-latex-classes>>
|
||||
@ -2941,7 +2961,7 @@ comfortable than the default ones you get with evil and org naked.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package evil-org
|
||||
:straight (:build t)
|
||||
:after org
|
||||
:after (org)
|
||||
:hook (org-mode . evil-org-mode)
|
||||
:config
|
||||
(setq-default evil-org-movement-bindings
|
||||
@ -2961,7 +2981,6 @@ trees, converting translitterated text to its native script, etc…
|
||||
(use-package conlanging
|
||||
:straight (conlanging :build t
|
||||
:type git
|
||||
:host nil
|
||||
:repo "https://labs.phundrak.com/phundrak/conlanging.el")
|
||||
:after org
|
||||
:defer t)
|
||||
@ -2974,6 +2993,8 @@ it. The main reason I want ~org-contrib~ is due to ~ox-extra~ that allow
|
||||
the usage of the ~:ignore:~ tag in org.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-contrib
|
||||
:after (org)
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:init
|
||||
(require 'ox-extra)
|
||||
@ -3011,7 +3032,7 @@ for org files that will be hosted and viewable on Github.
|
||||
|
||||
~electric-mode~ also bothers me a lot when editing org files, so let’s deactivate it:
|
||||
#+name: org-behavior-electric
|
||||
#+begin_src emacs-lisp
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(add-hook 'org-mode-hook (lambda ()
|
||||
(interactive)
|
||||
(electric-indent-local-mode -1)))
|
||||
@ -3046,6 +3067,7 @@ to easily convert a LaTeX snippet into a PNG, regardless of the
|
||||
exporter I use afterwards. Its installation is pretty simple:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ob-latex-as-png
|
||||
:after (org)
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
#+end_src
|
||||
@ -3075,7 +3097,7 @@ activated. Here are the languages I activated in my Org-mode configuration:
|
||||
#+NAME: org-babel-languages-gen
|
||||
#+header: :cache yes :results replace
|
||||
#+header: :var languages=org-babel-languages-table[,0]
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
#+BEGIN_SRC emacs-lisp :exports none :tangle no
|
||||
(format "'(%s)"
|
||||
(mapconcat (lambda ($language)
|
||||
(format "(%s . t)" $language))
|
||||
@ -3121,7 +3143,6 @@ describing phonetics evolution. So, let’s disable it:
|
||||
(setq org-use-sub-superscripts (quote {}))
|
||||
#+END_SRC
|
||||
|
||||
|
||||
**** Epub
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-Epub-w5ycfuz095j0
|
||||
@ -3130,7 +3151,7 @@ A backend for exporting files through org I like is ~ox-epub~ which, as
|
||||
you can guess, exports org files to the [[https://www.w3.org/publishing/epub32/][Epub format]].
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ox-epub
|
||||
:after ox
|
||||
:after (org ox)
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
@ -3141,20 +3162,21 @@ you can guess, exports org files to the [[https://www.w3.org/publishing/epub32/]
|
||||
For Reveal.JS exports, I need to set where to find the framework by
|
||||
default:
|
||||
#+NAME: org-re-reveal-root
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-re-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")
|
||||
#+END_SRC
|
||||
|
||||
On HTML exports, Org-mode tries to include a validation link for the
|
||||
exported HTML. Let’s disable that since I never use it.
|
||||
#+NAME: org-html-validation
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-html-validation-link nil)
|
||||
#+END_SRC
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package htmlize
|
||||
:defer t)
|
||||
;; (use-package htmlize
|
||||
;; :defer t
|
||||
;; :straight (:build t))
|
||||
#+end_src
|
||||
|
||||
This package allows for live-previewing the HTML export of an org
|
||||
@ -3164,7 +3186,7 @@ files.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package preview-org-html-mode
|
||||
:defer t
|
||||
:after org
|
||||
:after (org)
|
||||
:straight (preview-org-html-mode :build t
|
||||
:type git
|
||||
:host github
|
||||
@ -3189,14 +3211,14 @@ When it comes to exports, I want the LaTeX and PDF exports to be done
|
||||
with XeLaTeX only. This implies the modification of the following
|
||||
variable:
|
||||
#+NAME: org-latex-compiler
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-latex-compiler "xelatex")
|
||||
#+END_SRC
|
||||
|
||||
I also want to get by default ~minted~ for LaTeX listings so I can have
|
||||
syntax highlights:
|
||||
#+NAME: org-latex-listings
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-latex-listings 'minted)
|
||||
#+END_SRC
|
||||
|
||||
@ -3211,7 +3233,7 @@ packages:
|
||||
- ~booktabs~ for nicer tables
|
||||
- and ~tabularx~ for tabulars with adjustable columns
|
||||
#+NAME: org-latex-default-packages
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(dolist (package '(("AUTO" "inputenc" t ("pdflatex"))
|
||||
("T1" "fontenc" t ("pdflatex"))
|
||||
("" "grffile" t)))
|
||||
@ -3230,13 +3252,13 @@ packages:
|
||||
By the way, reference links in LaTeX should be written in this format,
|
||||
since we are using ~cleveref~:
|
||||
#+NAME: org-export-latex-hyperref-format
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-export-latex-hyperref-format "\\ref{%s}")
|
||||
#+END_SRC
|
||||
|
||||
And Minted should be default break lines if a line is too long:
|
||||
#+name: org-export-latex-minted-options
|
||||
#+begin_src emacs-lisp
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(setq org-latex-minted-options '(("breaklines")
|
||||
("tabsize" "2")
|
||||
("frame" "single")
|
||||
@ -3247,7 +3269,7 @@ When it comes to the export itself, the latex file needs to be
|
||||
processed several times through XeLaTeX in order to get some
|
||||
references right. Don’t forget to also run bibtex!
|
||||
#+NAME: org-latex-pdf-process
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(setq org-latex-pdf-process
|
||||
'("xelatex -8bit -shell-escape -interaction nonstopmode -output-directory %o %f"
|
||||
"bibtex %b"
|
||||
@ -3258,7 +3280,8 @@ references right. Don’t forget to also run bibtex!
|
||||
Finally, org-mode is supposed to automatically clean logfiles after it
|
||||
exports an org file to LaTeX. However, it misses a few, so I need to
|
||||
add their extension like so:
|
||||
#+begin_src emacs-lisp
|
||||
#+name: org-latex-logfiles-add-extensions
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(dolist (ext '("bbl" "lot"))
|
||||
(add-to-list 'org-latex-logfiles-extensions ext t))
|
||||
#+end_src
|
||||
@ -3275,7 +3298,7 @@ there’s a package for exporting my org files to Github-flavored
|
||||
Markdown!
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ox-gfm
|
||||
:after ox
|
||||
:after (ox org)
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
@ -3288,7 +3311,7 @@ Yet another exporter I enjoy is [[https://github.com/dantecatalfamo/ox-ssh][~ox-
|
||||
servers on my repos though.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ox-ssh
|
||||
:after ox
|
||||
:after (ox org)
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
@ -3658,8 +3681,8 @@ The project is then defined like so:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-ref
|
||||
:after (org ox-bibtex pdf-tools)
|
||||
:straight (:build t)
|
||||
:after (org ox-bibtex)
|
||||
:demand t
|
||||
:custom-face
|
||||
(org-ref-cite-face ((t (:weight bold))))
|
||||
@ -3746,7 +3769,7 @@ org-mode. ~mixed-pitch~ comes to the rescue!
|
||||
#+begin_src emacs-lisp
|
||||
(use-package mixed-pitch
|
||||
:after org
|
||||
:straight t
|
||||
:straight (:build t)
|
||||
:hook
|
||||
(org-mode . mixed-pitch-mode)
|
||||
:config
|
||||
@ -3838,8 +3861,8 @@ icons!
|
||||
/Org Outline Tree/ is a better way of managing my org files’ outline.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-ol-tree
|
||||
:after (org avy)
|
||||
:defer t
|
||||
:after org
|
||||
:straight (org-ol-tree :build t
|
||||
:host github
|
||||
:type git
|
||||
@ -4195,7 +4218,7 @@ config]]), therefore I need a mode for it.
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-DSLs-Yamlsk26fl6184j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package yaml-mode
|
||||
(use-package yaml-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:mode "\\.yml\\'"
|
||||
@ -4215,7 +4238,7 @@ each one of them went their own way and learning C won’t make you a
|
||||
good C++ programmer, neither will the other way around. But, They are
|
||||
still somewhat related, and Emacs thinks so too.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package cc-mode
|
||||
(use-package cc-mode
|
||||
:straight (:type built-in)
|
||||
:defer t
|
||||
:init
|
||||
@ -4242,7 +4265,7 @@ still somewhat related, and Emacs thinks so too.
|
||||
Something that is also important when working with these languages is
|
||||
respecting the ~.clang-format~ file that may be provided by a project.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package clang-format+
|
||||
(use-package clang-format+
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init
|
||||
@ -4252,7 +4275,7 @@ respecting the ~.clang-format~ file that may be provided by a project.
|
||||
However, Emacs’ notion of C++ is somewhat outdated, so we need to
|
||||
update its fontlock.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package modern-cpp-font-lock
|
||||
(use-package modern-cpp-font-lock
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (c++-mode . modern-c++-font-lock-mode))
|
||||
@ -4263,12 +4286,12 @@ update its fontlock.
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-CommonLisp-gc2a7s31q5j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'lisp-mode-hook #'parinfer-rust-mode)
|
||||
(add-hook 'lisp-mode-hook (lambda () (smartparens-mode -1)))
|
||||
(add-hook 'lisp-mode-hook #'parinfer-rust-mode)
|
||||
(add-hook 'lisp-mode-hook (lambda () (smartparens-mode -1)))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package stumpwm-mode
|
||||
(use-package stumpwm-mode
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:config
|
||||
@ -4287,14 +4310,14 @@ update its fontlock.
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Dart-xkr3z8j0m6j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package dart-mode
|
||||
(use-package dart-mode
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:mode "\\.dart\\'")
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lsp-dart
|
||||
(use-package lsp-dart
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
#+end_src
|
||||
@ -4306,7 +4329,7 @@ update its fontlock.
|
||||
This package displays the function’s arglist or variable’s docstring
|
||||
in the echo area at the bottom of the frame. Quite useful indeed.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eldoc
|
||||
(use-package eldoc
|
||||
:defer t
|
||||
:after company
|
||||
:init
|
||||
@ -4317,13 +4340,13 @@ in the echo area at the bottom of the frame. Quite useful indeed.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'emacs-lisp-mode-hook (lambda () (smartparens-mode -1)))
|
||||
(add-hook 'emacs-lisp-mode-hook (lambda () (smartparens-mode -1)))
|
||||
#+end_src
|
||||
|
||||
Let’s also declare some Elisp-dedicated keybindings, prefixed by a
|
||||
comma.
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
(general-define-key
|
||||
:states 'motion
|
||||
:keymaps 'emacs-lisp-mode-map
|
||||
:prefix ","
|
||||
@ -4352,7 +4375,7 @@ comma.
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Lua-p2odc7p0t4j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lua-mode
|
||||
(use-package lua-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:mode "\\.lua$"
|
||||
@ -4375,7 +4398,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lsp-lua-emmy
|
||||
(use-package lsp-lua-emmy
|
||||
:defer t
|
||||
:after (lua-mode lsp-mode)
|
||||
:straight (lsp-lua-emmy :build t
|
||||
@ -4385,7 +4408,6 @@ comma.
|
||||
:hook (lua-mode . lsp-deferred)
|
||||
:config
|
||||
(setq lsp-lua-emmy-jar-path (expand-file-name "EmmyLua-LS-all.jar" user-emacs-directory)))
|
||||
|
||||
#+end_src
|
||||
|
||||
**** Python
|
||||
@ -4393,7 +4415,7 @@ comma.
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Python-7mwd2yq0z6j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package python
|
||||
(use-package python
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:mode (("SConstruct\\'" . python-mode)
|
||||
@ -4411,12 +4433,12 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
(after! org
|
||||
(add-to-list 'org-babel-load-languages '(python . t)))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pytest
|
||||
(use-package pytest
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:commands (pytest-one
|
||||
@ -4444,7 +4466,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package poetry
|
||||
(use-package poetry
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:commands (poetry-venv-toggle
|
||||
@ -4455,13 +4477,13 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pip-requirements
|
||||
(use-package pip-requirements
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pipenv
|
||||
(use-package pipenv
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:commands (pipenv-activate
|
||||
@ -4489,7 +4511,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pyenv
|
||||
(use-package pyenv
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:config
|
||||
@ -4500,7 +4522,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pyenv-mode
|
||||
(use-package pyenv-mode
|
||||
:defer t
|
||||
:after python
|
||||
:straight (:build t)
|
||||
@ -4516,7 +4538,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pippel
|
||||
(use-package pippel
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:init
|
||||
@ -4528,7 +4550,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package pyimport
|
||||
(use-package pyimport
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:config
|
||||
@ -4542,7 +4564,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package py-isort
|
||||
(use-package py-isort
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:config
|
||||
@ -4556,13 +4578,13 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package counsel-pydoc
|
||||
(use-package counsel-pydoc
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package sphinx-doc
|
||||
(use-package sphinx-doc
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:init
|
||||
@ -4577,7 +4599,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package cython-mode
|
||||
(use-package cython-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:mode "\\.p\\(yx\\|x[di]\\)\\'"
|
||||
@ -4592,14 +4614,14 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flycheck-cython
|
||||
(use-package flycheck-cython
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:after cython-mode)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package blacken
|
||||
(use-package blacken
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:init
|
||||
@ -4607,7 +4629,7 @@ comma.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lsp-pyright
|
||||
(use-package lsp-pyright
|
||||
:after lsp-mode
|
||||
:defer t
|
||||
:straight (:buidl t))
|
||||
@ -4622,7 +4644,7 @@ much more oriented towards safe code, and much better suited for web
|
||||
development. First, let’s install the most important package,
|
||||
~rustic~.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package rustic
|
||||
(use-package rustic
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:mode ("\\.rs$" . rustic-mode)
|
||||
@ -4672,13 +4694,13 @@ development. First, let’s install the most important package,
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Web-programming-7ca40po085j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package company-web
|
||||
(use-package company-web
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package emmet-mode
|
||||
(use-package emmet-mode
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook ((css-mode . emmet-mode)
|
||||
@ -4694,19 +4716,19 @@ development. First, let’s install the most important package,
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package impatient-mode
|
||||
(use-package impatient-mode
|
||||
:straight (:build t)
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package slim-mode
|
||||
(use-package slim-mode
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package web-mode
|
||||
(use-package web-mode
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:hook ((html-mode . web-mode))
|
||||
@ -4757,7 +4779,7 @@ development. First, let’s install the most important package,
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Web-programming-Javascript-8k5arup085j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package prettier-js
|
||||
(use-package prettier-js
|
||||
:defer t
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
@ -4767,9 +4789,9 @@ development. First, let’s install the most important package,
|
||||
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Web-programming-CSS-que40po085j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'css-mode-hook #'smartparens-mode)
|
||||
(put 'css-indent-offset 'safe-local-variable #'integerp)
|
||||
(after! css-mode
|
||||
(add-hook 'css-mode-hook #'smartparens-mode)
|
||||
(put 'css-indent-offset 'safe-local-variable #'integerp)
|
||||
(after! css-mode
|
||||
(general-define-key
|
||||
:keymaps '(css-mode-map)
|
||||
:states 'normal
|
||||
@ -4779,7 +4801,7 @@ development. First, let’s install the most important package,
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package scss-mode
|
||||
(use-package scss-mode
|
||||
:straight (:build t)
|
||||
:hook (scss-mode . smartparens-mode)
|
||||
:defer t
|
||||
@ -4787,7 +4809,7 @@ development. First, let’s install the most important package,
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package counsel-css
|
||||
(use-package counsel-css
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init
|
||||
@ -4810,7 +4832,7 @@ development. First, let’s install the most important package,
|
||||
:CUSTOM_ID: Packages-Configuration-Visual-Configuration-Dashboardnba6fl6184j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package dashboard
|
||||
(use-package dashboard
|
||||
:straight (:build t)
|
||||
:ensure t
|
||||
:after all-the-icons
|
||||
@ -4864,7 +4886,7 @@ development. First, let’s install the most important package,
|
||||
It’s nice to know which lines were modified since the last commit in a
|
||||
file.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package git-gutter-fringe
|
||||
(use-package git-gutter-fringe
|
||||
:straight (:build t)
|
||||
:hook ((prog-mode . git-gutter-mode)
|
||||
(org-mode . git-gutter-mode)
|
||||
@ -4877,7 +4899,7 @@ file.
|
||||
:CUSTOM_ID: Packages-Configuration-Visual-Configuration-Modelineavb6fl6184j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package doom-modeline
|
||||
(use-package doom-modeline
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (doom-modeline-mode 1)
|
||||
@ -4889,7 +4911,7 @@ file.
|
||||
:CUSTOM_ID: Packages-Configuration-Visual-Configuration-Themeded6fl6184j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package doom-themes
|
||||
(use-package doom-themes
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:init (load-theme 'doom-nord t))
|
||||
@ -4910,7 +4932,7 @@ configuration with ~all-the-icons~ is loaded on a machine, the needed
|
||||
fonts might not be available, so you’ll need to install them with the
|
||||
command ~M-x all-the-icons-install-fonts~.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package all-the-icons
|
||||
(use-package all-the-icons
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
@ -4918,14 +4940,14 @@ command ~M-x all-the-icons-install-fonts~.
|
||||
built-in! With that, I can replace strings of my choice by another
|
||||
character of my choice!
|
||||
#+begin_src emacs-lisp
|
||||
(dolist (symbol '(("lambda" . 955)
|
||||
(dolist (symbol '(("lambda" . 955)
|
||||
("mapc" . 8614)))
|
||||
(add-to-list 'prettify-symbols-alist symbol))
|
||||
#+end_src
|
||||
|
||||
Let’s enable this mode for any programming mode:
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'emacs-lisp-mode-hook #'prettify-symbols-mode)
|
||||
(add-hook 'emacs-lisp-mode-hook #'prettify-symbols-mode)
|
||||
#+end_src
|
||||
|
||||
*** Rainbow Delimiters
|
||||
@ -4933,7 +4955,7 @@ Let’s enable this mode for any programming mode:
|
||||
:CUSTOM_ID: Packages-Configuration-Visual-Configuration-Rainbow-Delimiters3lg6fl6184j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package rainbow-delimiters
|
||||
(use-package rainbow-delimiters
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
@ -4946,7 +4968,7 @@ Let’s enable this mode for any programming mode:
|
||||
It is possible to make info buffers much more colorful (and imo easier
|
||||
to read) with this simple package:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package info-colors
|
||||
(use-package info-colors
|
||||
:straight (:build t)
|
||||
:commands info-colors-fnontify-node
|
||||
:hook (Info-selection . info-colors-fontify-node)
|
||||
@ -4964,11 +4986,10 @@ to read) with this simple package:
|
||||
A small package I’ve written allows the user to view ArchLinux pages
|
||||
either in Emacs or in an external web browser. I prefer the defaults.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package archwiki
|
||||
(use-package archwiki
|
||||
:defer t
|
||||
:straight (archwiki :build t
|
||||
:type git
|
||||
:host nil
|
||||
:repo "https://labs.phundrak.com/phundrak/archwiki.el"))
|
||||
#+end_src
|
||||
|
||||
@ -4979,7 +5000,7 @@ either in Emacs or in an external web browser. I prefer the defaults.
|
||||
~avy~ is a really convenient way of jumping around, but I’ll need some
|
||||
configuration to make it bépo-compatible.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package avy
|
||||
(use-package avy
|
||||
:defer t
|
||||
:config
|
||||
(setq avy-keys '(?a ?u ?i ?e ?c ?t ?s ?r ?n))
|
||||
@ -4994,7 +5015,7 @@ configuration to make it bépo-compatible.
|
||||
:END:
|
||||
Let’s give ~calc-mode~ some better defaults.
|
||||
#+begin_src emacs-lisp
|
||||
(setq calc-angle-mode 'rad
|
||||
(setq calc-angle-mode 'rad
|
||||
calc-symbolic-mode t)
|
||||
#+end_src
|
||||
|
||||
@ -5004,7 +5025,7 @@ Let’s give ~calc-mode~ some better defaults.
|
||||
:END:
|
||||
What’s the point of using Emacs if you can’t tell everyone?
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elcord
|
||||
(use-package elcord
|
||||
:straight (:built t)
|
||||
:defer t
|
||||
:config
|
||||
@ -5020,7 +5041,7 @@ What’s the point of using Emacs if you can’t tell everyone?
|
||||
This package is a small utility package I’ve written in order to
|
||||
quickly find files across my filesystem.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ivy-quick-find-files
|
||||
(use-package ivy-quick-find-files
|
||||
:defer t
|
||||
:straight (ivy-quick-find-files :type git
|
||||
:host github
|
||||
@ -5038,7 +5059,7 @@ quickly find files across my filesystem.
|
||||
:CUSTOM_ID: Packages-Configuration-Misc-Keycast-nsqgl431t4j0
|
||||
:END:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package keycast
|
||||
(use-package keycast
|
||||
:config
|
||||
(define-minor-mode keycast-mode
|
||||
"Show current command and its key binding in the mode line."
|
||||
@ -5056,7 +5077,7 @@ quickly find files across my filesystem.
|
||||
Who would get interested in Emacs and not want to read the SICP?
|
||||
Moreover, inside Emacs?
|
||||
#+begin_src emacs-lisp
|
||||
(use-package sicp
|
||||
(use-package sicp
|
||||
:defer t)
|
||||
#+end_src
|
||||
|
||||
@ -5069,7 +5090,7 @@ navigate through these windows by directly refering to their
|
||||
associated number! This allows for faster window configuration than
|
||||
just going to the frame above, then left, left, and up.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package winum
|
||||
(use-package winum
|
||||
:straight (:build t)
|
||||
:init (winum-mode))
|
||||
#+end_src
|
||||
@ -5081,11 +5102,10 @@ just going to the frame above, then left, left, and up.
|
||||
~ytplay~ is a small package I’ve written with which you can choose at
|
||||
which resolution to play a YouTube video in an external video player.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ytplay
|
||||
(use-package ytplay
|
||||
:defer t
|
||||
:straight (ytplay :build t
|
||||
:type git
|
||||
:host nil
|
||||
:repo "https://labs.phundrak.com/phundrak/ytplay.el"))
|
||||
#+end_src
|
||||
|
||||
@ -5096,7 +5116,8 @@ which resolution to play a YouTube video in an external video player.
|
||||
Undefining some stuff to make keybind prefixes work correctly.
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
:keymaps '( Buffer-menu-mode-map
|
||||
:keymaps '(Buffer-menu-mode-map
|
||||
Info-mode-map
|
||||
Man-mode-map
|
||||
backtrace-mode-map
|
||||
custom-mode-map
|
||||
@ -5117,7 +5138,8 @@ Undefining some stuff to make keybind prefixes work correctly.
|
||||
splash-screen-keymap
|
||||
undo-tree-visualizer-mode-map)
|
||||
:states '(emacs normal motion)
|
||||
"SPC" nil)
|
||||
"SPC" nil
|
||||
"," nil)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'global-map
|
||||
@ -5146,7 +5168,7 @@ Undefining some stuff to make keybind prefixes work correctly.
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(general-define-key
|
||||
(general-define-key
|
||||
:states 'normal
|
||||
:prefix "SPC"
|
||||
"SPC" '(counsel-M-x :wk "M-x")
|
||||
|
Loading…
Reference in New Issue
Block a user