Minor edits to Doom Emacs and XMonad.

This commit is contained in:
Derek Taylor 2021-04-12 18:56:03 -05:00
parent cadced2fdc
commit dbcf958137
4 changed files with 14 additions and 52 deletions

View File

@ -49,7 +49,7 @@
(map! :leader
:desc "Load new theme" "h t" #'counsel-load-theme)
(require 'elfeed-goodies)
(use-package! elfeed-goodies)
(elfeed-goodies/setup)
(setq elfeed-goodies/entry-pane-size 0.5)
(add-hook 'elfeed-show-mode-hook 'visual-line-mode)
@ -292,26 +292,6 @@
"DONE(d)" ; Task has been completed
"CANCELLED(c)" )))) ; Task has been cancelled
(defun dt/org-babel-tangle-async (file)
"Invoke `org-babel-tangle-file' asynchronously."
(message "Tangling %s..." (buffer-file-name))
(async-start
(let ((args (list file)))
`(lambda ()
(require 'org)
;;(load "~/.emacs.d/init.el")
(let ((start-time (current-time)))
(apply #'org-babel-tangle-file ',args)
(format "%.2f" (float-time (time-since start-time))))))
(let ((message-string (format "Tangling %S completed after " file)))
`(lambda (tangle-time)
(message (concat ,message-string
(format "%s seconds" tangle-time)))))))
(defun dt/org-babel-tangle-current-buffer-async ()
"Tangle current buffer asynchronously."
(dt/org-babel-tangle-async (buffer-file-name)))
(map! :leader
(:prefix ("r" . "registers")
:desc "Copy to register" "c" #'copy-to-register

View File

@ -130,7 +130,7 @@ Setting the theme to doom-one. To try out new themes, I set a keybinding for co
An RSS newsfeed reader for Emacs.
#+BEGIN_SRC emacs-lisp
(require 'elfeed-goodies)
(use-package! elfeed-goodies)
(elfeed-goodies/setup)
(setq elfeed-goodies/entry-pane-size 0.5)
(add-hook 'elfeed-show-mode-hook 'visual-line-mode)
@ -510,30 +510,6 @@ Note that I wrapped most of this in (after! org). Without this, my settings mig
#+END_SRC
I was tired of having to run org-babel-tangle after saving my literate dotfiles. So the following function runs org-babel-tangle upon saving any org-mode buffer. This is asynchronous meaning that it dispatches the tangle function to a subprocess, so that the main Emacs is not blocked while it runs.
#+BEGIN_SRC emacs-lisp
(defun dt/org-babel-tangle-async (file)
"Invoke `org-babel-tangle-file' asynchronously."
(message "Tangling %s..." (buffer-file-name))
(async-start
(let ((args (list file)))
`(lambda ()
(require 'org)
;;(load "~/.emacs.d/init.el")
(let ((start-time (current-time)))
(apply #'org-babel-tangle-file ',args)
(format "%.2f" (float-time (time-since start-time))))))
(let ((message-string (format "Tangling %S completed after " file)))
`(lambda (tangle-time)
(message (concat ,message-string
(format "%s seconds" tangle-time)))))))
(defun dt/org-babel-tangle-current-buffer-async ()
"Tangle current buffer asynchronously."
(dt/org-babel-tangle-async (buffer-file-name)))
#+END_SRC
* REGISTERS
Emacs registers are compartments where you can save text, rectangles and positions for later use. Once you save text or a rectangle in a register, you can copy it into the buffer once or many times; once you save a position in a register, you can jump back to that position once or many times. The default GNU Emacs keybindings for these commands (with the exception of counsel-register) involves 'C-x r' followed by one or more other keys. I wanted to make this a little more user friendly, and since I am using Doom Emacs, I choose to replace the 'C-x r' part of the key chords with 'SPC r'.

View File

@ -106,6 +106,7 @@ import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
-- Prompt
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.Input
import XMonad.Prompt.FuzzyMatch
import XMonad.Prompt.Man
@ -117,6 +118,7 @@ import XMonad.Prompt.XMonad
import Control.Arrow (first)
-- Utilities
import XMonad.Util.Dmenu
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
@ -896,9 +898,9 @@ I am using the Xmonad.Util.EZConfig module which allows keybindings to be writte
myKeys :: [(String, X ())]
myKeys =
-- Xmonad
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
, ("M-S-q", io exitSuccess) -- Quits xmonad
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
, ("M-S-q", confirmPrompt dtXPConfig' "exit" $ io exitSuccess) -- Quits xmonad
-- Run Prompt
, ("M-S-<Return>", shellPrompt dtXPConfig) -- Xmonad Shell Prompt
@ -914,6 +916,7 @@ myKeys =
, ("M-p s", sshPrompt dtXPConfig) -- sshPrompt
, ("M-p u", mkUnicodePrompt "xsel" ["-b"] "/home/dt/.xmonad/UnicodeData.txt" emojiXPConfig) -- unicodePrompt (for copying emojis)
, ("M-p x", xmonadPrompt dtXPConfig) -- xmonadPrompt
, ("M-p q", confirmPrompt dtXPConfig "exit" $ io exitSuccess) -- xmonadPrompt
-- Useful programs to have a keybinding for launch
, ("M-<Return>", spawn (myTerminal))

View File

@ -62,6 +62,7 @@ import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
-- Prompt
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.Input
import XMonad.Prompt.FuzzyMatch
import XMonad.Prompt.Man
@ -73,6 +74,7 @@ import XMonad.Prompt.XMonad
import Control.Arrow (first)
-- Utilities
import XMonad.Util.Dmenu
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
@ -738,9 +740,9 @@ myLogHook = fadeInactiveLogHook fadeAmount
myKeys :: [(String, X ())]
myKeys =
-- Xmonad
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
, ("M-S-q", io exitSuccess) -- Quits xmonad
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
, ("M-S-q", confirmPrompt dtXPConfig' "exit" $ io exitSuccess) -- Quits xmonad
-- Run Prompt
, ("M-S-<Return>", shellPrompt dtXPConfig) -- Xmonad Shell Prompt
@ -756,6 +758,7 @@ myKeys =
, ("M-p s", sshPrompt dtXPConfig) -- sshPrompt
, ("M-p u", mkUnicodePrompt "xsel" ["-b"] "/home/dt/.xmonad/UnicodeData.txt" emojiXPConfig) -- unicodePrompt (for copying emojis)
, ("M-p x", xmonadPrompt dtXPConfig) -- xmonadPrompt
, ("M-p q", confirmPrompt dtXPConfig "exit" $ io exitSuccess) -- xmonadPrompt
-- Useful programs to have a keybinding for launch
, ("M-<Return>", spawn (myTerminal))