(Emacs)~changed a lot of stuff

+org-ref
+xref config
~descriptions
This commit is contained in:
2022-10-11 10:28:50 +01:00
parent 7aaf2f7ac6
commit 04b861e430

View File

@@ -426,17 +426,17 @@ keymap because it uses 'gr' as its prefix, which I don't like.
"s" #'evil-mc-pause-cursors "s" #'evil-mc-pause-cursors
"u" #'evil-mc-undo-last-added-cursor) "u" #'evil-mc-undo-last-added-cursor)
:config :config
(evil-mc-define-vars) ;; (evil-mc-define-vars)
(evil-mc-initialize-vars) ;; (evil-mc-initialize-vars)
(add-hook 'evil-mc-before-cursors-created #'evil-mc-pause-incompatible-modes) ;; (add-hook 'evil-mc-before-cursors-created #'evil-mc-pause-incompatible-modes)
(add-hook 'evil-mc-before-cursors-created #'evil-mc-initialize-active-state) ;; (add-hook 'evil-mc-before-cursors-created #'evil-mc-initialize-active-state)
(add-hook 'evil-mc-after-cursors-deleted #'evil-mc-teardown-active-state) ;; (add-hook 'evil-mc-after-cursors-deleted #'evil-mc-teardown-active-state)
(add-hook 'evil-mc-after-cursors-deleted #'evil-mc-resume-incompatible-modes) ;; (add-hook 'evil-mc-after-cursors-deleted #'evil-mc-resume-incompatible-modes)
(advice-add #'evil-mc-initialize-hooks :override #'ignore) ;; (advice-add #'evil-mc-initialize-hooks :override #'ignore)
(advice-add #'evil-mc-teardown-hooks :override #'evil-mc-initialize-vars) ;; (advice-add #'evil-mc-teardown-hooks :override #'evil-mc-initialize-vars)
(advice-add #'evil-mc-initialize-active-state :before #'turn-on-evil-mc-mode) ;; (advice-add #'evil-mc-initialize-active-state :before #'turn-on-evil-mc-mode)
(advice-add #'evil-mc-teardown-active-state :after #'turn-off-evil-mc-mode) ;; (advice-add #'evil-mc-teardown-active-state :after #'turn-off-evil-mc-mode)
(add-hook 'evil-insert-state-entry-hook #'evil-mc-resume-cursors) ;; (add-hook 'evil-insert-state-entry-hook #'evil-mc-resume-cursors)
(global-evil-mc-mode)) (global-evil-mc-mode))
#+end_src #+end_src
@@ -1177,6 +1177,33 @@ it's useful for presentations.
:init :init
(setq-default display-line-numbers-type 'relative)) (setq-default display-line-numbers-type 'relative))
#+end_src #+end_src
** xref
Find definitions, references using tags for free! Such an underrated
utility, particularly now that I'm not using Eglot (in some sense,
returning to the nature of Emacs). All you need is a way of
generating tags, probably a make recipe.
#+begin_src emacs-lisp
(use-package xref
:straight nil
:display
("\\*xref\\*"
(display-buffer-at-bottom)
(inhibit-duplicate-buffer . t)
(window-height . 0.25))
:general
(leader
:infix "ct"
"t" #'xref-find-apropos
"d" #'xref-find-definitions
"r" #'xref-find-references)
(nmmap
:keymaps 'xref--xref-buffer-mode-map
"RET" #'xref-goto-xref
"J" #'xref-next-line
"K" #'xref-prev-line
"g" #'xref-revert-buffer
"q" #'quit-window))
#+end_src
** Hl-line ** Hl-line
Hl-line is a useful tool, best line indicator in the game. Hl-line is a useful tool, best line indicator in the game.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@@ -1192,8 +1219,7 @@ Recentf makes it easy to
:hook (emacs-startup-hook . recentf-mode)) :hook (emacs-startup-hook . recentf-mode))
#+end_src #+end_src
** Projectile ** Projectile
Setup projectile, along with the tags command. Also bind "C-c C-p" to Setup projectile, along with the tags command.
the projectile command map for quick access.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package projectile (use-package projectile
:after evil :after evil
@@ -1201,7 +1227,7 @@ the projectile command map for quick access.
:general :general
(leader "p" #'projectile-command-map) (leader "p" #'projectile-command-map)
:init :init
(setq projectile-tags-command "ctags -R -f \"%s\" %s \"%s\"")) (setq projectile-tags-command "ctags -Re -f \"%s\" %s \"%s\""))
#+end_src #+end_src
*** Counsel projectile *** Counsel projectile
Counsel projectile provides the ivy interface to projectile commands, Counsel projectile provides the ivy interface to projectile commands,
@@ -1313,6 +1339,7 @@ most repositories nowadays.
(use-package grep (use-package grep
:display :display
("grep\\*" ("grep\\*"
(display-buffer-reuse-window)
(display-buffer-at-bottom) (display-buffer-at-bottom)
(window-height . 0.25)) (window-height . 0.25))
:straight nil :straight nil
@@ -1752,11 +1779,11 @@ a git repo in the current directory and provides some extra
information in that case (in particular, branch name and if there any information in that case (in particular, branch name and if there any
changes that haven't been committed). changes that haven't been committed).
Also ~eshell/goto~, which is actually a command accessible from within Also add ~eshell/goto~, which is actually a command accessible from
eshell (this is because ~eshell/*~ creates an accessible function within eshell (this is because ~eshell/*~ creates an accessible
within eshell with name ~*~). ~eshell/goto~ makes it easier to change function within eshell with name ~*~). ~eshell/goto~ makes it easier
directories by using Emacs to provide an interface (which is a faster to change directories by using Emacs to provide an interface (which is
loop than ~cd ..; ls -l~). much faster than ~cd ..; ls -l~).
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eshell (use-package eshell
:config :config
@@ -1766,12 +1793,13 @@ loop than ~cd ..; ls -l~).
(if (not is-repo) (if (not is-repo)
"" ""
(concat (concat
"("
(nth 2 (split-string git-branch "\n\\|\\*\\| ")) (nth 2 (split-string git-branch "\n\\|\\*\\| "))
"<" "<"
(if (string= "" (shell-command-to-string "git status | grep 'up to date'")) (if (string= "" (shell-command-to-string "git status | grep 'up to date'"))
"×" "×"
"") "")
">")))) ">)"))))
(setq eshell-cmpl-ignore-case t (setq eshell-cmpl-ignore-case t
eshell-cd-on-directory t eshell-cd-on-directory t
eshell-banner-message (concat (shell-command-to-string "figlet eshell") "\n") eshell-banner-message (concat (shell-command-to-string "figlet eshell") "\n")
@@ -1779,9 +1807,7 @@ loop than ~cd ..; ls -l~).
(proc (proc
(let ((properties (+eshell/get-git-properties))) (let ((properties (+eshell/get-git-properties)))
(concat (concat
"("
properties properties
")"
(format "[%s]\n" (abbreviate-file-name (eshell/pwd))) (format "[%s]\n" (abbreviate-file-name (eshell/pwd)))
"λ "))) "λ ")))
eshell-prompt-regexp "") eshell-prompt-regexp "")
@@ -1864,7 +1890,7 @@ to elfeed for loading the system.
#+end_src #+end_src
** Magit ** Magit
Magit is *the* git porcelain for Emacs, which perfectly encapsulates Magit is *the* git porcelain for Emacs, which perfectly encapsulates
the git cli. In this case, I just need to setup the bindings for it. the git cli. In this case I just need to setup the bindings for it.
As magit will definitely load after evil (as it must be run by a As magit will definitely load after evil (as it must be run by a
binding, and evil will load after init), I can use evil-collection binding, and evil will load after init), I can use evil-collection
freely. Also, define an auto insert for commit messages so that I freely. Also, define an auto insert for commit messages so that I
@@ -1872,6 +1898,7 @@ don't need to write everything myself.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package magit (use-package magit
:defer t
:display :display
("magit:.*" ("magit:.*"
(display-buffer-same-window) (display-buffer-same-window)
@@ -2136,10 +2163,6 @@ results to the client, done through JSON.
(use-package eglot (use-package eglot
:after project :after project
:defer t :defer t
:hook
(c++-mode-hook . eglot-ensure)
(c-mode-hook . eglot-ensure)
(python-mode-hook . eglot-ensure)
:general :general
(leader (leader
:keymaps 'eglot-mode-map :keymaps 'eglot-mode-map
@@ -2223,7 +2246,9 @@ highlighting.
:init :init
(setq hl-todo-keyword-faces (setq hl-todo-keyword-faces
'(("TODO" . "#E50000") '(("TODO" . "#E50000")
("WAIT" . "#00CC00")))) ("WAIT" . "#00CC00")
("FIXME" . "#d02090")))
)
#+end_src #+end_src
** Hide-show mode ** Hide-show mode
Turn on ~hs-minor-mode~ for all prog-mode. Turn on ~hs-minor-mode~ for all prog-mode.
@@ -2338,6 +2363,7 @@ Emacs was very helpful here.
(sequence "PROJ" "WAIT" "COMPLETE"))) (sequence "PROJ" "WAIT" "COMPLETE")))
(org-use-sub-superscripts '{}) (org-use-sub-superscripts '{})
(org-babel-load-languages '((emacs-lisp . t) (org-babel-load-languages '((emacs-lisp . t)
(lisp . t)
(C . t) (C . t)
(python . t) (python . t)
(shell . t))) (shell . t)))
@@ -2353,9 +2379,7 @@ Emacs was very helpful here.
(caml "ocaml"))) (caml "ocaml")))
(org-latex-packages-alist '(("" "minted"))) (org-latex-packages-alist '(("" "minted")))
(org-latex-pdf-process (org-latex-pdf-process
'("%latex -interaction nonstopmode -shell-escape -output-directory %o %f" '("latexmk -pdf -bibtex -f -shell-escape %f"))
"%latex -interaction nonstopmode -shell-escape -output-directory %o %f"
"%latex -interaction nonstopmode -shell-escape -output-directory %o %f"))
(org-latex-minted-options '(("style" "xcode") (org-latex-minted-options '(("style" "xcode")
("linenos") ("linenos")
("frame" "single") ("frame" "single")
@@ -2385,7 +2409,8 @@ Hooks, prettify-symbols and records for auto insertion.
'("Enter title: " '("Enter title: "
"#+title: " str | (buffer-file-name) "\n" "#+title: " str | (buffer-file-name) "\n"
"#+author: " (read-string "Enter author: ") | user-full-name "\n" "#+author: " (read-string "Enter author: ") | user-full-name "\n"
"#+description: " (read-string "Enter description: ") | "Description" "\n\n" "#+description: " (read-string "Enter description: ") | "Description" "\n"
"#+date: " (format-time-string "%Y-%m-%d" (current-time)) "\n"
"* " _)))) "* " _))))
#+end_src #+end_src
*** Org Core Bindings *** Org Core Bindings
@@ -2399,7 +2424,8 @@ Some bindings for org mode.
(swiper "^\\* ")) (swiper "^\\* "))
:general :general
(leader (leader
"fw" #'org-capture) "fw" #'org-capture
"fl" #'org-store-link)
(nmmap (nmmap
:keymaps 'org-mode-map :keymaps 'org-mode-map
[remap imenu] #'+org/swiper-goto) [remap imenu] #'+org/swiper-goto)
@@ -2425,17 +2451,20 @@ a very tidy way to manage your time.
:after (org evil) :after (org evil)
:straight nil :straight nil
:init :init
(setq org-agenda-files (list (expand-file-name "~/Text") (expand-file-name "~/Text/Notes")) (defconst +org/agenda-root "~/Text"
"Root directory for all agenda files")
(setq org-agenda-files (list (expand-file-name +org/agenda-root) (expand-file-name (concat +org/agenda-root "/Notes")) (expand-file-name "~/Projects/lpv/"))
org-agenda-window-setup 'current-window org-agenda-window-setup 'current-window
org-agenda-skip-deadline-prewarning-if-scheduled t) org-agenda-skip-deadline-prewarning-if-scheduled t)
:config :config
(evil-set-initial-state 'org-agenda-mode 'normal) (evil-set-initial-state 'org-agenda-mode 'normal)
:general :general
(leader (leader
"fa" (proc (interactive) (find-file (car org-agenda-files))) "fa" (proc (interactive) (find-file (completing-read "Enter directory: " org-agenda-files nil t)))
"aa" #'org-agenda) "aa" #'org-agenda)
(nmmap (nmmap
:keymaps 'org-agenda-mode-map :keymaps 'org-agenda-mode-map
"RET" #'org-agenda-switch-to
"J" #'org-agenda-later "J" #'org-agenda-later
"K" #'org-agenda-earlier "K" #'org-agenda-earlier
"t" #'org-agenda-todo "t" #'org-agenda-todo
@@ -2499,6 +2528,16 @@ crash (like the async handler for org-export). Works really well with
(start-process-shell-command "" "*pdflatex*" (concat "pdflatex -shell-escape " (start-process-shell-command "" "*pdflatex*" (concat "pdflatex -shell-escape "
(org-latex-export-to-latex))))) (org-latex-export-to-latex)))))
#+end_src #+end_src
*** Org ref
#+begin_src emacs-lisp
(use-package org-ref
:straight t
:after org
:init
(setq bibtex-files '("~/Text/bibliography.bib")
bibtex-completion-bibliography '("~/Text/bibliography.bib")
bibtex-completion-additional-search-fields '(keywords)))
#+end_src
*** Org message *** Org message
Org message allows for the use of org mode when composing mails, Org message allows for the use of org mode when composing mails,
generating HTML multipart emails. This integrates the WYSIWYG generating HTML multipart emails. This integrates the WYSIWYG