Minor formatting and indenting changes
This commit is contained in:
parent
b04ab0bd95
commit
58a1ef8df8
1 changed files with 165 additions and 165 deletions
|
@ -175,7 +175,7 @@ The above code needs the [[https://github.com/tkf/emacs-request][request]] packa
|
||||||
*** Dad Jokes!
|
*** Dad Jokes!
|
||||||
The /critical part/ here, is the [[https://icanhazdadjoke.com/][Dad Joke]] function, a =curl= call to a web service:
|
The /critical part/ here, is the [[https://icanhazdadjoke.com/][Dad Joke]] function, a =curl= call to a web service:
|
||||||
#+begin_src sh
|
#+begin_src sh
|
||||||
curl -sH "Accept: text/plain" https://icanhazdadjoke.com/
|
curl -sH "Accept: text/plain" https://icanhazdadjoke.com/
|
||||||
#+end_src
|
#+end_src
|
||||||
For this, I use the =request= package, which is /asynchronous/
|
For this, I use the =request= package, which is /asynchronous/
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
@ -331,7 +331,7 @@ How does it compare? Once upon a time, I enjoyed typing ~plp~ for =package-list-
|
||||||
*** Savehist
|
*** Savehist
|
||||||
Persist history over Emacs restarts using the built-in [[https://www.emacswiki.org/emacs/SaveHist][savehist]] project. Since both Vertico and Selectrum sorts by history position, this should make the choice /smarter/ with time.
|
Persist history over Emacs restarts using the built-in [[https://www.emacswiki.org/emacs/SaveHist][savehist]] project. Since both Vertico and Selectrum sorts by history position, this should make the choice /smarter/ with time.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package savehist
|
(use-package savehist
|
||||||
:init
|
:init
|
||||||
(savehist-mode))
|
(savehist-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
@ -349,7 +349,7 @@ The [[https://github.com/minad/marginalia][marginalia]] package gives a preview
|
||||||
* Key Bindings
|
* Key Bindings
|
||||||
To begin my binding changes, let's turn on [[https://github.com/justbur/emacs-which-key][which-key]]:
|
To begin my binding changes, let's turn on [[https://github.com/justbur/emacs-which-key][which-key]]:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package which-key
|
(use-package which-key
|
||||||
:init (setq which-key-popup-type 'minibuffer)
|
:init (setq which-key-popup-type 'minibuffer)
|
||||||
:config (which-key-mode))
|
:config (which-key-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
@ -363,7 +363,7 @@ I mean, I /always/ use ~C-/~ for [[help:undo][undo]] (and ~C-?~ for [[help:undo-
|
||||||
Why use [[https://gitlab.com/ideasman42/emacs-undo-fu][undo-fu]] instead of the built-in undo functionality? Well, there isn’t much to the project (that’s a good thing), but It basically doesn’t /cycle/ around the redo, which annoying.
|
Why use [[https://gitlab.com/ideasman42/emacs-undo-fu][undo-fu]] instead of the built-in undo functionality? Well, there isn’t much to the project (that’s a good thing), but It basically doesn’t /cycle/ around the redo, which annoying.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package undo-fu
|
(use-package undo-fu
|
||||||
:config
|
:config
|
||||||
(global-set-key [remap undo] 'undo-fu-only-undo)
|
(global-set-key [remap undo] 'undo-fu-only-undo)
|
||||||
(global-set-key [remap undo-redo] 'undo-fu-only-redo)
|
(global-set-key [remap undo-redo] 'undo-fu-only-redo)
|
||||||
|
@ -544,7 +544,7 @@ And the keybindings:
|
||||||
*** Key Chord
|
*** Key Chord
|
||||||
Using the key-chord project allows me to make Escape be on two key combo presses on both sides of my keyboard:
|
Using the key-chord project allows me to make Escape be on two key combo presses on both sides of my keyboard:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package key-chord
|
(use-package key-chord
|
||||||
:config
|
:config
|
||||||
(key-chord-mode t)
|
(key-chord-mode t)
|
||||||
(key-chord-define-global "fd" 'evil-normal-state)
|
(key-chord-define-global "fd" 'evil-normal-state)
|
||||||
|
@ -561,7 +561,7 @@ My ~F19~ key is within easy reach of my [[https://configure.zsa.io/moonlander/la
|
||||||
*** Evil Lion
|
*** Evil Lion
|
||||||
The [[https://github.com/edkolev/evil-lion][evil-lion]] package is a wrapper around Emacs’ [[help:align][align]] function. Just a little easier to use. Primary sequence is ~g a i p =~ to align along all the equal characters in the paragraph (block), or ~g a i b RET~ to use a built in rule to align (see below), or ~g a i b /~ to specify a regular expression, similar to [[help:align-regexp][align-regexp]].
|
The [[https://github.com/edkolev/evil-lion][evil-lion]] package is a wrapper around Emacs’ [[help:align][align]] function. Just a little easier to use. Primary sequence is ~g a i p =~ to align along all the equal characters in the paragraph (block), or ~g a i b RET~ to use a built in rule to align (see below), or ~g a i b /~ to specify a regular expression, similar to [[help:align-regexp][align-regexp]].
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package evil-lion
|
(use-package evil-lion
|
||||||
:after evil
|
:after evil
|
||||||
:bind (:map evil-normal-state-map
|
:bind (:map evil-normal-state-map
|
||||||
|
@ -735,7 +735,7 @@ This section groups buffer-related operations under the "SPC b" sequence.
|
||||||
|
|
||||||
Putting the entire visible contents of the buffer on the clipboard is often useful:
|
Putting the entire visible contents of the buffer on the clipboard is often useful:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun ha-yank-buffer-contents ()
|
(defun ha-yank-buffer-contents ()
|
||||||
"Copy narrowed contents of the buffer to the clipboard."
|
"Copy narrowed contents of the buffer to the clipboard."
|
||||||
(interactive)
|
(interactive)
|
||||||
(kill-new (buffer-substring-no-properties
|
(kill-new (buffer-substring-no-properties
|
||||||
|
@ -743,7 +743,7 @@ Putting the entire visible contents of the buffer on the clipboard is often usef
|
||||||
#+end_src
|
#+end_src
|
||||||
And the collection of useful operations:
|
And the collection of useful operations:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(ha-leader
|
(ha-leader
|
||||||
"b" '(:ignore t :which-key "buffers")
|
"b" '(:ignore t :which-key "buffers")
|
||||||
"b B" '("switch" . persp-switch-to-buffer)
|
"b B" '("switch" . persp-switch-to-buffer)
|
||||||
"b o" '("switch" . switch-to-buffer-other-window)
|
"b o" '("switch" . switch-to-buffer-other-window)
|
||||||
|
@ -1120,7 +1120,7 @@ The [[https://github.com/oantolin/embark/][embark]] project offers /actions/ on
|
||||||
According to [[https://elpa.gnu.org/packages/embark-consult.html#orgc76b5de][this essay]], Embark cooperates well with the [[https://github.com/minad/marginalia][Marginalia]] and [[https://github.com/minad/consult][Consult]] packages. Neither of those packages is a dependency of Embark, but Embark supplies a hook for Consult where Consult previews can be done from Embark Collect buffers:
|
According to [[https://elpa.gnu.org/packages/embark-consult.html#orgc76b5de][this essay]], Embark cooperates well with the [[https://github.com/minad/marginalia][Marginalia]] and [[https://github.com/minad/consult][Consult]] packages. Neither of those packages is a dependency of Embark, but Embark supplies a hook for Consult where Consult previews can be done from Embark Collect buffers:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package embark-consult
|
(use-package embark-consult
|
||||||
:after (embark consult)
|
:after (embark consult)
|
||||||
:demand t ; only necessary if you have the hook below
|
:demand t ; only necessary if you have the hook below
|
||||||
;; if you want to have consult previews as you move around an
|
;; if you want to have consult previews as you move around an
|
||||||
|
@ -1231,7 +1231,7 @@ Dropping into Emacs state is better than pure Evil state for applications, howev
|
||||||
|
|
||||||
Do I want to specify the list of modes to change for =evil-collection-init=, e.g.
|
Do I want to specify the list of modes to change for =evil-collection-init=, e.g.
|
||||||
#+begin_src emacs-lisp :tangle no :eval no
|
#+begin_src emacs-lisp :tangle no :eval no
|
||||||
'(eww magit dired notmuch term wdired)
|
'(eww magit dired notmuch term wdired)
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Evil Owl
|
*** Evil Owl
|
||||||
Not sure what is in a register? Have it show you when you hit ~”~ or ~@~ with [[https://github.com/mamapanda/evil-owl][evil-owl]]:
|
Not sure what is in a register? Have it show you when you hit ~”~ or ~@~ with [[https://github.com/mamapanda/evil-owl][evil-owl]]:
|
||||||
|
@ -1472,12 +1472,12 @@ Build the hydra as well as configure the =perspective= project.
|
||||||
|
|
||||||
I have no idea why this binding doesn’t work /within/ the =use-package= declaration, but oh well…
|
I have no idea why this binding doesn’t work /within/ the =use-package= declaration, but oh well…
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(ha-leader "TAB" '("workspaces" . hydra-workspace-leader/body))
|
(ha-leader "TAB" '("workspaces" . hydra-workspace-leader/body))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The /special/ perspective is a nice shortcut to the one I use the most:
|
The /special/ perspective is a nice shortcut to the one I use the most:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun ha-switch-to-special ()
|
(defun ha-switch-to-special ()
|
||||||
"Change to the projects perspective."
|
"Change to the projects perspective."
|
||||||
(interactive)
|
(interactive)
|
||||||
(persp-switch "projects"))
|
(persp-switch "projects"))
|
||||||
|
@ -1637,7 +1637,7 @@ The [[https://scripter.co/using-git-delta-with-magit][magit-delta]] project uses
|
||||||
#+end_src
|
#+end_src
|
||||||
I also need to append the following to my [[file:~/.gitconfig][~/.gitconfig]] file:
|
I also need to append the following to my [[file:~/.gitconfig][~/.gitconfig]] file:
|
||||||
#+begin_src conf
|
#+begin_src conf
|
||||||
[delta]
|
[delta]
|
||||||
minus-style = normal "#8f0001"
|
minus-style = normal "#8f0001"
|
||||||
minus-non-emph-style = normal "#8f0001"
|
minus-non-emph-style = normal "#8f0001"
|
||||||
minus-emph-style = normal bold "#d01011"
|
minus-emph-style = normal bold "#d01011"
|
||||||
|
@ -1780,7 +1780,7 @@ What's left is integrating the new show and diff commands in Magit. For that pur
|
||||||
*** Time Machine
|
*** Time Machine
|
||||||
The [[https://github.com/emacsmirror/git-timemachine][git-timemachine]] project visually shows how a code file changes with each iteration:
|
The [[https://github.com/emacsmirror/git-timemachine][git-timemachine]] project visually shows how a code file changes with each iteration:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package git-timemachine
|
(use-package git-timemachine
|
||||||
:config
|
:config
|
||||||
(ha-leader "g t" '("git timemachine" . git-timemachine)))
|
(ha-leader "g t" '("git timemachine" . git-timemachine)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
@ -1839,18 +1839,18 @@ Every /so often/, pop over to the following URLs and generate a new token where
|
||||||
- [[https://github.com/settings/tokens][Github]]
|
- [[https://github.com/settings/tokens][Github]]
|
||||||
and make sure this works:
|
and make sure this works:
|
||||||
|
|
||||||
#+begin_src emacs-lisp :tangle no :results replace
|
#+begin_src emacs-lisp :tangle no :results replace
|
||||||
(ghub-request "GET" "/user" nil
|
(ghub-request "GET" "/user" nil
|
||||||
:forge 'github
|
:forge 'github
|
||||||
:host "api.github.com"
|
:host "api.github.com"
|
||||||
:username "howardabrams"
|
:username "howardabrams"
|
||||||
:auth 'forge)
|
:auth 'forge)
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Pushing is Bad
|
*** Pushing is Bad
|
||||||
Pushing directly to the upstream branch is /bad form/, as one should create a pull request, etc. To prevent an accidental push, we /double-check/ first:
|
Pushing directly to the upstream branch is /bad form/, as one should create a pull request, etc. To prevent an accidental push, we /double-check/ first:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(define-advice magit-push-current-to-upstream (:before (args) query-yes-or-no)
|
(define-advice magit-push-current-to-upstream (:before (args) query-yes-or-no)
|
||||||
"Prompt for confirmation before permitting a push to upstream."
|
"Prompt for confirmation before permitting a push to upstream."
|
||||||
(when-let ((branch (magit-get-current-branch)))
|
(when-let ((branch (magit-get-current-branch)))
|
||||||
(unless (yes-or-no-p (format "Push %s branch upstream to %s? "
|
(unless (yes-or-no-p (format "Push %s branch upstream to %s? "
|
||||||
|
|
Loading…
Reference in a new issue