(Emacs)~lots of changes to config

+ save place
+ global auto revert
- +pretty/* functions
+ esup
+ some randomised messages for dashboard footer
+ some eshell functionality
~ disabled ada mode
+ tons of bindings for org tables
This commit is contained in:
2023-03-19 17:56:10 +00:00
parent b0523a50c7
commit 8637222e5f

View File

@@ -48,12 +48,19 @@ custom-file to exist in the var-directory
:straight nil :straight nil
:init :init
(setq backup-directory-alist `(("." . ,(no-littering-expand-var-file-name "saves/"))) (setq backup-directory-alist `(("." . ,(no-littering-expand-var-file-name "saves/")))
global-auto-revert-non-file-buffers nil global-auto-revert-non-file-buffers t
auto-revert-verbose nil) auto-revert-verbose nil)
(setq custom-file (no-littering-expand-etc-file-name "custom.el")) (setq custom-file (no-littering-expand-etc-file-name "custom.el"))
:config :config
(global-auto-revert-mode 1)) (global-auto-revert-mode 1))
#+end_src #+end_src
** Save place
#+begin_src emacs-lisp
(use-package saveplace
:straight nil
:config
(save-place-mode))
#+end_src
* Custom Functions * Custom Functions
Functions that don't require a packages to work other than Emacs, Functions that don't require a packages to work other than Emacs,
which means I can define them early and use them later. which means I can define them early and use them later.
@@ -88,37 +95,33 @@ BUF-NAME cannot be a regexp, it must be a fixed name."
(let* ((buffer (or (get-buffer ,buffer-name) (let* ((buffer (or (get-buffer ,buffer-name)
,buffer-create)) ,buffer-create))
(displayed (get-buffer-window buffer))) (displayed (get-buffer-window buffer)))
(cond (displayed (if displayed
(select-window displayed) (delete-window display)
(delete-window))
(t
(display-buffer buffer) (display-buffer buffer)
(select-window (get-buffer-window buffer))))))))) (select-window (get-buffer-window buffer))))))))
#+end_src #+end_src
** Auto-run command after-save-hook ** Auto-run command after-save-hook
Define a macro that can run a body of functionality on a given set of Define a macro, which creates hooks into the ~after-save-hook~. On
files on after-save-hook. certain ~conditions~ (defined by user) being met, ~to-run~ is
evaluated as code.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package simple (use-package simple
:straight nil :straight nil
:config :config
(defmacro +oreo/create-auto-save (func-name conditions &rest to-run) (defmacro +oreo/create-auto-save (conditions &rest to-run)
"Create a hook function with name FUNC-NAME such that when the "Create a hook for after saves, where (on CONDITIONS being met)
set of predicates CONDITIONS is satisfied evaluate TO-RUN after a TO-RUN is evaluated. "
save." `(add-hook 'after-save-hook #'(lambda ()
`(progn
(defun ,func-name ()
(interactive) (interactive)
(when ,conditions (when ,conditions
,@to-run)) ,@to-run)))))
(add-hook 'after-save-hook (quote ,func-name)))))
#+end_src #+end_src
** Procedure ** Procedure
The ~lambda~ macro provides a function with possible arguments. A The ~lambda~ macro provides a function with possible arguments. A
procedure is a type of form that takes no arguments. This macro procedure is a type of callable that takes no arguments. This macro
returns an anonymous function with no arguments with all the forms returns an anonymous function, which takes no arguments, with the
provided. It returns it in 'backquoted' form as that is the most parameters of the macro being the body of the procedure. It returns
common use of this macro. it in quoted form as that is the most common use of this macro.
(You may notice ~proc~ is used where the return value doesn't matter). (You may notice ~proc~ is used where the return value doesn't matter).
#+begin_src emacs-lisp #+begin_src emacs-lisp
@@ -129,24 +132,26 @@ lambda."
#+end_src #+end_src
** sys-name-cond ** sys-name-cond
A macro that acts as a switch case on ~(system-name)~ which allows A macro that acts as a switch case on ~(system-name)~ which allows
user to write machine specific code. For me this is for my desktop, user to write machine specific code. For me this is for my desktop
laptop and any other machines that may require specific configuration. and laptop, particularly for font sizes. Basically a cond constructor
specifically for testing system names. In fact there may be an easier
solution than this.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defmacro +oreo/sys-name-cond (&rest pairs) (defmacro +oreo/sys-name-cond (&rest pairs)
"Switch case on result of function `system-name'. "Switch case on result of function `system-name'.
Each pair in PAIRS is typed as: Each pair in PAIRS is typed as: (string . (forms...)) where the
- (car pair) => string of system name to test. string represents the system name to test, and forms being the
- (cdr pair) => forms to evaluate." consequence if true."
(let ((current-lisp)) (let ((current-lisp))
(while pairs (while pairs
(let* ((pair (car pairs)) (let ((pair (car pairs)))
(name (car pair)) (let ((name (car pair))
(body (cdr pair))) (body (cdr pair)))
(add-to-list (add-to-list
'current-lisp 'current-lisp
`((string= ,name (system-name)) ,@body)) `((string= ,name (system-name)) ,@body))
(setq pairs (cdr pairs)))) (setq pairs (cdr pairs)))))
`(cond `(cond
,@current-lisp))) ,@current-lisp)))
#+end_src #+end_src
@@ -183,7 +188,6 @@ any buffers in ~+oreo/keep-buffer~ and kills the rest.
(if (not (member (buffer-name buf) +oreo/keep-buffers)) (if (not (member (buffer-name buf) +oreo/keep-buffers))
(kill-buffer buf))) (kill-buffer buf)))
(buffer-list))) (buffer-list)))
#+end_src #+end_src
* Aesthetics * Aesthetics
Load my custom "personal-primary" theme which is stored in the Emacs Load my custom "personal-primary" theme which is stored in the Emacs
@@ -232,8 +236,8 @@ which does a better job of indicating where the cursor is on screen.
(blink-cursor-mode 0)) (blink-cursor-mode 0))
#+end_src #+end_src
After turning off borders in my window manager, I tried turning off Turning off borders in my window manager was a good idea, so turn off
the borders for Emacs. Incredible, must be done. the borders for Emacs.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package fringe (use-package fringe
:after dashboard :after dashboard
@@ -246,12 +250,12 @@ the borders for Emacs. Incredible, must be done.
#+end_src #+end_src
* Core packages * Core packages
** General ** General
Setup general, a good package for defining keys. In this case, I A good package for defining keys. In this case, I generate a new
generate a new definer for the "LEADER" keys. Leader is bound to definer for the "LEADER" keys. Leader is bound to ~SPC~ and it's
~SPC~ and it's functionally equivalent to the doom/spacemacs leader. functionally equivalent to the doom/spacemacs leader. Local leader is
Local leader is bound to ~SPC ,~ and it's similar to doom/spacemacs bound to ~SPC ,~ and it's similar to doom/spacemacs leader but doesn't
leader but doesn't try to fully assimilate the local-leader map try to fully assimilate the local-leader map, instead just picking
instead just picking stuff I think is useful. stuff I think is useful.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package general (use-package general
:demand t :demand t
@@ -277,17 +281,8 @@ instead just picking stuff I think is useful.
(general-evil-setup t)) (general-evil-setup t))
#+end_src #+end_src
Add bindings for ~+literate/~ namespace, allows for quick reloads.
#+begin_src emacs-lisp
(use-package general
:general
(leader
:infix "q"
"c" #'+literate/compile-config
"l" #'+literate/load-config
"d" #'delete-frame))
#+end_src
*** Some default binds in Emacs *** Some default binds in Emacs
Bindings for core functionality
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package emacs (use-package emacs
:straight nil :straight nil
@@ -309,7 +304,6 @@ Add bindings for ~+literate/~ namespace, allows for quick reloads.
";" #'eval-expression ";" #'eval-expression
":" (proc (interactive) (switch-to-buffer "*scratch*")) ":" (proc (interactive) (switch-to-buffer "*scratch*"))
"!" #'async-shell-command "!" #'async-shell-command
"qq" #'save-buffers-kill-terminal
"cF" (proc (interactive) (find-file "~/Code/"))) "cF" (proc (interactive) (find-file "~/Code/")))
(leader (leader
@@ -326,6 +320,12 @@ Add bindings for ~+literate/~ namespace, allows for quick reloads.
"c" #'compile "c" #'compile
"C" #'recompile) "C" #'recompile)
(leader
:infix "q"
"q" #'save-buffers-kill-terminal
"c" #'+literate/compile-config
"l" #'+literate/load-config
"d" #'delete-frame)
(leader (leader
"si" #'imenu) "si" #'imenu)
@@ -341,7 +341,7 @@ Emacs. Packaged with it by default are:
This provides a lot of stuff for the average vim user moving to Emacs. This provides a lot of stuff for the average vim user moving to Emacs.
However there are many other packages surrounding evil that port even However there are many other packages surrounding evil that port even
greater functionality from vi to Emacs. Surround, commenting, greater functionality from vim to Emacs. Surround, commenting,
multiple cursors and further support to other packages are configured multiple cursors and further support to other packages are configured
here. here.
*** Evil core *** Evil core
@@ -445,24 +445,20 @@ Setup evil collection, but don't turn on the mode. Instead, I'll turn
on setups for specific modes I think benefit from it. on setups for specific modes I think benefit from it.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package evil-collection (use-package evil-collection
:after evil :after evil)
:config
(evil-collection-require 'dired))
#+end_src #+end_src
** Completion ** Completion
Emacs is a text based interface. As a text based interface it heavily Emacs is a text based interface. Though the standard model of
leverages searches and user filters to manage input and provide completion may be desirable to some it can be modernised through the
functionality. Though the standard model of completion may be use of 'completion frameworks'.
desirable to some, it can be advanced through the use of 'completion
frameworks'.
These frameworks handle the input from the user for common commands These frameworks handle input and present output from the user for
and provide a differing interface to the one Emacs comes with. Most common commands, providing a differing interface to the one Emacs
of these completion frameworks provide a text based menu that is comes with. Most of these completion frameworks provide a text based
actively filtered as more input is provided (progressive input menu that is actively filtered as more input is provided (progressive
filtering). Along with these frameworks come added functionality and input filtering). Along with these frameworks come added
applications to integrate into the Emacs environment further. functionality and applications to integrate into the Emacs environment
further.
One may say that when using a completion framework there is no point One may say that when using a completion framework there is no point
in using any other framework as they encompasses so much of the in using any other framework as they encompasses so much of the
@@ -634,6 +630,9 @@ helpful counterparts.
(counsel-mode)) (counsel-mode))
#+end_src #+end_src
**** Ivy posframe **** Ivy posframe
:PROPERTIES:
:header-args:emacs-lisp: :tangle no
:END:
This makes ivy minibuffer windows use child frames. Very nice eyecandy. This makes ivy minibuffer windows use child frames. Very nice eyecandy.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package ivy-posframe (use-package ivy-posframe
@@ -685,18 +684,20 @@ Prettify symbols mode allows for users to declare 'symbols' that
replace text within certain modes. For example, you may replace the replace text within certain modes. For example, you may replace the
'for' word in c-mode for [[https://en.wikipedia.org/wiki/Universal_quantification][universal quantification]]. Though this may 'for' word in c-mode for [[https://en.wikipedia.org/wiki/Universal_quantification][universal quantification]]. Though this may
seem like useless eye candy, it has aided my comprehension and speed seem like useless eye candy, it has aided my comprehension and speed
of recognition (recognising symbols is easier than words for many, of recognition (recognising symbols is easier than words).
including me).
Now here I provide a macro +pretty/set-alist. This macro works pretty Here I provide a macro +pretty/set-alist. This macro works pretty
simply: given a mode hook, as well as a list of pairs typed (text to simply: given a mode hook, as well as a list of pairs typed (text to
substitute, symbol to replace with). Then I add a hook to the given substitute, symbol to replace with). Then I add a hook to the given
mode, setting the prettify-symbols-alist to the symbols given. mode, setting the prettify-symbols-alist to the symbols given.
I've declared it pretty high up into my config so that the rest of my I've declared it high up into my config so that the rest of my
packages can leverage it. Furthermore I've added a use-package packages can leverage it. Furthermore I've added a use-package
keyword which makes declaring this for language modes incredibly keyword which makes declaring this for language modes incredibly easy.
easy. Checkout my [[C/C++][C/C++]] configuration for an example. Checkout my [[C/C++][C/C++]] configuration for an example.
2023-03-08: I've removed the +pretty/set-alist macro and corresponding
function as the use-package declaration is really enough.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package prog-mode (use-package prog-mode
:straight nil :straight nil
@@ -712,30 +713,19 @@ easy. Checkout my [[C/C++][C/C++]] configuration for an example.
(use-package-concat (use-package-concat
(use-package-process-keywords name rest state) (use-package-process-keywords name rest state)
(let ((arg args) (let ((arg args)
forms) (forms nil))
(while arg (while arg
(let* ((carg (car arg)) (let ((mode (caar arg))
(mode (car carg)) (rest (cdr (car arg))))
(rest (cdr carg)))
(add-to-list (add-to-list
'forms 'forms
`(add-hook `(add-hook
',mode ',mode
(lambda () (lambda nil
(setq prettify-symbols-alist ',rest) (setq prettify-symbols-alist ',rest)
(prettify-symbols-mode))))) (prettify-symbols-mode)))))
(setq arg (cdr arg))) (setq arg (cdr arg)))
forms)))) forms)))))
(defmacro +pretty/set-alist (mode &rest symbols)
`(add-hook
',mode
(lambda ()
(setq prettify-symbols-alist ',symbols)
(prettify-symbols-mode))))
(defun +pretty/set-alist-f (mode symbols)
`(+pretty/set-alist mode ,@symbols)))
#+end_src #+end_src
Here's a collection of symbols I have currently that may be used Here's a collection of symbols I have currently that may be used
@@ -766,6 +756,7 @@ adaptable in Emacs, this behavior is no different.
Here I create a use-package extension that manages the whole ordeal of Here I create a use-package extension that manages the whole ordeal of
adding a new record to the display-buffer-alist, a useful abstraction adding a new record to the display-buffer-alist, a useful abstraction
that makes it easy to manage the various buffers created by packages. that makes it easy to manage the various buffers created by packages.
I also provide bindings for buffer management.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package window (use-package window
:straight nil :straight nil
@@ -1177,6 +1168,17 @@ 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
** esup (profiling)
I used to be able to just use [[file:elisp/profiler-dotemacs.el][profile-dotemacs.el]], when my Emacs
config was smaller, but now it tells me very little information about
where my setup is inefficient. Just found this ~esup~ thing and it
works perfectly, exactly how I would prefer getting this kind of
information.
#+begin_src emacs-lisp
(use-package esup
:defer t)
#+end_src
** xref ** xref
Find definitions, references using tags for free! Such an underrated Find definitions, references using tags for free! Such an underrated
utility, particularly now that I'm not using Eglot (in some sense, utility, particularly now that I'm not using Eglot (in some sense,
@@ -1377,7 +1379,6 @@ Nice set of icons with a great user interface to manage them.
:general :general
(leader (leader
"ie" #'all-the-icons-insert)) "ie" #'all-the-icons-insert))
#+end_src #+end_src
* Applications * Applications
** Dashboard ** Dashboard
@@ -1408,7 +1409,16 @@ initial startup screen in default Emacs.
dashboard-set-footer t dashboard-set-footer t
dashboard-set-navigator t dashboard-set-navigator t
dashboard-items '((projects . 5) dashboard-items '((projects . 5)
(recents . 5))) (recents . 5))
dashboard-footer-messages (list
"Collecting parentheses..."
"Linking 'coffee_machine.o'..."
"Uploading ip to hacker named 4chan..."
"Dividing by zero..."
"Solving 3-sat..."
"Obtaining your health record..."
(format "Recompiling Emacs for the %dth time..." (random 1000))
"Escaping the cycle of samsara..."))
:config :config
(dashboard-setup-startup-hook)) (dashboard-setup-startup-hook))
#+end_src #+end_src
@@ -1535,22 +1545,16 @@ for dired (even though dired doesn't really conflict with evil, there
are some corners I'd like to adjust). are some corners I'd like to adjust).
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package dired (use-package dired
:defer t
:straight nil :straight nil
:commands (dired find-dired) :commands (dired find-dired)
:hook
(dired-mode-hook . auto-revert-mode)
(dired-mode-hook . dired-hide-details-mode)
:init :init
(setq-default dired-listing-switches "-AFBl --group-directories-first" (setq-default dired-listing-switches "-AFBl --group-directories-first"
dired-omit-files "^\\.") dired-omit-files "^\\.")
(defvar +dired/omit-mode nil) (with-eval-after-load "evil-collection"
(defun +dired/omit-dot-files () (evil-collection-dired-setup))
(interactive)
(setq-local +dired/omit-mode (not +dired/omit-mode))
(dired-omit-mode (if +dired/omit-mode 1 -1))
(revert-buffer))
:hook
(dired-mode-hook . dired-hide-details-mode)
(dired-mode-hook . auto-revert-mode)
(dired-hide-details-mode-hook . +dired/omit-dot-files)
:general :general
(nmmap (nmmap
:keymaps 'dired-mode-map :keymaps 'dired-mode-map
@@ -1563,9 +1567,6 @@ are some corners I'd like to adjust).
"D" #'dired-other-frame "D" #'dired-other-frame
"l" (proc (interactive) (find-dired "~/Text/PDFs/" "-iname 'cs[0-9][0-9][0-9].pdf' -or -iname 'ma[0-9][0-9][0-9]*.pdf'"))) "l" (proc (interactive) (find-dired "~/Text/PDFs/" "-iname 'cs[0-9][0-9][0-9].pdf' -or -iname 'ma[0-9][0-9][0-9]*.pdf'")))
:config :config
(with-eval-after-load "evil-collection"
(evil-collection-dired-setup))
(defun +dired/insert-all-subdirectories () (defun +dired/insert-all-subdirectories ()
"Insert all subdirectories currently viewable." "Insert all subdirectories currently viewable."
(interactive) (interactive)
@@ -1598,17 +1599,18 @@ Uses fd for finding file results in a directory: ~find-dired~ ->
"dF" #'fd-dired)) "dF" #'fd-dired))
#+end_src #+end_src
** Xwidget ** Xwidget
Xwidget is a package (must be compiled at source) which allows for the Xwidget is a package which allows for the insertion of arbitrary
insertion of arbitrary xwidgets into Emacs through buffers. One of its xwidgets into Emacs through buffers. It must be compiled into Emacs
premier uses is in navigating the web which it provides through the so you might need to customise your install. One of its premier uses
function ~xwidget-webkit-browse-url~. This renders a fully functional is in navigating the web which it provides through the function
web browser within Emacs. ~xwidget-webkit-browse-url~. This renders a fully functional web
browser within Emacs.
Though I am not to keen on using Emacs to browse the web /via/ xwidget Though I am not to keen on using Emacs to browse the web /via/ xwidget
(EWW does a good job on its own), I am very interested in its (EWW does a good job on its own), I am very interested in its
capability to render full fledged web pages which include JavaScript, capability to render pages with JavaScript, as it may come of use when
as it may come of use when doing web development. I can see the doing web development. I can see the results of work very quickly
results of work very quickly without switching windows or workspaces. without switching windows all within Emacs.
*** Xwidget Core *** Xwidget Core
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package xwidget (use-package xwidget
@@ -1684,16 +1686,17 @@ xwidget."
#+end_src #+end_src
** Eshell ** Eshell
*** Why Eshell? *** Why Eshell?
Eshell is the integrated shell environment for Emacs. I argue that it Eshell is an integrated shell environment for Emacs, written in Emacs
is the best shell/command interpreter to use in Emacs. Lisp. I argue that it is the best shell/command interpreter to use in
Emacs.
Eshell is unlike the alternatives in Emacs as it's a /shell/ first, Eshell is unlike the alternatives in Emacs as it's a /shell/ first,
not a terminal emulator. It has the ability to spoof some aspects of a not a terminal emulator. It has the ability to spoof some aspects of a
terminal emulator (through the shell parser), but it is NOT a terminal terminal emulator (through the shell parser), but it is NOT a terminal
emulator. emulator.
I'd say the killer benefits of eshell (which would appeal to Emacs The killer benefits of eshell (which would appeal to Emacs users) are
users) are due to eshell being written in Emacs lisp: a direct result of eshell being written in Emacs lisp:
- incredible integration with Emacs utilities (such as ~dired~, - incredible integration with Emacs utilities (such as ~dired~,
~find-file~, any read functions, to name a few) ~find-file~, any read functions, to name a few)
- very extensible, easy to write new commands which leverage Emacs - very extensible, easy to write new commands which leverage Emacs
@@ -1705,25 +1708,23 @@ users) are due to eshell being written in Emacs lisp:
However, my favourite feature of eshell is the set of evaluators that However, my favourite feature of eshell is the set of evaluators that
run on command input. Some of the benefits listed above come as a run on command input. Some of the benefits listed above come as a
result of this powerful feature. These evaluators are describe below. result of this powerful feature. These evaluators are described below.
Lisp evaluator: works on braced expressions, evaluating them as Lisp Lisp evaluator: works on braced expressions, evaluating them as Lisp
expressions. Any returned objects are printed. This makes eshell an expressions (e.g. ~(message "Hello, World!\n")~). Any returned
Emacs Lisp REPL! objects are printed. This makes eshell a LISP REPL!
External evaluator: works within curly braces, evaluating them via External evaluator: works within curly braces, evaluating them via
some external shell process (like sh). This makes eshell a (dumb) some external shell process (like sh) (e.g. ~{echo "Hello,
terminal emulator! world!\n"}~). This makes eshell a (kinda dumb) terminal emulator!
The alias evaluator is the top level evaluator. It is the main The alias evaluator is the top level evaluator. It is the main
evaluator for each expression given to eshell. When given an evaluator for each expression given to eshell. When given an
expression it tries to evaluate it by testing against these conditions expression it tries to evaluate it by testing against these conditions:
(going to the next if it doesn't find it):
- it's an alias defined by the user or in the ~eshell/~ namespace of - it's an alias defined by the user or in the ~eshell/~ namespace of
functions (simplest evaluator) functions (simplest evaluator)
- it's some form of lisp expression (lisp evaluator) - it's some form of lisp expression (lisp evaluator)
- it's an external command (bash evaluator) - it's an external command (bash evaluator)
Essentially, you get the best of both Emacs and external shell Essentially, you get the best of both Emacs and external shell
programs *ALL WITHIN* Emacs for free. programs *ALL WITHIN* Emacs for free.
*** Eshell functionality *** Eshell functionality
@@ -1762,6 +1763,7 @@ function to pull up the eshell quickly.
Pretty symbols and a display record. Pretty symbols and a display record.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eshell (use-package eshell
:defer t
:pretty :pretty
(eshell-mode-hook (eshell-mode-hook
("lambda" . "λ") ("lambda" . "λ")
@@ -1791,8 +1793,7 @@ much faster than ~cd ..; ls -l~).
(let* ((git-branch (shell-command-to-string "git branch")) (let* ((git-branch (shell-command-to-string "git branch"))
(is-repo (string= (if (string= git-branch "") "" (is-repo (string= (if (string= git-branch "") ""
(substring git-branch 0 1)) "*"))) (substring git-branch 0 1)) "*")))
(if (not is-repo) (if (not is-repo) ""
""
(concat (concat
"(" "("
(nth 2 (split-string git-branch "\n\\|\\*\\| ")) (nth 2 (split-string git-branch "\n\\|\\*\\| "))
@@ -1817,6 +1818,33 @@ much faster than ~cd ..; ls -l~).
"Use `read-directory-name' to change directories." "Use `read-directory-name' to change directories."
(eshell/cd (list (read-directory-name "Enter directory to go to:"))))) (eshell/cd (list (read-directory-name "Enter directory to go to:")))))
#+end_src #+end_src
*** Eshell change directory quickly
~eshell/goto~ is a better ~cd~ for eshell. However it is really just
a plaster over a bigger issue for my workflow; many times I want
eshell to be present in the current directory of the buffer I am
using.
#+begin_src emacs-lisp
(use-package eshell
:straight nil
:general
(leader
"T" #'+eshell/current-buffer)
:config
(defun +eshell/current-buffer ()
(interactive)
(let ((dir (if buffer-file-name
(file-name-directory buffer-file-name)
(if default-directory
default-directory
nil)))
(buf (eshell)))
(if dir
(with-current-buffer buf
(eshell/cd dir)
(eshell-send-input))
(message "Could not switch eshell: buffer is not real file")))))
#+end_src
** Elfeed ** Elfeed
Elfeed is the perfect RSS feed reader, integrated into Emacs Elfeed is the perfect RSS feed reader, integrated into Emacs
perfectly. I've got a set of feeds that I use for a large variety of perfectly. I've got a set of feeds that I use for a large variety of
@@ -2273,8 +2301,9 @@ There is no proper PDF viewing without this package.
~evil-collection~ provides a setup for this mode, so use that. ~evil-collection~ provides a setup for this mode, so use that.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package pdf-tools (use-package pdf-tools
:mode ("\\.[pP][dD][fF]" . pdf-view-mode) :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode)
:straight t :straight t
:defer t
:display :display
("^.*pdf$" ("^.*pdf$"
(display-buffer-same-window) (display-buffer-same-window)
@@ -2304,6 +2333,9 @@ to standard grep (but for PDFs!).
(setq sql-display-sqli-buffer-function nil)) (setq sql-display-sqli-buffer-function nil))
#+end_src #+end_src
** Ada ** Ada
:PROPERTIES:
:header-args:emacs-lisp: :tangle no
:END:
Check out [[file:elisp/ada-mode.el][ada-mode*]], my custom ~ada-mode~ that replaces the default one. Check out [[file:elisp/ada-mode.el][ada-mode*]], my custom ~ada-mode~ that replaces the default one.
This mode just colourises stuff, and uses eglot to do the important This mode just colourises stuff, and uses eglot to do the important
stuff. stuff.
@@ -2338,9 +2370,11 @@ Emacs was very helpful here.
(org-directory "~/Text") (org-directory "~/Text")
(org-edit-src-content-indentation 0) (org-edit-src-content-indentation 0)
(org-goto-interface 'outline) (org-goto-interface 'outline)
(org-adapt-indentation nil)
(org-indent-mode nil)
(org-src-window-setup 'current-window) (org-src-window-setup 'current-window)
(org-indirect-buffer-display 'current-window) (org-indirect-buffer-display 'current-window)
(org-export-backends '(ascii html latex odt)) (org-export-backends '(ascii html latex odt icalendar))
(org-imenu-depth 10) (org-imenu-depth 10)
(org-link-frame-setup '((vm . vm-visit-folder-other-frame) (org-link-frame-setup '((vm . vm-visit-folder-other-frame)
(vm-imap . vm-visit-imap-folder-other-frame) (vm-imap . vm-visit-imap-folder-other-frame)
@@ -2381,8 +2415,8 @@ 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
'("latexmk -pdf -bibtex -f -shell-escape %f")) '("latexmk -pdfxe -bibtex -f -shell-escape %f"))
(org-latex-minted-options '(("style" "xcode") (setq org-latex-minted-options '(("style" "colorful")
("linenos") ("linenos")
("frame" "single") ("frame" "single")
("mathescape") ("mathescape")
@@ -2428,7 +2462,8 @@ Some bindings for org mode.
(leader (leader
"fw" #'org-capture "fw" #'org-capture
"fl" #'org-store-link "fl" #'org-store-link
"fi" #'org-insert-last-stored-link) "fi" #'org-insert-last-stored-link
"cD" #'org-babel-detangle)
(nmmap (nmmap
:keymaps 'org-mode-map :keymaps 'org-mode-map
[remap imenu] #'+org/swiper-goto) [remap imenu] #'+org/swiper-goto)
@@ -2437,9 +2472,18 @@ Some bindings for org mode.
:infix "l" :infix "l"
"i" #'org-insert-link "i" #'org-insert-link
"l" #'org-open-at-point) "l" #'org-open-at-point)
(local-leader
:keymaps 'org-mode-map
:infix "'"
"a" #'org-table-align
"f" #'org-table-edit-formulas
"t" #'org-table-toggle-coordinate-overlays
"s" #'org-table-sum
"e" #'org-table-eval-formula)
(local-leader (local-leader
:keymaps 'org-mode-map :keymaps 'org-mode-map
"t" #'org-todo "t" #'org-todo
"T" #'org-babel-tangle
"i" #'org-insert-structure-template "i" #'org-insert-structure-template
"p" #'org-latex-preview "p" #'org-latex-preview
"s" #'org-property-action "s" #'org-property-action
@@ -2456,11 +2500,12 @@ a very tidy way to manage your time.
:init :init
(defconst +org/agenda-root "~/Text" (defconst +org/agenda-root "~/Text"
"Root directory for all agenda files") "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/")) (setq org-agenda-files (list (expand-file-name +org/agenda-root) (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
org-agenda-skip-scheduled-if-done t org-agenda-skip-scheduled-if-done t
org-agenda-skip-deadline-if-done t) org-agenda-skip-deadline-if-done t
org-agenda-start-with-entry-text-mode nil)
:config :config
(evil-set-initial-state 'org-agenda-mode 'normal) (evil-set-initial-state 'org-agenda-mode 'normal)
:general :general
@@ -2519,6 +2564,7 @@ crash (like the async handler for org-export). Works really well with
~pdf-view-mode~. ~pdf-view-mode~.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org (use-package org
:defer t
:init :init
(defvar +org/compile-to-pdf-on-save-p (defvar +org/compile-to-pdf-on-save-p
nil nil
@@ -2532,7 +2578,6 @@ crash (like the async handler for org-export). Works really well with
(setq-local +org/compile-to-pdf-on-save-p t)))) (setq-local +org/compile-to-pdf-on-save-p t))))
:config :config
(+oreo/create-auto-save (+oreo/create-auto-save
+org/compile-to-pdf-on-save-f
(and (eq major-mode 'org-mode) +org/compile-to-pdf-on-save-p) (and (eq major-mode 'org-mode) +org/compile-to-pdf-on-save-p)
(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)))))
@@ -2541,7 +2586,7 @@ crash (like the async handler for org-export). Works really well with
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org-ref (use-package org-ref
:straight t :straight t
:after org :defer t
:init :init
(setq bibtex-files '("~/Text/bibliography.bib") (setq bibtex-files '("~/Text/bibliography.bib")
bibtex-completion-bibliography '("~/Text/bibliography.bib") bibtex-completion-bibliography '("~/Text/bibliography.bib")
@@ -2714,7 +2759,6 @@ format [[file:~/Dotfiles/ClangFormat/.clang-format][config file]] in my dotfiles
buffer") buffer")
(+oreo/create-auto-save (+oreo/create-auto-save
+code/clang-format-on-save
(and +code/clang-format-automatically (and +code/clang-format-automatically
(or (eq major-mode 'c-mode) (or (eq major-mode 'c-mode)
(eq major-mode 'c++-mode))) (eq major-mode 'c++-mode)))
@@ -2778,6 +2822,7 @@ Just setup a style and some pretty symbols.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package ob-java (use-package ob-java
:straight nil :straight nil
:defer t
:pretty :pretty
(java-mode-hook (java-mode-hook
("println" . "φ") ("println" . "φ")
@@ -2986,7 +3031,6 @@ development on Emacs.
"e" #'sly-eval-last-expression "e" #'sly-eval-last-expression
"f" #'sly-eval-defun "f" #'sly-eval-defun
"r" #'sly-eval-region) "r" #'sly-eval-region)
; sly binds
(nmap (nmap
:keymaps 'sly-inspector-mode-map :keymaps 'sly-inspector-mode-map
"q" #'sly-inspector-quit)) "q" #'sly-inspector-quit))