Config elisp reformatting
This commit is contained in:
parent
be308338c9
commit
ec1e6a57a4
150
config.org
150
config.org
|
@ -346,16 +346,16 @@ navigation/swapping commands.
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(map! :map evil-window-map
|
||||
"SPC" #'rotate-layout
|
||||
;; Navigation
|
||||
"<left>" #'evil-window-left
|
||||
"<down>" #'evil-window-down
|
||||
"<up>" #'evil-window-up
|
||||
"<right>" #'evil-window-right
|
||||
;; Swapping windows
|
||||
"C-<left>" #'+evil/window-move-left
|
||||
"C-<down>" #'+evil/window-move-down
|
||||
"C-<up>" #'+evil/window-move-up
|
||||
"C-<right>" #'+evil/window-move-right)
|
||||
;; Navigation
|
||||
"<left>" #'evil-window-left
|
||||
"<down>" #'evil-window-down
|
||||
"<up>" #'evil-window-up
|
||||
"<right>" #'evil-window-right
|
||||
;; Swapping windows
|
||||
"C-<left>" #'+evil/window-move-left
|
||||
"C-<down>" #'+evil/window-move-down
|
||||
"C-<up>" #'+evil/window-move-up
|
||||
"C-<right>" #'+evil/window-move-right)
|
||||
#+END_SRC
|
||||
*** Buffer defaults
|
||||
I'd much rather have my new buffers in ~org-mode~ than ~fundamental-mode~, hence
|
||||
|
@ -438,15 +438,15 @@ There are a few handy macros added by doom, namely
|
|||
I'd like to have just the buffer name, then if applicable the project folder
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq frame-title-format
|
||||
'(""
|
||||
(:eval
|
||||
(if (s-contains-p org-roam-directory (or buffer-file-name ""))
|
||||
(replace-regexp-in-string ".*/[0-9]*-?" "🢔 " buffer-file-name)
|
||||
"%b"))
|
||||
(:eval
|
||||
(let ((project-name (projectile-project-name)))
|
||||
(unless (string= "-" project-name)
|
||||
(format (if (buffer-modified-p) " ◉ %s" " ● %s") project-name))))))
|
||||
'(""
|
||||
(:eval
|
||||
(if (s-contains-p org-roam-directory (or buffer-file-name ""))
|
||||
(replace-regexp-in-string ".*/[0-9]*-?" "🢔 " buffer-file-name)
|
||||
"%b"))
|
||||
(:eval
|
||||
(let ((project-name (projectile-project-name)))
|
||||
(unless (string= "-" project-name)
|
||||
(format (if (buffer-modified-p) " ◉ %s" " ● %s") project-name))))))
|
||||
#+END_SRC
|
||||
*** Splash screen
|
||||
Emacs can render an image as the splash screen, and [[https://github.com/MarioRicalde][@MarioRicalde]] came up with a
|
||||
|
@ -465,15 +465,15 @@ quite a nice resizing effect.
|
|||
"An image to use at minimum size, usually a transparent pixel")
|
||||
|
||||
(setq fancy-splash-sizes
|
||||
`((:height 500 :min-height 50 :padding (0 . 4) :template ,(expand-file-name "misc/splash-images/blackhole-lines-0.svg" doom-private-dir))
|
||||
(:height 440 :min-height 42 :padding (1 . 4) :template ,(expand-file-name "misc/splash-images/blackhole-lines-0.svg" doom-private-dir))
|
||||
(:height 400 :min-height 38 :padding (1 . 4) :template ,(expand-file-name "misc/splash-images/blackhole-lines-1.svg" doom-private-dir))
|
||||
(:height 350 :min-height 36 :padding (1 . 3) :template ,(expand-file-name "misc/splash-images/blackhole-lines-2.svg" doom-private-dir))
|
||||
(:height 300 :min-height 34 :padding (1 . 3) :template ,(expand-file-name "misc/splash-images/blackhole-lines-3.svg" doom-private-dir))
|
||||
(:height 250 :min-height 32 :padding (1 . 2) :template ,(expand-file-name "misc/splash-images/blackhole-lines-4.svg" doom-private-dir))
|
||||
(:height 200 :min-height 30 :padding (1 . 2) :template ,(expand-file-name "misc/splash-images/blackhole-lines-5.svg" doom-private-dir))
|
||||
(:height 100 :min-height 24 :padding (1 . 2) :template ,(expand-file-name "misc/splash-images/emacs-e-template.svg" doom-private-dir))
|
||||
(:height 0 :min-height 0 :padding (0 . 0) :file ,fancy-splash-image-nil)))
|
||||
`((:height 500 :min-height 50 :padding (0 . 4) :template ,(expand-file-name "misc/splash-images/blackhole-lines-0.svg" doom-private-dir))
|
||||
(:height 440 :min-height 42 :padding (1 . 4) :template ,(expand-file-name "misc/splash-images/blackhole-lines-0.svg" doom-private-dir))
|
||||
(:height 400 :min-height 38 :padding (1 . 4) :template ,(expand-file-name "misc/splash-images/blackhole-lines-1.svg" doom-private-dir))
|
||||
(:height 350 :min-height 36 :padding (1 . 3) :template ,(expand-file-name "misc/splash-images/blackhole-lines-2.svg" doom-private-dir))
|
||||
(:height 300 :min-height 34 :padding (1 . 3) :template ,(expand-file-name "misc/splash-images/blackhole-lines-3.svg" doom-private-dir))
|
||||
(:height 250 :min-height 32 :padding (1 . 2) :template ,(expand-file-name "misc/splash-images/blackhole-lines-4.svg" doom-private-dir))
|
||||
(:height 200 :min-height 30 :padding (1 . 2) :template ,(expand-file-name "misc/splash-images/blackhole-lines-5.svg" doom-private-dir))
|
||||
(:height 100 :min-height 24 :padding (1 . 2) :template ,(expand-file-name "misc/splash-images/emacs-e-template.svg" doom-private-dir))
|
||||
(:height 0 :min-height 0 :padding (0 . 0) :file ,fancy-splash-image-nil)))
|
||||
|
||||
(defvar fancy-splash-sizes
|
||||
`((:height 500 :min-height 50 :padding (0 . 2))
|
||||
|
@ -510,16 +510,16 @@ quite a nice resizing effect.
|
|||
(defun fancy-splash-generate-image (template height)
|
||||
"Read TEMPLATE and create an image if HEIGHT with colour substitutions as
|
||||
described by `fancy-splash-template-colours' for the current theme"
|
||||
(with-temp-buffer
|
||||
(insert-file-contents template)
|
||||
(re-search-forward "$height" nil t)
|
||||
(replace-match (number-to-string height) nil nil)
|
||||
(dolist (substitution fancy-splash-template-colours)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward (car substitution) nil t)
|
||||
(replace-match (doom-color (cdr substitution)) nil nil)))
|
||||
(write-region nil nil
|
||||
(fancy-splash-filename (symbol-name doom-theme) height) nil nil)))
|
||||
(with-temp-buffer
|
||||
(insert-file-contents template)
|
||||
(re-search-forward "$height" nil t)
|
||||
(replace-match (number-to-string height) nil nil)
|
||||
(dolist (substitution fancy-splash-template-colours)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward (car substitution) nil t)
|
||||
(replace-match (doom-color (cdr substitution)) nil nil)))
|
||||
(write-region nil nil
|
||||
(fancy-splash-filename (symbol-name doom-theme) height) nil nil)))
|
||||
|
||||
(defun fancy-splash-generate-images ()
|
||||
"Perform `fancy-splash-generate-image' in bulk"
|
||||
|
@ -1062,7 +1062,7 @@ are just waiting to be saved!
|
|||
(setq company-idle-delay 0.5
|
||||
company-minimum-prefix-length 2)
|
||||
(setq company-show-numbers t)
|
||||
(add-hook 'evil-normal-state-entry-hook #'company-abort)) ;; make aborting less annoying.
|
||||
(add-hook 'evil-normal-state-entry-hook #'company-abort)) ;; make aborting less annoying.
|
||||
#+END_SRC
|
||||
Now, the improvements from ~precedent~ are mostly from remembering history, so
|
||||
let's improve that memory.
|
||||
|
@ -1073,12 +1073,14 @@ let's improve that memory.
|
|||
*** Plain Text
|
||||
~Ispell~ is nice, let's have it in ~text~, ~markdown~, and ~GFM~.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(set-company-backend! '(text-mode
|
||||
markdown-mode
|
||||
gfm-mode)
|
||||
'(:seperate company-ispell
|
||||
company-files
|
||||
company-yasnippet))
|
||||
(set-company-backend!
|
||||
'(text-mode
|
||||
markdown-mode
|
||||
gfm-mode)
|
||||
'(:seperate
|
||||
company-ispell
|
||||
company-files
|
||||
company-yasnippet))
|
||||
#+END_SRC
|
||||
We then configure the dictionary we're using in [[*Ispell][Ispell]].
|
||||
*** ESS
|
||||
|
@ -1398,8 +1400,8 @@ take markdown
|
|||
(defun markdown-window-p (window-title)
|
||||
"Judges from WINDOW-TITLE whether the current window likes markdown"
|
||||
(if (string-match-p (rx (or "Stack Exchange" "Stack Overflow"
|
||||
"Pull Request" "Issue" "Discord"))
|
||||
window-title) t nil))
|
||||
"Pull Request" "Issue" "Discord"))
|
||||
window-title) t nil))
|
||||
#+END_SRC
|
||||
When the window opens, we generally want text so let's use a nice sans serif font,
|
||||
a position the window below and to the left. Oh, and don't forget about checking
|
||||
|
@ -1424,13 +1426,15 @@ Affects behaviour of `emacs-anywhere--finalise-content'")
|
|||
:init-value nil
|
||||
:keymap (list
|
||||
;; Finish edit, but be smart in org mode
|
||||
(cons (kbd "C-c C-c") (cmd! (if (and (eq major-mode 'org-mode)
|
||||
(org-in-src-block-p))
|
||||
(org-ctrl-c-ctrl-c)
|
||||
(delete-frame))))
|
||||
(cons (kbd "C-c C-c")
|
||||
(cmd! (if (and (eq major-mode 'org-mode)
|
||||
(org-in-src-block-p))
|
||||
(org-ctrl-c-ctrl-c)
|
||||
(delete-frame))))
|
||||
;; Abort edit. emacs-anywhere saves the current edit for next time.
|
||||
(cons (kbd "C-c C-k") (cmd! (setq ea-on nil)
|
||||
(delete-frame))))
|
||||
(cons (kbd "C-c C-k")
|
||||
(cmd! (setq ea-on nil)
|
||||
(delete-frame))))
|
||||
(when emacs-anywhere-mode
|
||||
;; line breaking
|
||||
(turn-off-auto-fill)
|
||||
|
@ -1664,25 +1668,27 @@ Prevents a series of redisplays from being called (when set to an appropriate va
|
|||
(delete-file mu4e-reindex-request-file))
|
||||
(mu4e-reindex-request--add-watcher))
|
||||
|
||||
(defun mu4e-file-reindex-request (event)
|
||||
"Act based on the existance of `mu4e-reindex-request-file'"
|
||||
(if mu4e-reindex-request--file-just-deleted
|
||||
(mu4e-reindex-request--add-watcher)
|
||||
(when (equal (nth 1 event) 'created)
|
||||
(delete-file mu4e-reindex-request-file)
|
||||
(setq mu4e-reindex-request--file-just-deleted t)
|
||||
(mu4e-reindex-maybe t))))
|
||||
(defun mu4e-file-reindex-request (event)
|
||||
"Act based on the existance of `mu4e-reindex-request-file'"
|
||||
(if mu4e-reindex-request--file-just-deleted
|
||||
(mu4e-reindex-request--add-watcher)
|
||||
(when (equal (nth 1 event) 'created)
|
||||
(delete-file mu4e-reindex-request-file)
|
||||
(setq mu4e-reindex-request--file-just-deleted t)
|
||||
(mu4e-reindex-maybe t))))
|
||||
|
||||
(defun mu4e-reindex-maybe (&optional new-request)
|
||||
"Run `mu4e~proc-index' if it's been more than `mu4e-reindex-request-min-seperation' seconds since the last request,"
|
||||
(let ((time-since-last-request (- (float-time) mu4e-reindex-request--last-time)))
|
||||
(defun mu4e-reindex-maybe (&optional new-request)
|
||||
"Run `mu4e~proc-index' if it's been more than
|
||||
`mu4e-reindex-request-min-seperation'seconds since the last request,"
|
||||
(let ((time-since-last-request (- (float-time)
|
||||
mu4e-reindex-request--last-time)))
|
||||
(when new-request
|
||||
(setq mu4e-reindex-request--last-time (float-time)))
|
||||
(if (> time-since-last-request mu4e-reindex-request-min-seperation)
|
||||
(mu4e~proc-index nil t)
|
||||
(when new-request
|
||||
(setq mu4e-reindex-request--last-time (float-time)))
|
||||
(if (> time-since-last-request mu4e-reindex-request-min-seperation)
|
||||
(mu4e~proc-index nil t)
|
||||
(when new-request
|
||||
(run-at-time (* 1.1 mu4e-reindex-request-min-seperation) nil
|
||||
#'mu4e-reindex-maybe))))))
|
||||
(run-at-time (* 1.1 mu4e-reindex-request-min-seperation) nil
|
||||
#'mu4e-reindex-maybe))))))
|
||||
#+END_SRC
|
||||
|
||||
**** Config transcoding & service management
|
||||
|
@ -2453,10 +2459,10 @@ Let's send emails too.
|
|||
#+BEGIN_SRC emacs-lisp
|
||||
(after! mu4e
|
||||
(setq sendmail-program "/usr/bin/msmtp"
|
||||
send-mail-function 'smtpmail-send-it
|
||||
send-mail-function #'smtpmail-send-it
|
||||
message-sendmail-f-is-evil t
|
||||
message-sendmail-extra-arguments '("--read-envelope-from"); , "--read-recipients")
|
||||
message-send-mail-function 'message-send-mail-with-sendmail))
|
||||
message-send-mail-function #'message-send-mail-with-sendmail))
|
||||
#+END_SRC
|
||||
|
||||
It's also nice to avoid accidentally sending emails with the wrong account.
|
||||
|
|
Loading…
Reference in New Issue