summaryrefslogtreecommitdiff
path: root/emacs.org
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-08-31 19:52:09 +0300
committerThanos Apollo <[email protected]>2023-08-31 19:52:09 +0300
commitcd5b396ce6e6132c9c1b894e660af5e4eeff1491 (patch)
tree225e5e55a0eddad34bbff48a1f2ada3b2beb4e70 /emacs.org
parent49deaaf1fbc4213e1a616e10eea4b652a3e5f3af (diff)
emacs: replace setq -> setf
Diffstat (limited to 'emacs.org')
-rwxr-xr-xemacs.org257
1 files changed, 144 insertions, 113 deletions
diff --git a/emacs.org b/emacs.org
index 748d659..6d59ae0 100755
--- a/emacs.org
+++ b/emacs.org
@@ -8,7 +8,7 @@
** Essentials
Set my name and email address
#+begin_src emacs-lisp
- (setq user-full-name "Thanos Apollo"
+ (setf user-full-name "Thanos Apollo"
user-mail-address "[email protected]")
#+end_src
Check the ~$HOSTNAME~ to set a variable for different devices
@@ -19,12 +19,12 @@ Check the ~$HOSTNAME~ to set a variable for different devices
#+end_src
Setup default browser as ~firefox~
#+begin_src emacs-lisp
- (setq browse-url-browser-function 'browse-url-generic
+ (setf browse-url-browser-function 'browse-url-generic
browse-url-generic-program "firefox")
#+end_src
Set backup fails at ~~/Trash~
#+begin_src emacs-lisp
- (setq backup-directory-alist '((".*" . "~/.Trash")))
+ (setf backup-directory-alist '((".*" . "~/.Trash")))
#+end_src
Define essential keybindings
#+begin_src emacs-lisp
@@ -38,7 +38,6 @@ Define essential keybindings
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
#+end_src
-
** Paths
#+begin_src emacs-lisp
;; mu4e
@@ -73,7 +72,7 @@ Request the following packages:
** Installation & activation
Set ~package-archives~, and install packages
#+begin_src emacs-lisp
- (setq package-archives '(("melpa" . "https://melpa.org/packages/")
+ (setf package-archives '(("melpa" . "https://melpa.org/packages/")
("elpa" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
;; Activate all the packages
@@ -84,16 +83,16 @@ Set ~package-archives~, and install packages
(package-install package)))
;; Set and load custom.el
- (setq custom-file (concat user-emacs-directory "custom.el"))
+ (setf custom-file (concat user-emacs-directory "custom.el"))
(load custom-file 'noerror)
#+end_src
* UI Settings
** Basic UI
Fonts and basic appearance settings for each device
#+begin_src emacs-lisp
- (setq inhibit-startup-message t)
- (setq initial-scratch-message nil)
- (setq company-box-icons-alist 'company-box-icons-images)
+ (setf inhibit-startup-message t)
+ (setf initial-scratch-message nil)
+ (setf company-box-icons-alist 'company-box-icons-images)
;; Transparency
(add-to-list 'default-frame-alist '(alpha-background . 90))
(add-to-list 'default-frame-alist '(alpha 90 90))
@@ -116,9 +115,9 @@ Fonts and basic appearance settings for each device
;; Set emojis for emacs 29
(require 'emojify)
- (setq global-emojify-mode 1)
+ (setf global-emojify-mode 1)
- (setq visible-bell t)
+ (setf visible-bell t)
(column-number-mode)
(global-display-line-numbers-mode 1)
@@ -152,7 +151,7 @@ Fonts and basic appearance settings for each device
(doom-modeline-mode 1)
- (setq doom-modeline-height 35)
+ (setf doom-modeline-height 35)
;; Don't display battery-mode on desktop
(if is-zeus
@@ -164,8 +163,8 @@ Fonts and basic appearance settings for each device
(require 'ivy)
(ivy-mode 1)
- ;(setq ivy-use-virtual-buffers t)
- ;(setq enable-recursive-minibuffers t)
+ ;(setf ivy-use-virtual-buffers t)
+ ;(setf enable-recursive-minibuffers t)
(global-set-key (kbd "C-s") 'swiper)
(define-key ivy-minibuffer-map (kbd "TAB") 'ivy-alt-done)
(global-set-key "\C-s" 'swiper)
@@ -189,7 +188,7 @@ Fonts and basic appearance settings for each device
(ivy-rich-mode 1)
(all-the-icons-ivy-rich-mode 1)
- (setq ivy-use-selectable-prompt t)
+ (setf ivy-use-selectable-prompt t)
(global-set-key (kbd "C-c m") 'consult-imenu)
(define-key thanos/applications-map (kbd "t") 'counsel-load-theme)
@@ -205,8 +204,8 @@ Fonts and basic appearance settings for each device
(global-set-key (kbd "C-c C-d") #'helpful-at-point)
(global-set-key (kbd "C-h F") #'helpful-function)
- (setq counsel-describe-function-function #'helpful-callable)
- (setq counsel-describe-variable-function #'helpful-variable)
+ (setf counsel-describe-function-function #'helpful-callable)
+ (setf counsel-describe-variable-function #'helpful-variable)
#+end_src
** Navigation
#+begin_src emacs-lisp
@@ -220,7 +219,7 @@ Fonts and basic appearance settings for each device
** Setup
Generate a random password between 20 and 40 characters
#+begin_src emacs-lisp
- (setq password-store-password-length (+ 20 (random 20)))
+ (setf password-store-password-length (+ 20 (random 20)))
#+end_src
** Pass Launcher
#+begin_src emacs-lisp
@@ -355,6 +354,18 @@ Generate a random password between 20 and 40 characters
(dolist (file files)
(when (string-match-p match file)
(dired-delete-file file t)))))
+
+ (defun dired-rename-capitalize-file ()
+ "Capitalize the base name of the file at point in a dired buffer."
+ (interactive)
+ (let* ((file (dired-get-file-for-visit))
+ (new-file (capitalize (file-name-nondirectory file))))
+ (if (string-prefix-p "." file)
+ (message "Skipping file starting with '.'")
+ (progn
+ (rename-file file (concat (file-name-directory file) new-file))
+ (revert-buffer)
+ (message "Renamed %s to %s" file new-file)))))
#+end_src
** Keybindings
#+begin_src emacs-lisp
@@ -368,7 +379,7 @@ Generate a random password between 20 and 40 characters
** All-the-icons
#+begin_src emacs-lisp
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
- (setq all-the-icons-dired-monochrome 'nil
+ (setf all-the-icons-dired-monochrome 'nil
all-the-icons-dired-v-adjust 0.10)
#+end_src
* Org
@@ -378,14 +389,14 @@ Generate a random password between 20 and 40 characters
(ignore-errors
(make-directory "~/Notes"))
- (setq org-roam-directory "~/Notes"
+ (setf org-roam-directory "~/Notes"
org-roam-dailies-directory "journal/")
(org-roam-db-autosync-enable)
- (setq org-roam-node-display-template (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag)))
+ (setf org-roam-node-display-template (concat "${title:50} "(propertize "${tags:30}" 'face 'org-tag)))
- (setq org-roam-db-node-include-function
+ (setf org-roam-db-node-include-function
(lambda ()
(not (or (member "journal" (org-get-tags))
(member "memorize" (org-get-tags))))))
@@ -422,7 +433,7 @@ Generate a random password between 20 and 40 characters
(define-key org-mode-map (kbd "C-c i") 'org-id-get-create)
;; Templates
- (setq org-roam-capture-templates
+ (setf org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
@@ -435,7 +446,7 @@ Generate a random password between 20 and 40 characters
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS")
:unnarrowed t)))
;; Dailies
- (setq org-roam-dailies-capture-templates
+ (setf org-roam-dailies-capture-templates
'(("d" "default" entry
"* %?"
:target (file+head "%<%Y-%m-%d>.org"
@@ -540,7 +551,7 @@ Generate a random password between 20 and 40 characters
(set-face-foreground face (face-attribute 'default :background)))
(set-face-background 'fringe (face-attribute 'default :background))
- (setq
+ (setf
;; Edit settings
org-auto-align-tags nil
org-tags-column 0
@@ -564,7 +575,7 @@ Generate a random password between 20 and 40 characters
(global-org-modern-mode)
- (setq org-modern-todo nil)
+ (setf org-modern-todo nil)
#+end_src
** Settings
#+begin_src emacs-lisp
@@ -572,7 +583,7 @@ Generate a random password between 20 and 40 characters
(require 'org-download)
;;(require 'org-drill)
- (setq org-directory "~/org/"
+ (setf org-directory "~/org/"
org-agenda-files '("~/org/agenda.org")
org-default-notes-file (expand-file-name "notes.org" org-directory)
org-ellipsis " ▼ "
@@ -611,7 +622,7 @@ Generate a random password between 20 and 40 characters
(defadvice org-edit-src-code (around set-buffer-file-name activate compile)
(let ((file-name (buffer-file-name))) ;; (1)
ad-do-it ;; (2)
- (setq buffer-file-name file-name))) ;; (3)
+ (setf buffer-file-name file-name))) ;; (3)
(org-babel-do-load-languages
'org-babel-load-languages
@@ -619,7 +630,7 @@ Generate a random password between 20 and 40 characters
(python . t)))
- (setq org-structure-template-alist
+ (setf org-structure-template-alist
'(("e" . "src emacs-lisp")
("p" . "src python")
("l" . "src lisp")
@@ -633,7 +644,7 @@ Generate a random password between 20 and 40 characters
#+begin_src emacs-lisp
(when (or (eq is-zeus t)
(eq is-hermes t))
- (setq org-download-screenshot-method "grim -g \"$(slurp)\" %s"))
+ (setf org-download-screenshot-method "grim -g \"$(slurp)\" %s"))
#+end_src
* Memorize
@@ -653,9 +664,9 @@ Generate a random password between 20 and 40 characters
** Settings
#+begin_src emacs-lisp
(require 'markdown-mode)
- (setq markdown-header-scaling t)
+ (setf markdown-header-scaling t)
(add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))
- (setq markdown-command "multimarkdown")
+ (setf markdown-command "multimarkdown")
#+end_src
* DevTools
** Essentials
@@ -670,13 +681,13 @@ Generate a random password between 20 and 40 characters
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(define-key company-active-map (kbd "TAB") 'company-indent-or-complete-common)
- (setq company-idle-delay
+ (setf company-idle-delay
(lambda () (if (company-in-string-or-comment) nil 0.0)))
(require 'company-box)
(add-hook 'company-mode-hook 'company-box-mode)
- (setq indent-tabs-mode nil)
+ (setf indent-tabs-mode nil)
(defun insert-brackets (&optional arg)
(interactive "P")
@@ -687,12 +698,11 @@ Generate a random password between 20 and 40 characters
** Magit
#+begin_src emacs-lisp
(require 'magit)
- (setq magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
+ (setf magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
(define-prefix-command 'thanos/magit)
(global-set-key (kbd "C-c g") 'thanos/magit)
(define-key thanos/magit (kbd "c") 'magit-clone)
#+end_src
-
** Auto-insertions
+ Shell scripting/bash
#+begin_src emacs-lisp
@@ -703,7 +713,7 @@ Generate a random password between 20 and 40 characters
#+end_src
** Emacs lisp
#+begin_src emacs-lisp
- (setq tab-always-indent 'complete)
+ (setf tab-always-indent 'complete)
(add-to-list 'completion-styles 'initials t)
(add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode)
@@ -716,7 +726,7 @@ Generate a random password between 20 and 40 characters
#+end_src
** Common Lisp
#+begin_src emacs-lisp
- (setq inferior-lisp-program "sbcl")
+ (setf inferior-lisp-program "sbcl")
(add-hook 'lisp-mode-hook #'rainbow-delimiters-mode)
(add-hook 'lisp-mode-hook #'company-mode)
(add-hook 'lisp-mode-hook #'display-line-numbers-mode)
@@ -729,24 +739,24 @@ Generate a random password between 20 and 40 characters
** LSP
#+begin_src emacs-lisp
(defun thanos/lsp-mode-setup ()
- (setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
+ (setf lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
(require 'lsp-mode)
(add-hook 'lsp-mode #'thanos/lsp-mode-setup)
- (setq lsp-keymap-prefix "C-c l")
+ (setf lsp-keymap-prefix "C-c l")
(lsp-enable-which-key-integration t)
(require 'lsp-ui)
(add-hook 'lsp-mode 'lsp-ui-mode)
- (setq lsp-ui-doc-position 'bottom)
+ (setf lsp-ui-doc-position 'bottom)
#+end_src
** Python
#+begin_src emacs-lisp
;; set pylsp with lsp-mode
- (setq lsp-pyls-server-command "~/.local/bin/pylsp")
+ (setf lsp-pyls-server-command "~/usr/bin/pylsp")
- ;;(require 'python-mode)
+ (require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-hook 'python-mode 'lsp-deferred)
#+end_src
@@ -760,7 +770,7 @@ Generate a random password between 20 and 40 characters
#+begin_src emacs-lisp
(require 'elfeed)
(require 'elfeed-goodies)
- (setq elfeed-feeds
+ (setf elfeed-feeds
'(("https://hackaday.com/blog/feed/"
hackaday linux)
("https://protesilaos.com/news.xml"
@@ -854,19 +864,19 @@ Create function to watch videos using ~mpv~
(define-key elfeed-search-mode-map (kbd "U") 'elfeed-update)
(define-key thanos/applications-map (kbd "f") 'elfeed)
- (setq elfeed-goodies/entry-pane-size 0.55)
+ (setf elfeed-goodies/entry-pane-size 0.55)
(elfeed-goodies/setup)
#+end_src
-* mu4e
+* mu4e
** Setting up mail
#+begin_src emacs-lisp
(require 'smtpmail)
(require 'mu4e)
- (when is-zeus (setq mu4e-update-interval (* 10 60)))
+ (when is-zeus (setf mu4e-update-interval (* 10 60)))
- (setq mu4e-get-mail-command "mbsync -a")
+ (setf mu4e-get-mail-command "mbsync -a")
(defun set-mu4e-context (context-name full-name mail-address signature)
"Return a mu4e context named CONTEXT-NAME with :match-func matching
@@ -894,16 +904,16 @@ Create function to watch videos using ~mpv~
(mu4e-refile-folder . ,(concat dir-name "/Archive"))
(mu4e-compose-signature . ,signature)))))
;;Fixing duplicate UID errors when using mbsync and mu4e
- (setq mu4e-change-filenames-when-moving t)
+ (setf mu4e-change-filenames-when-moving t)
- (setq mu4e-maildir-shortcuts
+ (setf mu4e-maildir-shortcuts
'(("/Public/Inbox" . ?I)
("/Inbox" . ?i)
("/Sent" . ?s)
("/Emacs/dev" . ?e)
("/Guix/dev" . ?g)))
- (setq mu4e-contexts
+ (setf mu4e-contexts
(list
(make-mu4e-context
:name "Fastmail"
@@ -930,7 +940,7 @@ Create function to watch videos using ~mpv~
(mu4e-refile-folder . "/Archive")
(mu4e-trash-folder . "/Trash")))))
- (setq message-send-mail-function 'smtpmail-send-it
+ (setf message-send-mail-function 'smtpmail-send-it
smtpmail-smtp-server "smtp.fastmail.com"
smtpmail-smtp-service 465
smtpmail-stream-type 'ssl
@@ -938,7 +948,7 @@ Create function to watch videos using ~mpv~
mu4e-compose-context-policy 'ask
mu4e-compose-format-flowed t)
- (setq mu4e-view-actions
+ (setf mu4e-view-actions
(delete-dups
(append
'(("gapply git patches" . mu4e-action-git-apply-patch)
@@ -950,7 +960,7 @@ Create function to watch videos using ~mpv~
#+end_src
** Actions
#+begin_src emacs-lisp
- (setq mu4e-view-actions
+ (setf mu4e-view-actions
(delete-dups
(append
'(("gapply git patches" . mu4e-action-git-apply-patch)
@@ -973,7 +983,7 @@ Create function to watch videos using ~mpv~
* Eshell
** Configuration with Eat
#+begin_src emacs-lisp
- (setq eshell-visual-commands '())
+ (setf eshell-visual-commands '())
(eat-eshell-mode 1)
#+end_src
** Environment
@@ -1044,7 +1054,7 @@ Create function to watch videos using ~mpv~
#+end_src
** Aliases & Paths
#+begin_src emacs-lisp
- (setq thanos/eshell-aliases
+ (setf thanos/eshell-aliases
'((g . magit)
(gl . magit-log)
(d . dired)
@@ -1068,25 +1078,25 @@ Create function to watch videos using ~mpv~
(defun eshell-git-prompt-multiline ()
"Eshell Git prompt inspired by spaceship-prompt."
(let (separator hr dir git git-dirty time sign command)
- (setq separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face))
- (setq hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face))
- (setq dir
+ (setf separator (with-face " | " 'eshell-git-prompt-multiline-secondary-face))
+ (setf hr (with-face (concat "\n" (make-string (/ (window-total-width) 2) ?─) "\n") 'eshell-git-prompt-multiline-secondary-face))
+ (setf dir
(concat
(concat (abbreviate-file-name (eshell/pwd)))))
- (setq git
+ (setf git
(concat (with-face "⎇" 'eshell-git-prompt-exit-success-face)
(concat (eshell-git-prompt--branch-name))))
- (setq git-dirty
+ (setf git-dirty
(when (eshell-git-prompt--branch-name)
(if (eshell-git-prompt--collect-status)
(with-face " ✎" 'eshell-git-prompt-modified-face)
(with-face " ✔" 'eshell-git-prompt-exit-success-face))))
- (setq time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face))
- (setq sign
+ (setf time (with-face (format-time-string "%I:%M:%S %p") 'eshell-git-prompt-multiline-secondary-face))
+ (setf sign
(if (= (user-uid) 0)
(with-face "\n#" 'eshell-git-prompt-multiline-sign-face)
(with-face "\nλ" 'eshell-git-prompt-multiline-sign-face)))
- (setq command (with-face " " 'eshell-git-prompt-multiline-command-face))
+ (setf command (with-face " " 'eshell-git-prompt-multiline-command-face))
(eshell-git-prompt---str-read-only
@@ -1096,7 +1106,7 @@ Create function to watch videos using ~mpv~
(eshell-syntax-highlighting-global-mode 1)
- (setq eshell-highlight-prompt t)
+ (setf eshell-highlight-prompt t)
#+end_src
** Multi Eshell
#+begin_src emacs-lisp
@@ -1123,7 +1133,7 @@ Create function to watch videos using ~mpv~
;(defvar multi-eshell-name "*eshell*") ;;; Name of default shell or eshell buffer
(defvar multi-eshell-ring (make-ring 100) "This stores a bunch of buffers, which are shells created by multi-eshell." )
- (setq multi-eshell-index 0 )
+ (setf multi-eshell-index 0 )
(defvar multi-eshell-last-buffer nil)
(defun multi-eshell-is-current-buffer-current-multi-eshell (&optional ignored)
@@ -1151,15 +1161,15 @@ Create function to watch videos using ~mpv~
(while (and still-looking (not empty))
(if (ring-empty-p multi-eshell-ring)
(progn
- (setq empty t)
+ (setf empty t)
(multi-eshell 1)
)
(progn
(if (buffer-live-p (ring-ref multi-eshell-ring multi-eshell-index))
(progn
- (setq multi-eshell-index (+ multi-eshell-index 1))
+ (setf multi-eshell-index (+ multi-eshell-index 1))
(switch-to-buffer (ring-ref multi-eshell-ring multi-eshell-index))
- (setq still-looking nil)
+ (setf still-looking nil)
)
(ring-remove multi-eshell-ring multi-eshell-index)
)
@@ -1184,7 +1194,7 @@ Create function to watch videos using ~mpv~
"If current buffer is not an multi-eshell, switch to current multi-eshell buffer. Otherwise, switch to next multi-eshell buffer."
(interactive "p")
(progn
- (setq multi-eshell-last-buffer (current-buffer))
+ (setf multi-eshell-last-buffer (current-buffer))
(let ((still-looking t)
(empty nil))
(if (ring-empty-p multi-eshell-ring)
@@ -1202,7 +1212,7 @@ Create function to watch videos using ~mpv~
"Creates a shell buffer. If one already exists, this creates a new buffer, with the name '*shell*<n>', where n is chosen by the function generate-new-buffer-name."
(interactive "p")
(progn
- (setq multi-eshell-last-buffer (current-buffer))
+ (setf multi-eshell-last-buffer (current-buffer))
(dotimes (i (if-void 'numshells 1) nil)
(let ( (tempname (generate-new-buffer-name "*tempshell*"))
(new-buff-name (generate-new-buffer-name multi-eshell-name))
@@ -1213,7 +1223,7 @@ Create function to watch videos using ~mpv~
(multi-eshell-function)
;(process-send-string (get-buffer-process new-buff-name) (concat "cd " localdir "\n"))
(ring-insert multi-eshell-ring (current-buffer) )
- (setq multi-eshell-index (+ multi-eshell-index 1))
+ (setf multi-eshell-index (+ multi-eshell-index 1))
)
(progn
(interactive)
@@ -1226,7 +1236,7 @@ Create function to watch videos using ~mpv~
(switch-to-buffer new-buff-name)
;(process-send-string (get-buffer-process new-buff-name) (concat "cd " localdir "\n"))
(ring-insert multi-eshell-ring (current-buffer) )
- (setq multi-eshell-index (+ multi-eshell-index 1))
+ (setf multi-eshell-index (+ multi-eshell-index 1))
)
)
)
@@ -1276,17 +1286,70 @@ Create function to watch videos using ~mpv~
#+begin_src emacs-lisp
(require 'gptel)
(define-key 'thanos/applications-map (kbd "c") 'gptel-send)
- (setq gptel-api-key (password-store-get "chatgpt/api")
+ (setf gptel-api-key (password-store-get "chatgpt/api")
gptel-model 'gpt-4-32k)
#+end_src
* Multimedia
** YeeTube
+*** Vimeo
++ Downlaod videos from ~vimeo~, /just change .json to .mpd on master.json/
+ #+begin_src emacs-lisp
+ (defun yeetube-download-vimeo-videos ()
+ (interactive)
+ (let ((url "")
+ (name "")
+ (download-counter 1))
+ (while (not (string= url "q"))
+ (setf url (read-string "Enter URL (q to quit): "))
+ (unless (string= url "q")
+ (setf name (read-string (format "Custom name (download counter: %d) " download-counter)))
+ (setf download-counter (1+ download-counter))
+ (call-process-shell-command
+ (format
+ "yt-dlp '%s' -o '%s'"
+ (replace-regexp-in-string "\\.json" ".m3u8" url) name)
+ nil 0)))))
+ #+end_src
+*** Ffmpeg
++ Use ~ffmpeg~ to download videos
+
+#+begin_src emacs-lisp
+ (defun yeetube-download-videos-ffmpeg ()
+ "Download one or multiple videos using yt-dlp.
+ This command is not meant to be used in the *Yeetube Search* buffer.
+
+ Usage Example:
+ Open a Dired buffer and navigate where you want to download your videos,
+ then run this command interactively. You can leave the 'Custom name:'
+ prompt blank to keep the default name."
+ (interactive)
+ (let ((url "")
+ (name "")
+ (download-counter 1)
+ (stored-contents nil))
+ ;; Read links and names until "q" is entered
+ (while (not (string= url "q"))
+ (setf url (read-string "Enter URL (q to quit): "))
+ (unless (string= url "q")
+ (setf name (read-string (format "Custom name (download counter: %d) " download-counter)))
+ (push (cons url name) stored-contents)
+ (setf download-counter (1+ download-counter))))
+ ;; Process the collected links and names
+ (dolist (pair stored-contents)
+ (let ((url (car pair))
+ (name (cdr pair)))
+ (async-shell-command
+ (format
+ "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'"
+ url name))))))
+#+end_src
+*** Keybindings
#+begin_src emacs-lisp
(when is-zeus
(load-file "~/Developer/yeetube.el/yeetube.el"))
(require 'yeetube)
- (setq yeetube-results-limit 30
+ (setf yeetube-results-limit 30
yeetube-mpv-disable-video t)
(define-prefix-command 'thanos/yeetube)
@@ -1298,48 +1361,16 @@ Create function to watch videos using ~mpv~
(define-key thanos/yeetube (kbd "C-p") 'yeetube-mpv-toggle-video)
(define-key thanos/yeetube (kbd "k") 'yeetube-remove-saved-video)
(define-key thanos/yeetube (kbd "u") 'yeetube-change-platform)
+ (define-key thanos/yeetube (kbd "C-d") 'yeetube-download-vimeo-videos)
(define-key yeetube-mode-map (kbd "c") 'yeetube-switch-mpv)
#+end_src
-+ Use ~ffmpeg~ to download videos
-
-#+begin_src emacs-lisp
- (defun yeetube-download-videos-ffmpeg ()
- "Download one or multiple videos using yt-dlp.
- This command is not meant to be used in the *Yeetube Search* buffer.
-
- Usage Example:
- Open a Dired buffer and navigate where you want to download your videos,
- then run this command interactively. You can leave the 'Custom name:'
- prompt blank to keep the default name."
- (interactive)
- (let ((url "")
- (name "")
- (download-counter 1)
- (stored-contents nil))
- ;; Read links and names until "q" is entered
- (while (not (string= url "q"))
- (setq url (read-string "Enter URL (q to quit): "))
- (unless (string= url "q")
- (setq name (read-string (format "Custom name (download counter: %d) " download-counter)))
- (push (cons url name) stored-contents)
- (setq download-counter (1+ download-counter))))
- ;; Process the collected links and names
- (dolist (pair stored-contents)
- (let ((url (car pair))
- (name (cdr pair)))
- (call-process-shell-command
- (format
- "ffmpeg -protocol_whitelist file,crypto,data,https,tls,tcp -stats -i '%s' -codec copy '%s.mp4'"
- url
- (shell-quote-argument name)))))))
-#+end_src
** EMMS
#+begin_src emacs-lisp
(require 'emms)
(emms-all)
- (setq emms-player-list '(emms-player-mpv)
+ (setf emms-player-list '(emms-player-mpv)
emms-player-mpv-parameters '("--no-video")
emms-info-functions '(emms-info-native)
emms-playlist-buffer-name "*Music*"
@@ -1364,7 +1395,7 @@ Create function to watch videos using ~mpv~
;;; Code:
(require 'erc)
- (setq erc-modules
+ (setf erc-modules
'(sasl netsplit fill button match track completion readonly
networks ring autojoin noncommands irccontrols move-to-prompt stamp
menu list))
@@ -1397,7 +1428,7 @@ Create function to watch videos using ~mpv~
** StumpWM
#+begin_src emacs-lisp
(require 'stumpwm-mode)
- (setq stumpwm-shell-program "~/.stumpwm.d/modules/util/stumpish/stumpish")
+ (setf stumpwm-shell-program "~/.stumpwm.d/modules/util/stumpish/stumpish")
#+end_src
** pdf-tools
#+begin_src emacs-lisp
@@ -1425,8 +1456,8 @@ Create function to watch videos using ~mpv~
"Centers/Uncenters selected buffer"
(interactive)
(if visual-fill-column-center-text
- (setq visual-fill-column-center-text nil)
- (setq visual-fill-column-center-text t))
+ (setf visual-fill-column-center-text nil)
+ (setf visual-fill-column-center-text t))
(visual-fill-column-mode 1))