(Emacs/config)~minor changes
This commit is contained in:
@@ -72,23 +72,8 @@ Let's setup a few things:
|
|||||||
(global-auto-revert-mode))
|
(global-auto-revert-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
* Custom functionality
|
* Custom functionality
|
||||||
Some Lisp I wrote that only depends on Emacs to provide some custom
|
This is custom Lisp I've written to help me out throughout the
|
||||||
functionality.
|
configuration. Note that because it's setup so early
|
||||||
** Automatically run a command on saving
|
|
||||||
Define a macro which creates hooks into the ~after-save-hook~. On
|
|
||||||
certain ~conditions~ being met, ~to-run~ is evaluated.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package simple
|
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(defmacro +oreo/create-auto-save (conditions &rest to-run)
|
|
||||||
"Create a hook for after saves, where on CONDITIONS being met
|
|
||||||
TO-RUN is evaluated."
|
|
||||||
`(add-hook 'after-save-hook
|
|
||||||
#'(lambda ()
|
|
||||||
(interactive)
|
|
||||||
(when ,conditions ,@to-run)))))
|
|
||||||
#+end_src
|
|
||||||
** Procedure
|
** Procedure
|
||||||
A ~lambda~ which takes no arguments is a procedure. This macro
|
A ~lambda~ which takes no arguments is a procedure. This macro
|
||||||
generates procedures, with the parameters of the macro being the body
|
generates procedures, with the parameters of the macro being the body
|
||||||
@@ -101,20 +86,37 @@ common use of this macro.
|
|||||||
lambda."
|
lambda."
|
||||||
`(quote (lambda nil ,@BODY)))
|
`(quote (lambda nil ,@BODY)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
** Automatically run a command on saving
|
||||||
|
Define a macro which creates hooks into the ~after-save-hook~. On
|
||||||
|
certain ~conditions~ being met, ~to-run~ is evaluated.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package simple
|
||||||
|
:defer t
|
||||||
|
:config
|
||||||
|
(defmacro +oreo/create-auto-save (conditions &rest to-run)
|
||||||
|
"Create a hook for after saves, where on CONDITIONS being met
|
||||||
|
TO-RUN is evaluated."
|
||||||
|
`(add-hook 'after-save-hook
|
||||||
|
(proc
|
||||||
|
(interactive)
|
||||||
|
(when ,conditions ,@to-run)))))
|
||||||
|
#+end_src
|
||||||
** System specificity
|
** System specificity
|
||||||
A macro that acts as a switch case on ~(system-name)~ which so a user
|
A macro that acts as a switch case on ~(system-name)~ so a user can
|
||||||
can write code for each possible host. For me this is for my desktop
|
write code for multiple hosts. For me this is for my desktop and
|
||||||
and laptop, particularly for font sizes. Though there may be an
|
laptop. Though there may be an easier solution than this, this seems
|
||||||
easier solution than this, this seems simple enough.
|
simple enough.
|
||||||
|
|
||||||
Note the check for the symbol ~otherwise~ which is the default case.
|
Note the check for the symbol ~otherwise~ which acts as the default
|
||||||
|
case.
|
||||||
#+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: (string . (forms...)) where the
|
Each pair in PAIRS is typed as: (string . (forms...)) where the
|
||||||
string represents the system name to test, and forms being the
|
string represents the system name to test, and forms being the
|
||||||
consequence if true."
|
consequence if true. if string is the symbol OTHERWISE, then it
|
||||||
|
is considered the default case."
|
||||||
`(cond ,@(mapcar
|
`(cond ,@(mapcar
|
||||||
#'(lambda (pair)
|
#'(lambda (pair)
|
||||||
(cl-destructuring-bind (name . body) pair
|
(cl-destructuring-bind (name . body) pair
|
||||||
@@ -143,7 +145,7 @@ use:
|
|||||||
(setq native-comp-async-jobs-number 6))))
|
(setq native-comp-async-jobs-number 6))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Clean buffer list
|
** Clean buffer list
|
||||||
Clean all buffers excluding those in ~+oreo/keep-buffers~.
|
Clean all buffers except for those in ~+oreo/keep-buffers~.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defconst +oreo/keep-buffers
|
(defconst +oreo/keep-buffers
|
||||||
(list "config.org" "*scratch*"
|
(list "config.org" "*scratch*"
|
||||||
@@ -154,10 +156,9 @@ Clean all buffers excluding those in ~+oreo/keep-buffers~.
|
|||||||
(defun +oreo/clean-buffers ()
|
(defun +oreo/clean-buffers ()
|
||||||
"Kill all buffers except any with names in +oreo/keep-buffers."
|
"Kill all buffers except any with names in +oreo/keep-buffers."
|
||||||
(interactive)
|
(interactive)
|
||||||
(mapcar #'kill-buffer
|
(let ((should-not-kill #'(lambda (buf) (member (buffer-name buf) +oreo/keep-buffers)))
|
||||||
(cl-remove-if
|
(buffers (buffer-list)))
|
||||||
#'(lambda (buf) (member (buffer-name buf) +oreo/keep-buffers))
|
(mapcar #'kill-buffer (cl-remove-if should-not-kill buffers))))
|
||||||
(buffer-list))))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Aesthetics
|
* Aesthetics
|
||||||
General look and feel of Emacs (mostly disabling stuff I don't like).
|
General look and feel of Emacs (mostly disabling stuff I don't like).
|
||||||
@@ -211,15 +212,14 @@ dark easily, so here's a command to switch between them.
|
|||||||
(setq +oreo/theme 'dark)))))
|
(setq +oreo/theme 'dark)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Font size
|
** Font size
|
||||||
Set font size to 140 if on my desktop (oldboy) or 175 if on my laptop
|
Make font size bigger on my laptop and smaller on my desktop.
|
||||||
(newboy).
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package faces
|
(use-package faces
|
||||||
:defer t
|
:defer t
|
||||||
:config
|
:config
|
||||||
(+oreo/sys-name-cond
|
(+oreo/sys-name-cond
|
||||||
("newboy" (set-face-attribute 'default nil :height 145))
|
("newboy" (set-face-attribute 'default nil :height 145))
|
||||||
("oldboy" (set-face-attribute 'default nil :height 155))))
|
("oldboy" (set-face-attribute 'default nil :height 130))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Startup screen
|
** Startup screen
|
||||||
The default startup screen is quite bad in all honesty. While for a
|
The default startup screen is quite bad in all honesty. While for a
|
||||||
@@ -318,8 +318,11 @@ simplicity is above all.
|
|||||||
#+end_src
|
#+end_src
|
||||||
** Mouse
|
** Mouse
|
||||||
Who uses a mouse? 🤮
|
Who uses a mouse? 🤮
|
||||||
|
|
||||||
|
This disables the use of GUI dialogues for stuff.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq-default use-file-dialog nil)
|
(setq-default use-file-dialog nil
|
||||||
|
use-dialog-box nil)
|
||||||
#+end_src
|
#+end_src
|
||||||
** Scrolling
|
** Scrolling
|
||||||
Emacs can automatically scroll the buffer depending on how many lines
|
Emacs can automatically scroll the buffer depending on how many lines
|
||||||
@@ -680,7 +683,8 @@ selection list).
|
|||||||
(with-eval-after-load "evil"
|
(with-eval-after-load "evil"
|
||||||
(evil-set-initial-state 'ivy-occur-mode 'normal)
|
(evil-set-initial-state 'ivy-occur-mode 'normal)
|
||||||
(evil-set-initial-state 'ivy-occur-grep-mode 'normal))
|
(evil-set-initial-state 'ivy-occur-grep-mode 'normal))
|
||||||
(setq ivy-height 10
|
(setq ivy-height 8
|
||||||
|
ivy-height-alist nil
|
||||||
ivy-wrap t
|
ivy-wrap t
|
||||||
ivy-fixed-height-minibuffer t
|
ivy-fixed-height-minibuffer t
|
||||||
ivy-use-virtual-buffers nil
|
ivy-use-virtual-buffers nil
|
||||||
@@ -1773,6 +1777,7 @@ stuff, mostly media and entertainment. I've also bound "<leader> ar"
|
|||||||
to elfeed for loading the system.
|
to elfeed for loading the system.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package elfeed
|
(use-package elfeed
|
||||||
|
:straight t
|
||||||
:general
|
:general
|
||||||
(app-leader "r" #'elfeed)
|
(app-leader "r" #'elfeed)
|
||||||
(nmmap
|
(nmmap
|
||||||
@@ -2221,8 +2226,8 @@ has very little overhead to work there.
|
|||||||
"f" #'flycheck-mode)
|
"f" #'flycheck-mode)
|
||||||
(code-leader
|
(code-leader
|
||||||
"x" #'flycheck-list-errors
|
"x" #'flycheck-list-errors
|
||||||
"J" #'flycheck-next-error
|
"j" #'flycheck-next-error
|
||||||
"K" #'flycheck-previous-error)
|
"k" #'flycheck-previous-error)
|
||||||
:display
|
:display
|
||||||
("\\*Flycheck.*"
|
("\\*Flycheck.*"
|
||||||
(display-buffer-at-bottom)
|
(display-buffer-at-bottom)
|
||||||
|
|||||||
Reference in New Issue
Block a user