Change `:straight-if` to `:straight-when`

`:straight-when` is a more accurate representation of what it's doing.  I also
found out that I could change its indentation, which I did.
This commit is contained in:
Case Duckworth 2021-10-05 14:22:18 -05:00
parent 24fee83cc0
commit 66ecd92944
3 changed files with 66 additions and 63 deletions

32
init.el
View File

@ -974,7 +974,7 @@ specific to most general, they are these:
:repo "willvaughn/emacs-0x0"))
(:option 0x0-default-server 'ttm))
(setup (:straight-if affe
(setup (:straight-when affe
(and (or (executable-find "fd")
(executable-find "find"))
(executable-find "rg")))
@ -984,7 +984,7 @@ specific to most general, they are these:
(setq input (orderless-pattern-compiler input))
(cons input (lambda (str) (orderless--highlight input str))))))
(setup (:straight-if ahk-mode
(setup (:straight-when ahk-mode
(acdw/system :work)))
(setup (:straight alert)
@ -1221,7 +1221,7 @@ specific to most general, they are these:
(crux-reopen-as-root-mode +1))
(setup (:straight-if (define-repeat-map
(setup (:straight-when (define-repeat-map
:host nil
:repo "https://tildegit.org/acdw/define-repeat-map.el")
(acdw/system :home))
@ -1448,7 +1448,7 @@ specific to most general, they are these:
(add-hook hook #'epithet-rename-buffer)))
;; TODO: look into emms or something related for this
(setup (:straight-if eradio
(setup (:straight-when eradio
(executable-find "mpv"))
(:option
eradio-player '("mpv" "--no-video" "--no-terminal")
@ -1491,7 +1491,7 @@ specific to most general, they are these:
(:hook-into emacs-lisp-mode
lisp-interaction-mode))
(setup (:straight-if exec-path-from-shell
(setup (:straight-when exec-path-from-shell
(acdw/system :home))
(when (daemonp)
(exec-path-from-shell-initialize)))
@ -1499,7 +1499,7 @@ specific to most general, they are these:
(setup (:straight expand-region)
(:global "C-=" #'er/expand-region))
(setup (:straight-if fennel-mode
(setup (:straight-when fennel-mode
(executable-find "fennel"))
(:autoload (fennel-repl :interactive t))
(:file-match (rx ".fnl" eos)))
@ -1517,7 +1517,7 @@ specific to most general, they are these:
(flyspell-correct-move 0 :forward :rapid))))
(:unbind "C-;" "C-," "C-." "C-M-i")))
(setup (:straight-if forge
(setup (:straight-when forge
(acdw/system :home))
;; make sure to read Info manual with Forge (and Ghub) for setup
;; instructions.
@ -1531,7 +1531,7 @@ specific to most general, they are these:
(:option gcmh-idle-delay 'auto)
(gcmh-mode +1))
(setup (:straight-if geiser
(setup (:straight-when geiser
(progn
(defvar acdw/schemes
(let (schemes)
@ -1637,7 +1637,7 @@ specific to most general, they are these:
(setup (:straight lacarte)
(:global "<f10>" #'lacarte-execute-menu-command))
(setup (:straight-if ledger-mode
(setup (:straight-when ledger-mode
(executable-find "ledger")))
(setup (:straight link-hint)
@ -2110,7 +2110,7 @@ the default is \"/\"."
lisp-interaction-mode
scheme-mode))
(setup (:straight-if (pdf-tools
(setup (:straight-when (pdf-tools
:host github
:repo "vedang/pdf-tools")
(acdw/system :home))
@ -2200,7 +2200,7 @@ the default is \"/\"."
(simple-modeline-mode +1))
(setup (:straight-if sly
(setup (:straight-when sly
(progn
(defvar acdw/lisps
(let (lisps)
@ -2289,7 +2289,7 @@ the default is \"/\"."
(auto-save-visited-mode -1)
(super-save-mode +1))
(setup (:straight-if systemd
(setup (:straight-when systemd
(executable-find "systemd")))
(setup (:straight (topsy
@ -2404,7 +2404,7 @@ If used with a numeric prefix argument N, N backticks will be inserted."
(setup (:straight visual-regexp)
(:global "M-%" #'vr/query-replace))
(setup (:straight-if vterm
(setup (:straight-when vterm
(acdw/system :home))
(:straight (eshell-vterm
:host github
@ -2461,11 +2461,13 @@ If used with a numeric prefix argument N, N backticks will be inserted."
(setup (:straight xr))
(setup (:straight-if ytel
(setup (:straight-when ytel
(executable-find "mpv"))
(:also-load acdw-ytel)
;; This might need to be changed depending on whether the instance goes down.
(:option ytel-invidious-api-url "https://invidious.snopyta.org")
(:bind "v" #'acdw/ytel-current-video-link
(:hook #'hl-line-mode)
(:bind "v" #'acdw/ytel-watch
"w" #'acdw/ytel-copy-link))
(setup (:straight zzz-to-char)

View File

@ -72,7 +72,7 @@ first RECIPE's package."
(car recipe)
recipe))))
(setup-define :straight-if
(setup-define :straight-when
(lambda (recipe condition)
`(if ,condition
(straight-use-package ',recipe)
@ -83,6 +83,7 @@ If CONDITION is false, stop evaluating the body. This macro can
be used as HEAD, and will replace itself with the RECIPE's
package. This macro is not repeatable."
:repeatable nil
:indent 1
:shorthand (lambda (sexp)
(let ((recipe (cadr sexp)))
(if (consp recipe) (car recipe) recipe))))

View File

@ -352,7 +352,7 @@ In short, DO NOT USE THIS FUNCTION!!!"
(cond
;; Straight forms require some weirdness
((and s1-straight s2-straight)
(let* ((r (rx ":straight" (? "-if") (* space) (? "(")))
(let* ((r (rx ":straight" (? "-when") (* space) (? "(")))
(s1 (replace-regexp-in-string r "" s1))
(s2 (replace-regexp-in-string r "" s2)))
(string< s1 s2)))