...
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
;;; clipboard
|
||||
(after! evil
|
||||
(setq interprogram-cut-function nil
|
||||
@@ -84,6 +85,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;;; in buffer completions
|
||||
(setq tab-always-indent 'complete)
|
||||
(after! corfu
|
||||
@@ -193,6 +198,32 @@
|
||||
(emms-play-url url)
|
||||
)
|
||||
)
|
||||
(defun my-get-song-url ()
|
||||
(interactive)
|
||||
(let* (
|
||||
(playlist (infrasonic-get-playlist my-subsonic-client "6ad5avelak6Lnu2yEbWwjj"))
|
||||
(entries (cdr (assoc 'entry playlist)))
|
||||
(candidates (list))
|
||||
(urls '())
|
||||
(void (dolist (song entries)
|
||||
(let* (
|
||||
(artist (cdr (assoc 'artist song)))
|
||||
(cropped-artist (truncate-string-to-width artist 50))
|
||||
(title (cdr (assoc 'title song)))
|
||||
(id (cdr (assoc 'id song)))
|
||||
(line (format "%-50s - %s" cropped-artist title))
|
||||
(stream-url (infrasonic-get-stream-url my-subsonic-client id))
|
||||
)
|
||||
(add-to-list 'candidates line)
|
||||
(push (cons line stream-url) urls)
|
||||
)
|
||||
))
|
||||
(completion-result (completing-read "Select track: " candidates))
|
||||
(url (cdr (assoc completion-result urls)))
|
||||
)
|
||||
(message url)
|
||||
)
|
||||
)
|
||||
|
||||
(defun my-load-playlist ()
|
||||
(interactive)
|
||||
@@ -227,84 +258,6 @@
|
||||
|
||||
|
||||
|
||||
;;; my finder
|
||||
(defun my/obsidian--extra-files ()
|
||||
"Return Markdown files from additional directories."
|
||||
(let ((directory "~/notes/reference"))
|
||||
(when (file-directory-p directory)
|
||||
(directory-files-recursively
|
||||
(expand-file-name directory)
|
||||
"\\.md\\'"))))
|
||||
|
||||
(defun my/obsidian--candidate-data ()
|
||||
"Return `(DISPLAY . FILE)' candidates for the Obsidian finder."
|
||||
(let (result)
|
||||
|
||||
;; Files known to obsidian.el.
|
||||
(maphash
|
||||
(lambda (file metadata)
|
||||
(let* ((tags (gethash 'tags metadata))
|
||||
(aliases (gethash 'aliases metadata))
|
||||
(title (file-name-base file))
|
||||
(display
|
||||
(concat
|
||||
title
|
||||
(when aliases
|
||||
(format " [%s]" (string-join aliases ", ")))
|
||||
(when tags
|
||||
(format " #%s"
|
||||
(string-join tags " #"))))))
|
||||
(push (cons display file) result)))
|
||||
obsidian-vault-cache)
|
||||
|
||||
;; Files in the additional directory.
|
||||
(dolist (file (my/obsidian--extra-files))
|
||||
(unless (assoc (file-name-base file) result)
|
||||
(push (cons (file-name-base file) file) result)))
|
||||
|
||||
result))
|
||||
|
||||
(defun my-switcher ()
|
||||
"Fuzzy-find all my stuff"
|
||||
(interactive)
|
||||
|
||||
;; Make sure obsidian.el's cache is current.
|
||||
;;(obsidian-update)
|
||||
|
||||
(let* ((data (my/obsidian--candidate-data))
|
||||
(candidates (mapcar #'car data))
|
||||
(choice
|
||||
(completing-read
|
||||
"things: "
|
||||
candidates
|
||||
nil
|
||||
nil ; allow a new/non-existing note
|
||||
nil
|
||||
nil
|
||||
nil)))
|
||||
|
||||
(if-let ((file (cdr (assoc choice data))))
|
||||
;; Existing note.
|
||||
(find-file file)
|
||||
|
||||
;; New note.
|
||||
(let ((file
|
||||
(expand-file-name
|
||||
(if (string-suffix-p ".md" choice)
|
||||
choice
|
||||
(concat choice ".md"))
|
||||
(expand-file-name obsidian-inbox-directory
|
||||
obsidian-directory))))
|
||||
(make-directory (file-name-directory file) t)
|
||||
(find-file file)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(after! evil
|
||||
(map! :gnv "C-e" #'my-switcher)
|
||||
)
|
||||
|
||||
|
||||
;;; the file buffer opening I used to have in zed
|
||||
(defun my-toggle-dired-current-dir ()
|
||||
@@ -381,15 +334,118 @@ and automatically switch to its matching Doom project workspace."
|
||||
|
||||
|
||||
|
||||
;;; dired
|
||||
(after! dired
|
||||
(define-key evil-motion-state-map (kbd "C-n") nil)
|
||||
(define-key evil-normal-state-map (kbd "C-n") nil)
|
||||
(define-key dired-mode-map (kbd "C-n") #'dired-create-empty-file)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;;; contacts
|
||||
(use-package! ecard
|
||||
:defer t
|
||||
:config
|
||||
;; Ensure CardDAV capabilities are loaded
|
||||
(require 'ecard-carddav)
|
||||
(require 'ecard-sync)
|
||||
|
||||
;; Configure your remote CardDAV repository mapping
|
||||
(setq ecard-carddav-accounts
|
||||
'(("oxi"
|
||||
:url "https://oxi.ppc.social"
|
||||
:user "c2vi"
|
||||
;; ecard-carddav uses auth-source to securely look up your password/app-password
|
||||
:auth auth-source)))
|
||||
|
||||
;; Set a path where your contacts will be saved locally as vCard files
|
||||
(setq ecard-sync-local-directory (expand-file-name "~/work/app-data/ecard/")))
|
||||
(after! ecard
|
||||
(defun my/ecard-import-vcard-and-sync (file)
|
||||
"Import a .vcf FILE, save it to the local ecard directory, and sync to CardDAV."
|
||||
(interactive "fSelect vCard file to import: ")
|
||||
(unless (file-exists-p file)
|
||||
(user-error "File does not exist: %s" file))
|
||||
|
||||
;; Ensure the target directory exists
|
||||
(unless (file-directory-p ecard-sync-local-directory)
|
||||
(make-directory ecard-sync-local-directory t))
|
||||
|
||||
(message "Importing %s..." (file-name-nondirectory file))
|
||||
|
||||
;; 1. Read and parse the external vCard
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(let ((cards (ecard-parse-buffer)))
|
||||
(if (null cards)
|
||||
(message "No valid vCards found in file.")
|
||||
|
||||
;; 2. Write each parsed card to your local sync directory
|
||||
(dolist (card cards)
|
||||
;; ecard-write-card automatically names the file appropriately (often via UUID or Name)
|
||||
(ecard-write-card card ecard-sync-local-directory))
|
||||
|
||||
(message "Successfully imported %d contact(s) locally." (length cards))
|
||||
|
||||
;; 3. Push the new local additions to the CardDAV server
|
||||
(if (y-or-n-p "Sync newly imported contacts to CardDAV now? ")
|
||||
(progn
|
||||
(message "Synchronizing with CardDAV...")
|
||||
(ecard-carddav-sync)
|
||||
(message "Sync complete!"))
|
||||
(message "Contacts imported locally. Run M-x ecard-carddav-sync later to upload.")))))))
|
||||
(use-package! org-contacts
|
||||
:after org
|
||||
:config
|
||||
;; Tell Emacs where your contacts file lives
|
||||
(setq org-contacts-files '("~/work/app-data/org/contacts.org"))
|
||||
|
||||
;; (Optional) Add a custom Org-Capture template for quick entry
|
||||
(add-to-list 'org-capture-templates
|
||||
'("c" "Contact" entry (file "~/org/contacts.org")
|
||||
"* %(org-contacts-template-name)\n :PROPERTIES:\n :EMAIL: %(org-contacts-template-email)\n :PHONE:\n :BIRTHDAY:\n :NOTE:\n :END:")))
|
||||
|
||||
|
||||
|
||||
|
||||
;;; matrix client
|
||||
(setq my/secrets-dir (getenv "SECRETS_DIR"))
|
||||
(use-package! ement
|
||||
:config
|
||||
;; Enable session saving so you don't have to re-authenticate on every launch
|
||||
(setq ement-save-sessions t)
|
||||
|
||||
|
||||
(when (fboundp 'set-fontset-font)
|
||||
(set-fontset-font t 'emoji '("Noto Color Emoji" . "iso10646-1") nil 'prepend))
|
||||
|
||||
(run-with-idle-timer 2 nil (lambda ()
|
||||
(ement-connect :user-id "@me:matrix.c2vi.dev"
|
||||
:uri-prefix "http://100.88.79.207:8000"
|
||||
:password (f-read (expand-file-name "priv.matrix.pwd" my/secrets-dir)))
|
||||
|
||||
;; my account on ppc's matrix
|
||||
(ement-connect :user-id "@c2vi:ppc.social"
|
||||
:uri-prefix "https://matrix.ppc.social")
|
||||
))
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
;;; scratch
|
||||
(defun my/scratch ()
|
||||
(lookup-key corfu-map (kbd "C-u"))
|
||||
(lookup-key dired-mode-map (kbd "C-n"))
|
||||
(lookup-key corfu-map (kbd "C-i"))
|
||||
(define-key corfu-map (kbd "C-i") 'my/corfu-insert-first)
|
||||
|
||||
|
||||
(emms-insert-url "https://tunes.c2vi.dev/rest/stream.view?u=c2vi&t=59248d02914f93abee797adcf0f14d6a&s=8a3988f950895ee7bd87e17651e65eb1&v=1.16.1&c=infrasonic&f=json&id=0FnN5Sb3mCItKdIiJZcG7x")
|
||||
(infrasonic-get-stream-url my-subsonic-client)
|
||||
(message emms-playlist-buffer)
|
||||
|
||||
(+workspace-current-name)
|
||||
|
||||
Reference in New Issue
Block a user