about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-10-05 20:20:42 -0500
committerCase Duckworth2021-10-05 20:20:42 -0500
commit352f18559ca2f583ecbf161fb3f938952d7e26c4 (patch)
tree87396b090282d15405699c70e6a0f7613f236b83 /lisp
parentCorrect bug (diff)
parentReplace ytel with ytdious (diff)
downloademacs-352f18559ca2f583ecbf161fb3f938952d7e26c4.tar.gz
emacs-352f18559ca2f583ecbf161fb3f938952d7e26c4.zip
Merge branch 'main' of github.com:duckwork/.emacs.d
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-modeline.el2
-rw-r--r--lisp/acdw-setup.el3
-rw-r--r--lisp/acdw-ytel.el44
-rw-r--r--lisp/acdw.el28
4 files changed, 72 insertions, 5 deletions
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."
147 (5 " C%C"))) 147 (5 " C%C")))
148 " ")) 148 " "))
149 (file-percentage-mode 149 (file-percentage-mode
150 (7 "%p%% ")) 150 ((-3 "%p") "%% "))
151 ,(if (region-active-p) 151 ,(if (region-active-p)
152 (propertize (format "%s%-5d" 152 (propertize (format "%s%-5d"
153 (if (and (mark) 153 (if (and (mark)
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."
72 (car recipe) 72 (car recipe)
73 recipe)))) 73 recipe))))
74 74
75(setup-define :straight-if 75(setup-define :straight-when
76 (lambda (recipe condition) 76 (lambda (recipe condition)
77 `(if ,condition 77 `(if ,condition
78 (straight-use-package ',recipe) 78 (straight-use-package ',recipe)
@@ -83,6 +83,7 @@ If CONDITION is false, stop evaluating the body. This macro can
83be used as HEAD, and will replace itself with the RECIPE's 83be used as HEAD, and will replace itself with the RECIPE's
84package. This macro is not repeatable." 84package. This macro is not repeatable."
85 :repeatable nil 85 :repeatable nil
86 :indent 1
86 :shorthand (lambda (sexp) 87 :shorthand (lambda (sexp)
87 (let ((recipe (cadr sexp))) 88 (let ((recipe (cadr sexp)))
88 (if (consp recipe) (car recipe) recipe)))) 89 (if (consp recipe) (car recipe) recipe))))
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 @@
7 7
8;;; Code: 8;;; Code:
9 9
10(require 'ytel) 10(require 'ytel nil t)
11 11
12(defun acdw/ytel-current-video-link () 12(defun acdw/ytel-current-video-link ()
13 "Get the link of the video at point." 13 "Get the link of the video at point."
14 (let* ((video (ytel-get-current-video)) 14 (let* ((video (ytel-get-current-video))
15 (id (ytel-video-id video))) 15 (id (ytel-video-id video)))
16 (concat "https://www.youtube.com/watch?v=" id))) 16 (concat "https://www.youtube.com/watch?v=" id)))
17 17
18(defun acdw/ytel-watch () ; This could possibly use `browse-url'. 18(defun acdw/ytel-watch () ; This could possibly use `browse-url'.
@@ -31,5 +31,45 @@
31 (kill-new link) 31 (kill-new link)
32 (message "Copied %s to kill-ring" link))) 32 (message "Copied %s to kill-ring" link)))
33 33
34
35;;; YTDIOUS: https://github.com/spiderbit/ytdious
36;; a fork of ytel that uses table-view or w/e. looks nicer
37
38(require 'ytdious nil t)
39
40(defun acdw/ytdious-current-video-link ()
41 "Get the link of the video at point."
42 (let* ((video (ytdious-get-current-video))
43 (id (ytdious-video-id-fun video)))
44 (concat "https://www.youtube.com/watch?v=" id)))
45
46(defun acdw/ytdious-watch () ; This could possibly use `browse-url'.
47 "Stream video at point in mpv."
48 (interactive)
49 (let ((link (acdw/ytdious-current-video-link)))
50 (start-process "ytdious mpv" nil
51 "mpv"
52 link
53 "--ytdl-format=bestvideo[height<=?720]+bestaudio/best")
54 (message "Streaming %s..." link)))
55
56(defun acdw/ytdious-copy-link ()
57 "Copy link of the video at point."
58 (interactive)
59 (let ((link (acdw/ytdious-current-video-link)))
60 (kill-new link)
61 (message "Copied %s to kill-ring" link)))
62
63(defun acdw/ytdious-quit ()
64 "Quit ytdious."
65 ;; This corrects an error with `ytdious-quit' where it doesn't have the right
66 ;; buffer setup.
67 (interactive)
68 (quit-window))
69
70;;; Ignore `ytdious-show-image-asyncron' because it's buggy.
71
72(defalias 'ytdious-show-image-asyncron #'ignore)
73
34(provide 'acdw-ytel) 74(provide 'acdw-ytel)
35;;; acdw-ytel.el ends here 75;;; acdw-ytel.el ends here
diff --git a/lisp/acdw.el b/lisp/acdw.el index 792b9ef..969b6c8 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -352,7 +352,7 @@ In short, DO NOT USE THIS FUNCTION!!!"
352 (cond 352 (cond
353 ;; Straight forms require some weirdness 353 ;; Straight forms require some weirdness
354 ((and s1-straight s2-straight) 354 ((and s1-straight s2-straight)
355 (let* ((r (rx ":straight" (? "-if") (* space) (? "("))) 355 (let* ((r (rx ":straight" (? "-when") (* space) (? "(")))
356 (s1 (replace-regexp-in-string r "" s1)) 356 (s1 (replace-regexp-in-string r "" s1))
357 (s2 (replace-regexp-in-string r "" s2))) 357 (s2 (replace-regexp-in-string r "" s2)))
358 (string< s1 s2))) 358 (string< s1 s2)))
@@ -793,6 +793,32 @@ This function is internal. Use `acdw/make-password-fetcher' instead."
793 (insert "💩") 793 (insert "💩")
794 (setq n (1- n))))) 794 (setq n (1- n)))))
795 795
796(defun spongebob-case-region (beg end)
797 "Make region, defined by BEG and END, lOoK lIkE tHiS."
798 (interactive "*r")
799 (save-excursion
800 (let (case)
801 (goto-char beg)
802 (while (< (point) end)
803 (if (looking-at "[[:alpha:]]")
804 (if (setq case (not case))
805 (upcase-region (point) (progn (forward-char 1) (point)))
806 (downcase-region (point) (progn (forward-char 1) (point))))
807 (forward-char 1))))))
808
809(defun spongebob-case-word (n)
810 "Spongebob-case N words forward, beginning at point, moving over."
811 (interactive "*p")
812 (spongebob-case-region (point) (progn (forward-word n) (point))))
813
814(defun spongebob-case-dwim (arg)
815 "Spongebob-case words in the region if active, else word at point.
816If ARG exists, it's passed to `spongebob-case-word'."
817 (interactive "*p")
818 (if (use-region-p)
819 (spongebob-case-region (region-beginning) (region-end))
820 (spongebob-case-word arg)))
821
796 822
797;;; Fat finger solutions 823;;; Fat finger solutions
798(defun acdw/fat-finger-exit (&optional prefix) 824(defun acdw/fat-finger-exit (&optional prefix)