From 803ce1550a2eca1f1af591e858c1d35058abd0ea Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 08:32:32 -0500 Subject: Add TODOs --- TODO.org | 92 ++++++++++++++++++++++++---------------------------------------- 1 file changed, 35 insertions(+), 57 deletions(-) diff --git a/TODO.org b/TODO.org index 358320b..081ba03 100644 --- a/TODO.org +++ b/TODO.org @@ -99,36 +99,25 @@ e.g., “A gold watch” title-cases to “A gold Watch” *** Inspo: From wsinatra #+begin_src emacs-lisp - ;; Custom capture templates - (setq org-capture-templates - '(("t" "Todo" entry (file org-default-notes-file) - "* TODO %?\n%u\n%a\n" :clock-in t :clock-resume t) - ("e" "Event" entry (file org-default-notes-file) - "* EVENT %? :EVENT:\n%t" :clock-in t :clock-resume t) - ("i" "Idea" entry (file org-default-notes-file) - "* %? :IDEA: \n%t" :clock-in t :clock-resume t) - ("p" "Project" entry (file org-default-notes-file) - "* PROJ %?\n%u\n%a\n" :clock-in t :clock-resume t) - ("n" "Next Task" entry (file+headline - org-default-notes-file "Tasks") - "** NEXT %? \nDEADLINE: %t"))) -#+end_src + ;; Custom capture templates (setq org-capture-templates '(("t" "Todo" entry + (file org-default-notes-file) "* TODO %?\n%u\n%a\n" :clock-in t :clock-resume + t) ("e" "Event" entry (file org-default-notes-file) "* EVENT %? :EVENT:\n%t" + :clock-in t :clock-resume t) ("i" "Idea" entry (file org-default-notes-file) + "* %? :IDEA: \n%t" :clock-in t :clock-resume t) ("p" "Project" entry (file + org-default-notes-file) "* PROJ %?\n%u\n%a\n" :clock-in t :clock-resume t) + ("n" "Next Task" entry (file+headline org-default-notes-file "Tasks") "** + NEXT %? \nDEADLINE: %t"))) #+end_src *** Also cf. [[https://blog.jethro.dev/posts/org_mode_workflow_preview/][Org-mode Workflow: A Preview · Jethro Kuan]] * Buffer display stuff #+begin_src emacs-lisp - ;; from alphapapa - (cl-defun ap/display-buffer-in-side-window (&optional (buffer (current-buffer))) - "Display BUFFER in dedicated side window." - (interactive) - (let ((display-buffer-mark-dedicated t)) - (display-buffer-in-side-window buffer - '((side . right) - (window-parameters - (no-delete-other-windows . t)))))) -#+end_src + ;; from alphapapa (cl-defun ap/display-buffer-in-side-window (&optional + (buffer (current-buffer))) "Display BUFFER in dedicated side window." + (interactive) (let ((display-buffer-mark-dedicated t)) + (display-buffer-in-side-window buffer '((side . right) (window-parameters + (no-delete-other-windows . t)))))) #+end_src - [[https://old.reddit.com/r/emacs/comments/pka1sm/my_first_package_aside_for_easier_configuration/][My first package: Aside, for easier configuration and use of side windows : emacs]] @@ -148,43 +137,30 @@ e.g., “A gold watch” title-cases to “A gold Watch” ** A way to map over buffers #+begin_src emacs-lisp - (dolist (buf (mapcan (lambda (buf) - (with-current-buffer buf - (circe-server-chat-buffers))) - (circe-server-buffers))) - (with-current-buffer buf - ;; whatever u wanna do on each buffer goes here - (lui-set-prompt - (concat (propertize (acdw-irc/margin-format (buffer-name) - "" - ">") - 'face 'circe-prompt-face - 'read-only t 'intangible t - 'cursor-intangible t) - " ")) - (setq-local fringes-outside-margins t - right-margin-width 5 - scroll-margin 0 - word-wrap t - wrap-prefix (repeat-string - acdw-irc/left-margin " ") - line-number-mode nil))) -#+end_src + (dolist (buf (mapcan (lambda (buf) (with-current-buffer buf + (circe-server-chat-buffers))) (circe-server-buffers))) + (with-current-buffer buf ;; whatever u wanna do on + each buffer goes here (lui-set-prompt (concat + (propertize (acdw-irc/margin-format (buffer-name) "" + ">") 'face 'circe-prompt-face 'read-only t 'intangible + t 'cursor-intangible t) " ")) (setq-local + fringes-outside-margins t right-margin-width 5 + scroll-margin 0 word-wrap t wrap-prefix (repeat-string + acdw-irc/left-margin " ") line-number-mode nil))) + #+end_src ** ZNC Connecting (from #systemcrafters) #+begin_quote -daviwil | minikN: I connect to the hostname/port of my ZNC server, - but the trick is that the username is the nick you want to - use on the server and the password is your znc username - and password joined with a colon, like daviwil:b4dp4ssw0rd - minikN | so you don't specify the network in your password? like - user/network:password? - benoitj | daviwil: nice password you have there - daviwil | minikN: nope, I only have one network anyway +daviwil | minikN: I connect to the hostname/port of my ZNC server, but the + trick is that the username is the nick you want to use on the + server and the password is your znc username and password joined + with a colon, like daviwil:b4dp4ssw0rd minikN | so you don't + specify the network in your password? like user/network:password? + benoitj | daviwil: nice password you have there daviwil | minikN: + nope, I only have one network anyway - acdw > daviwil: I just see ******* - benoitj | I use two networks -#+end_quote + benoitj | I use two networks #+end_quote ** Teach =link-hint= about =lui-buttons= @@ -204,6 +180,8 @@ https://tildegit.org/acdw/emacs/src/branch/main/init.el#L1166, e.g. - *OR* install this: [[https://github.com/sshaw/git-link][GitHub - sshaw/git-link: Emacs package to get the GitHub/Bitbucket/GitLab/... URL for a buffer location]] -** Fix =acdw-org/count-words-stupidly= +** DONE Fix =acdw-org/count-words-stupidly= It adds one for blank lines. + +** TODO [[https://stackoverflow.com/questions/25161792/emacs-org-mode-how-can-i-fold-everything-but-the-current-headline][Org mode hide all but current heading]] -- cgit 1.4.1-21-gabe81 From 3dd81b2efe906f664c0bca802058e525ed322a87 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 08:32:54 -0500 Subject: Add spongebob-case Studlify is ... too complicated. --- init.el | 8 ++------ lisp/acdw.el | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/init.el b/init.el index 52eab26..a810370 100644 --- a/init.el +++ b/init.el @@ -386,16 +386,12 @@ (:with-map case-map (require 'titlecase) + (require 'acdw) (:bind "c" #'capitalize-dwim "t" #'titlecase-dwim "u" #'upcase-dwim "l" #'downcase-dwim - "s" (defun studlify-dwim (count) - "Studlify region if active, or COUNT words if not." - (interactive "*p") - (if (region-active-p) - (studlify-region (region-beginning) (region-end)) - (studlify-word count))))) + "s" #'spongebob-case-dwim)) (add-hook 'after-make-frame-functions (defun after-make-frame@maximize (frame) diff --git a/lisp/acdw.el b/lisp/acdw.el index 792b9ef..e013fbc 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -793,6 +793,32 @@ This function is internal. Use `acdw/make-password-fetcher' instead." (insert "💩") (setq n (1- n))))) +(defun spongebob-case-region (beg end) + "Make region, defined by BEG and END, lOoK lIkE tHiS." + (interactive "*r") + (save-excursion + (let (case) + (goto-char beg) + (while (< (point) end) + (if (looking-at "[[:alpha:]]") + (if (setq case (not case)) + (upcase-region (point) (progn (forward-char 1) (point))) + (downcase-region (point) (progn (forward-char 1) (point)))) + (forward-char 1)))))) + +(defun spongebob-case-word (n) + "Spongebob-case N words forward, beginning at point, moving over." + (interactive "*p") + (spongebob-case-region (point) (progn (forward-word n) (point)))) + +(defun spongebob-case-dwim (arg) + "Spongebob-case words in the region if active, else word at point. +If ARG exists, it's passed to `spongebob-case-word'." + (interactive "*p") + (if (use-region-p) + (spongebob-case-region (region-beginning) (region-end)) + (spongebob-case-word arg))) + ;;; Fat finger solutions (defun acdw/fat-finger-exit (&optional prefix) -- cgit 1.4.1-21-gabe81 From 007be7aa3da6aad2618feec3043ec0e12902b599 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 08:33:16 -0500 Subject: Correct percentage display in modeline --- lisp/acdw-modeline.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 21068bd..573a964 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el @@ -147,7 +147,7 @@ is, if point < mark." (5 " C%C"))) " ")) (file-percentage-mode - (7 "%p%% ")) + ((-3 "%p") "%% ")) ,(if (region-active-p) (propertize (format "%s%-5d" (if (and (mark) -- cgit 1.4.1-21-gabe81 From d8d2f5d06db7a9a9eded187e7bc7a110ff3aa56a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 08:33:36 -0500 Subject: Add lines to pulse --- init.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/init.el b/init.el index a810370..106393d 100644 --- a/init.el +++ b/init.el @@ -737,11 +737,12 @@ specific to most general, they are these: "Pulse the current line." (pulse-momentary-highlight-one-line (point))) - (dolist (command '(scroll-up-command - scroll-down-command - recenter-top-bottom other-window - switch-to-buffer)) - (advice-add command :after #'pulse-line))) + (dolist (func '(scroll-up-command + scroll-down-command + recenter-top-bottom other-window + switch-to-buffer + redraw-frame)) + (advice-add func :after #'pulse-line))) (setup re-builder (require 'acdw-re) -- cgit 1.4.1-21-gabe81 From 496951513d7ab35c43e6591d3d967c561a40de2c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 08:34:24 -0500 Subject: Customize random stuff --- init.el | 69 +++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/init.el b/init.el index 106393d..2a6bbcb 100644 --- a/init.el +++ b/init.el @@ -681,7 +681,7 @@ specific to most general, they are these: (:option mouse-1-click-follows-link t)) (setup mouse-avoidance - (mouse-avoidance-mode 'exile)) + (mouse-avoidance-mode 'banish)) (setup page (:option page-delimiter @@ -1222,8 +1222,8 @@ specific to most general, they are these: (crux-reopen-as-root-mode +1)) (setup (:straight-if (define-repeat-map - :host nil - :repo "https://tildegit.org/acdw/define-repeat-map.el") + :host nil + :repo "https://tildegit.org/acdw/define-repeat-map.el") (acdw/system :home)) (require 'define-repeat-map ; just for me @@ -1746,7 +1746,7 @@ browser defined in `browse-url-secondary-browser-function'." (:option modus-themes-slanted-constructs t modus-themes-bold-constructs t modus-themes-fringes nil - modus-themes-mode-line '(borderless moody) + modus-themes-mode-line '(borderless) modus-themes-region '(bg-only) modus-themes-org-blocks 'gray-background modus-themes-headings '((t . (background))) @@ -1904,7 +1904,7 @@ browser defined in `browse-url-secondary-browser-function'." (:option org-adapt-indentation nil org-agenda-files nil ; only until I set this up org-catch-invisible-edits 'show-and-error - org-clock-clocked-in-display 'frame-title + org-clock-clocked-in-display 'mode-line org-clock-frame-title-format (cons '(t org-mode-line-string) (cons " --- " frame-title-format)) ;;org-clock-string-limit 7 ; gives time and not title @@ -1953,32 +1953,40 @@ browser defined in `browse-url-secondary-browser-function'." (:unbind "C-j" ; org-return-and-maybe-indent "M-j") + + (:local-set unfill-fill-function #'org-fill-paragraph) (with-eval-after-load 'org-export (:option (append org-export-filter-final-output-functions) #'org-export-remove-zero-width-spaces)) - (:hook #'variable-pitch-mode - - ;; This is super ugly because I need to add a function to - ;; `before-save-hook', but only in org-mode buffers. So I make a hook - ;; to make a hook. I'm sure there's a better way to do this. - (defun org-mode@fix-blank-lines-on-save () - (add-hook 'before-save-hook - (defun acdw-org/fix-blank-lines-in-buffer () - (acdw-org/fix-blank-lines t)) - 0 :local)) - - (defun org-mode@wc-stupid () - (unless (and wc-mode - (> 0 (+ (or wc-orig-words 0) - (or wc-words-delta 0))))) - (setq-local - wc-count-words-function - (lambda (start end) "Count words stupidly with a limit." - (acdw-org/count-words-stupidly start - end - 999))))) + (:hook ;; #'variable-pitch-mode + + ;; (defun org-mode@before-save@fill-buffer () + ;; (add-hook 'before-save-hook + ;; (defun before-save@fill-buffer () + ;; (fill-region (point-min) (point-max))) + ;; nil :local)) + + ;; This is super ugly because I need to add a function to + ;; `before-save-hook', but only in org-mode buffers. So I make a hook + ;; to make a hook. I'm sure there's a better way to do this. + (defun org-mode@fix-blank-lines-on-save () + (add-hook 'before-save-hook + (defun acdw-org/fix-blank-lines-in-buffer () + (acdw-org/fix-blank-lines t)) + 0 :local)) + + (defun org-mode@wc-stupid () + (unless (and wc-mode + (> 0 (+ (or wc-orig-words 0) + (or wc-words-delta 0))))) + (setq-local + wc-count-words-function + (lambda (start end) "Count words stupidly with a limit." + (acdw-org/count-words-stupidly start + end + 999))))) (with-eval-after-load 'org (org-clock-persistence-insinuate)) @@ -2257,7 +2265,10 @@ the default is \"/\"." (smartparens-strict-mode 1)) (:bind "C-M-q" #'sp-indent-defun - "M-r" #'sp-rewrap-sexp)) + "M-r" #'sp-rewrap-sexp) + (:unbind "M-j" ; sp-join-sexp + )) + (setup (:straight ssh-config-mode) (:file-match (rx "/.ssh/config" eos) (rx "/ssh" (? "d") "_config" eos)) @@ -2341,7 +2352,9 @@ If used with a numeric prefix argument N, N backticks will be inserted." (global-undo-fu-session-mode +1)) -(setup (:straight unfill)) +(setup (:straight (unfill :host github :repo "purcell/unfill" + :fork (:host github :repo "duckwork/unfill"))) + (:global "M-q" #'unfill-toggle)) (setup (:straight (unfocused :host github -- cgit 1.4.1-21-gabe81 From 24fee83cc0987bd4c08214e67a9690611ed9a4d5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 14:20:39 -0500 Subject: Don't pulse line --- init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 2a6bbcb..83486c8 100644 --- a/init.el +++ b/init.el @@ -729,10 +729,10 @@ specific to most general, they are these: (turn-on-auto-fill)))) (setup pulse - (:option pulse-flag t + (:option pulse-flag nil pulse-delay 0.5 pulse-iterations 1) - + (defun pulse-line (&rest _) "Pulse the current line." (pulse-momentary-highlight-one-line (point))) -- cgit 1.4.1-21-gabe81 From 66ecd92944d7d169c0760402f7b8fd0a2f255958 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 14:22:18 -0500 Subject: 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. --- init.el | 124 +++++++++++++++++++++++++++-------------------------- lisp/acdw-setup.el | 3 +- lisp/acdw.el | 2 +- 3 files changed, 66 insertions(+), 63 deletions(-) diff --git a/init.el b/init.el index 83486c8..32f48fb 100644 --- a/init.el +++ b/init.el @@ -974,18 +974,18 @@ specific to most general, they are these: :repo "willvaughn/emacs-0x0")) (:option 0x0-default-server 'ttm)) -(setup (:straight-if affe - (and (or (executable-find "fd") - (executable-find "find")) - (executable-find "rg"))) +(setup (:straight-when affe + (and (or (executable-find "fd") + (executable-find "find")) + (executable-find "rg"))) ;; Keys are bound in `acdw/sensible-grep' and `acdw/sensible-find' (:option affe-regexp-compiler (defun affe-orderless-regexp-compiler (input _type) (setq input (orderless-pattern-compiler input)) (cons input (lambda (str) (orderless--highlight input str)))))) -(setup (:straight-if ahk-mode - (acdw/system :work))) +(setup (:straight-when ahk-mode + (acdw/system :work))) (setup (:straight alert) (:option alert-default-style (acdw/system @@ -1221,10 +1221,10 @@ specific to most general, they are these: (crux-reopen-as-root-mode +1)) -(setup (:straight-if (define-repeat-map - :host nil - :repo "https://tildegit.org/acdw/define-repeat-map.el") - (acdw/system :home)) +(setup (:straight-when (define-repeat-map + :host nil + :repo "https://tildegit.org/acdw/define-repeat-map.el") + (acdw/system :home)) (require 'define-repeat-map ; just for me (acdw/dir @@ -1448,8 +1448,8 @@ 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 - (executable-find "mpv")) +(setup (:straight-when eradio + (executable-find "mpv")) (:option eradio-player '("mpv" "--no-video" "--no-terminal") eradio-channels `(("KLSU" . @@ -1491,16 +1491,16 @@ specific to most general, they are these: (:hook-into emacs-lisp-mode lisp-interaction-mode)) -(setup (:straight-if exec-path-from-shell - (acdw/system :home)) +(setup (:straight-when exec-path-from-shell + (acdw/system :home)) (when (daemonp) (exec-path-from-shell-initialize))) (setup (:straight expand-region) (:global "C-=" #'er/expand-region)) -(setup (:straight-if fennel-mode - (executable-find "fennel")) +(setup (:straight-when fennel-mode + (executable-find "fennel")) (:autoload (fennel-repl :interactive t)) (:file-match (rx ".fnl" eos))) @@ -1517,8 +1517,8 @@ specific to most general, they are these: (flyspell-correct-move 0 :forward :rapid)))) (:unbind "C-;" "C-," "C-." "C-M-i"))) -(setup (:straight-if forge - (acdw/system :home)) +(setup (:straight-when forge + (acdw/system :home)) ;; make sure to read Info manual with Forge (and Ghub) for setup ;; instructions. (with-eval-after-load 'magit @@ -1531,26 +1531,26 @@ specific to most general, they are these: (:option gcmh-idle-delay 'auto) (gcmh-mode +1)) -(setup (:straight-if geiser - (progn - (defvar acdw/schemes - (let (schemes) - (dolist (scheme '(("scheme" . geiser-chez) ; chez - ("petite" . geiser-chez) ; petite - ("csi" . geiser-chez) ; chicken - ("gsi" . geiser-gambit) - ("gosh" . geiser-gauche) - ("guile" . geiser-guile) - ("kawa" . geiser-kawa) - ("mit-scheme" . geiser-mit) - ("racket" . geiser-racket) - ("stklos" . geiser-stklos))) - (when-let (binary (executable-find (car scheme))) - (push binary schemes) - ;; and install the proper helper package - (straight-use-package (cdr scheme)))) - (nreverse schemes))) - acdw/schemes)) +(setup (:straight-when geiser + (progn + (defvar acdw/schemes + (let (schemes) + (dolist (scheme '(("scheme" . geiser-chez) ; chez + ("petite" . geiser-chez) ; petite + ("csi" . geiser-chez) ; chicken + ("gsi" . geiser-gambit) + ("gosh" . geiser-gauche) + ("guile" . geiser-guile) + ("kawa" . geiser-kawa) + ("mit-scheme" . geiser-mit) + ("racket" . geiser-racket) + ("stklos" . geiser-stklos))) + (when-let (binary (executable-find (car scheme))) + (push binary schemes) + ;; and install the proper helper package + (straight-use-package (cdr scheme)))) + (nreverse schemes))) + acdw/schemes)) (:file-match (rx ".rkt" eos) (rx ".scm" eos))) @@ -1637,8 +1637,8 @@ specific to most general, they are these: (setup (:straight lacarte) (:global "" #'lacarte-execute-menu-command)) -(setup (:straight-if ledger-mode - (executable-find "ledger"))) +(setup (:straight-when ledger-mode + (executable-find "ledger"))) (setup (:straight link-hint) ;; Browse web URLs with a browser with a prefix argument. @@ -2110,10 +2110,10 @@ the default is \"/\"." lisp-interaction-mode scheme-mode)) -(setup (:straight-if (pdf-tools - :host github - :repo "vedang/pdf-tools") - (acdw/system :home)) +(setup (:straight-when (pdf-tools + :host github + :repo "vedang/pdf-tools") + (acdw/system :home)) (:file-match (rx ".pdf" eos)) (pdf-loader-install)) @@ -2200,16 +2200,16 @@ the default is \"/\"." (simple-modeline-mode +1)) -(setup (:straight-if sly - (progn - (defvar acdw/lisps - (let (lisps) - (dolist (lisp '("sbcl" ; TODO: add more lisps - "clisp")) - (when-let (binary (executable-find lisp)) - (push binary lisps))) - (nreverse lisps))) - acdw/lisps)) +(setup (:straight-when sly + (progn + (defvar acdw/lisps + (let (lisps) + (dolist (lisp '("sbcl" ; TODO: add more lisps + "clisp")) + (when-let (binary (executable-find lisp)) + (push binary lisps))) + (nreverse lisps))) + acdw/lisps)) (:also-load sly-autoloads) (:straight clhs) @@ -2289,8 +2289,8 @@ the default is \"/\"." (auto-save-visited-mode -1) (super-save-mode +1)) -(setup (:straight-if systemd - (executable-find "systemd"))) +(setup (:straight-when systemd + (executable-find "systemd"))) (setup (:straight (topsy :host github @@ -2404,8 +2404,8 @@ 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 - (acdw/system :home)) +(setup (:straight-when vterm + (acdw/system :home)) (:straight (eshell-vterm :host github :repo "iostapyshyn/eshell-vterm")) @@ -2461,11 +2461,13 @@ If used with a numeric prefix argument N, N backticks will be inserted." (setup (:straight xr)) -(setup (:straight-if ytel - (executable-find "mpv")) +(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) diff --git a/lisp/acdw-setup.el b/lisp/acdw-setup.el index eb4d12b..33ab835 100644 --- a/lisp/acdw-setup.el +++ b/lisp/acdw-setup.el @@ -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)))) diff --git a/lisp/acdw.el b/lisp/acdw.el index e013fbc..969b6c8 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -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))) -- cgit 1.4.1-21-gabe81 From 34904710153b93be8bb152614db0c0e63069922a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 14:23:10 -0500 Subject: Add consult-dir --- init.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init.el b/init.el index 32f48fb..31811d7 100644 --- a/init.el +++ b/init.el @@ -1213,6 +1213,15 @@ specific to most general, they are these: (funcall #'vertico-exit)) "TAB" #'vertico-exit)))) +(setup (:straight consult-dir) + (:with-feature project + (:autoload project--read-project-list)) + (:global "C-x C-d" #'consult-dir) + (with-eval-after-load 'vertico + (:with-map vertico-map + (:bind "C-x C-d" #'consult-dir + "C-x C-j" #'consult-dir-jump-file)))) + (setup (:straight crux) (:global "C-o" #'crux-smart-open-line "M-o" #'crux-smart-open-line-above -- cgit 1.4.1-21-gabe81 From 4fe1c79b453499a4cf2d4c1693e65b9703578478 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 14:23:20 -0500 Subject: Change quoting style --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 31811d7..fb6a8c9 100644 --- a/init.el +++ b/init.el @@ -2307,7 +2307,7 @@ the default is \"/\"." (:hook-into prog-mode) (:when-loaded (:option topsy-header-line-format - '(:eval + `(:eval (list (propertize " " 'display -- cgit 1.4.1-21-gabe81 From 3f7a8703edbdc0be14e5dca52dd736d9711c07b7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Oct 2021 14:23:47 -0500 Subject: Replace ytel with ytdious Better interface --- init.el | 13 +++++++------ lisp/acdw-ytel.el | 44 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/init.el b/init.el index fb6a8c9..4ad55a9 100644 --- a/init.el +++ b/init.el @@ -2470,14 +2470,15 @@ If used with a numeric prefix argument N, N backticks will be inserted." (setup (:straight xr)) -(setup (:straight-when ytel +(setup (:straight-when ytdious (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") + (:also-load acdw-ytel) ; so named because I used ytel first + (:option ytdious-invidious-api-url "https://invidious.snopyta.org") (:hook #'hl-line-mode) - (:bind "v" #'acdw/ytel-watch - "w" #'acdw/ytel-copy-link)) + (:global "C-c y" #'ytdious) + (:bind "v" #'acdw/ytdious-watch + "w" #'acdw/ytdious-copy-link + "q" #'acdw/ytdious-quit)) (setup (:straight zzz-to-char) diff --git a/lisp/acdw-ytel.el b/lisp/acdw-ytel.el index 01e6187..276323d 100644 --- a/lisp/acdw-ytel.el +++ b/lisp/acdw-ytel.el @@ -7,12 +7,12 @@ ;;; Code: -(require 'ytel) +(require 'ytel nil t) (defun acdw/ytel-current-video-link () "Get the link of the video at point." (let* ((video (ytel-get-current-video)) - (id (ytel-video-id video))) + (id (ytel-video-id video))) (concat "https://www.youtube.com/watch?v=" id))) (defun acdw/ytel-watch () ; This could possibly use `browse-url'. @@ -31,5 +31,45 @@ (kill-new link) (message "Copied %s to kill-ring" link))) + +;;; YTDIOUS: https://github.com/spiderbit/ytdious +;; a fork of ytel that uses table-view or w/e. looks nicer + +(require 'ytdious nil t) + +(defun acdw/ytdious-current-video-link () + "Get the link of the video at point." + (let* ((video (ytdious-get-current-video)) + (id (ytdious-video-id-fun video))) + (concat "https://www.youtube.com/watch?v=" id))) + +(defun acdw/ytdious-watch () ; This could possibly use `browse-url'. + "Stream video at point in mpv." + (interactive) + (let ((link (acdw/ytdious-current-video-link))) + (start-process "ytdious mpv" nil + "mpv" + link + "--ytdl-format=bestvideo[height<=?720]+bestaudio/best") + (message "Streaming %s..." link))) + +(defun acdw/ytdious-copy-link () + "Copy link of the video at point." + (interactive) + (let ((link (acdw/ytdious-current-video-link))) + (kill-new link) + (message "Copied %s to kill-ring" link))) + +(defun acdw/ytdious-quit () + "Quit ytdious." + ;; This corrects an error with `ytdious-quit' where it doesn't have the right + ;; buffer setup. + (interactive) + (quit-window)) + +;;; Ignore `ytdious-show-image-asyncron' because it's buggy. + +(defalias 'ytdious-show-image-asyncron #'ignore) + (provide 'acdw-ytel) ;;; acdw-ytel.el ends here -- cgit 1.4.1-21-gabe81