diff options
Diffstat (limited to '.config/emacs')
-rw-r--r-- | .config/emacs/init.el | 129 |
1 files changed, 71 insertions, 58 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 4d88c34..695804e 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -478,7 +478,8 @@ :defer t :config (setf elfeed-search-filter "@1-week-ago +unread -hackernoon" - browse-url-browser-function #'browse-url-default-browser) + browse-url-browser-function #'browse-url-default-browser + elfeed-db-directory "~/.config/elfeed") ;; Feeds (setf elfeed-feeds '(("https://hackaday.com/blog/feed/" @@ -495,16 +496,16 @@ science) ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.medscape.com%2Findex%2Flist_13470_0&url_selector=a.title&url_pattern=viewarticle%2F.*&content_selector=div.article__main-content&content_cleanup=&title_cleanup=+-+Index&limit=&format=Atom" medscape med) ("http://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fmedfac.mu-sofia.com%2Fen%2Fnews%2F&url_selector=div.news-card&url_pattern=%2F*&content_selector=article.richtext-area&content_cleanup=&title_cleanup=&limit=&format=Atom" musofia med) - ("http://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fedition.cnn.com%2Fworld%2Feurope&url_selector=a.container__link--type-article&url_pattern=&content_selector=div.article__content&content_cleanup=&&title_cleanup=-+breaking+news%2C+video%2C+headlines+and+opinion&limit=&format=Atom" news cnn europe) - ("http://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fedition.cnn.com%2Fworld%2Famericas&url_selector=a.container__link--type-article&url_pattern=&content_selector=div.article__content&content_cleanup=div.data-uri&title_cleanup=-+breaking+news%2C+video%2C+headlines+and+opinion&limit=&format=Atom" news cnn americas) - ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.theguardian.com%2Feurope&url_selector=a.dcr-lv2v9o&url_pattern=&content_selector=div.article-body-commercial-selector&content_cleanup=figure.dcr-173mewl%2C+div.dcr-ut4tvs&title_cleanup=News%2C+sport+and+opinion+from+the+Guardian%27s+Europe+edition+%7C&limit=&format=Atom" news guardian europe) ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.tovima.gr%2Flatest-news%2F&url_selector=a.columns&url_pattern=&content_selector=div.main-content&content_cleanup=div.wrap-facebook%2Cdiv.googlenews&title_cleanup=&limit=&format=Atom" tovima greek news) - ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.tovima.gr%2Fcategory%2Fscience%2F&url_selector=a.columns&url_pattern=&content_selector=div.main-content&content_cleanup=div.wrap-facebook%2Cdiv.googlenews&title_cleanup=&limit=&format=Atom" tovima greek science) + ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.tovima.gr%2Fcategory%2Fscience%2F&url_selector=a.columns&url_pattern=&content_selector=div.main-content&content_cleanup=div.wrap-facebook%2Cdiv.googlenews&title_cleanup=&limit=&format=Atom" tovima greek science news) + ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.reuters.com%2Fworld%2F&url_selector=a.media-story-card__headline__tFMEu&url_pattern=&content_selector=div.article-body__content__17Yit&content_cleanup=div.article-body__row__dFOPA%2Cdiv.article-body__element__2p5pI%2Cp.text__small__1kGq2&title_cleanup=&limit=&format=Atom" reuters world news) + ("https://rss-bridge.thanosapollo.org/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.reuters.com%2Fbusiness%2Fhealthcare-pharmaceuticals%2F&url_selector=a.basic-card__title__37xHl&url_pattern=&content_selector=div.article-body__wrapper__3IxHM&content_cleanup=svg.link__new-tab-symbol__3T19s%2C+div.toolbar__container__3kIkw%2C+div.article-body__row__dFOPA+article-body__element__2p5pI&title_cleanup=&limit=&format=Atom" reuters med news) ("https://annas-blog.org/rss.xml" anna piracy) ("https://planet.emacslife.com/atom.xml" emacs emacslife) ("https://localmonero.co/static/rss/the-monero-standard/feed.xml" monero) ("https://devonzuegel.com/feed" devon) ("https://www.addtoany.com/add_to/feed?linkurl=http%3A%2F%2Fwww.thelancet.com%2Frssfeed%2Flancet_online.xml&type=feed&linkname=The%20Lancet%20Online%20First&linknote=" lancet med) + ("https://www.propublica.org/feeds/propublica/main" probublica news) ("http://tools.cdc.gov/podcasts/feed.asp?feedid=183" cdc med) ("http://planet.lisp.org/rss20.xml" lisp planetlisp) ("https://guix.gnu.org/feeds/blog.atom" guix) @@ -951,8 +952,12 @@ By default, returns all jabber related buffers format." ("d" . 'gnosis-add-deck) ("t" . 'gnosis-test-start))) - ;; Run vc-pull on startup - (gnosis-vc-pull)) + ;; Sync gnosis on startup + (gnosis-vc-pull) + + (use-package pcmpl-taiscale + :straight (pcmpl-taiscale :local-repo "~/Dev/emacs-lisp/pcmpl-taiscale") + :ensure nil)) ;; Emacs dev @@ -987,52 +992,7 @@ By default, returns all jabber related buffers format." :init (define-prefix-command 'thanos/pass) :defer t :config - (setf password-store-password-length (+ 20 (random 20))) - - (defmacro thanos/make-frame (name &rest body) - "Create temporary frame as NAME. - -Create a temporary frame to execute BODY, which will then be deleted." - `(unwind-protect - (with-selected-frame - (make-frame '((name . ,name) - (fullscreen . 0) - (undecorated . t) - (minibuffer . only) - (width . 70) - (height . 15))) - ,@body - (delete-frame)))) - - (defun thanos/pass-autotype (&optional entry) - "Autotype password ENTRY." - (let* ((entry (or entry (password-store--completing-read t))) - (user (password-store-get-field entry "user")) - (pass (password-store-get entry))) - (start-process-shell-command - "wtype" nil - (format "sleep 0.3 && wtype %s -P tab %s" - (shell-quote-argument (if user user "thanosapollo")) - (shell-quote-argument pass))))) - - (defun thanos/pass-launcher () - "Launch Emacs as a front-end for pass." - (interactive) - (thanos/make-frame - "thanos/pass-launcher" - (let* ((choice (completing-read "Choose an action: " - '("AUTO" "COPY PASS" "EDIT" "GENERATE"))) - (action (pcase choice - ("AUTO" #'thanos/pass-autotype) - ("COPY PASS" #'password-store-copy) - ("EDIT" #'password-store-edit) - ("GENERATE" #'password-store-generate)))) - (funcall action (completing-read "Search: " (password-store-list)))))) - - (defun smtp-get-pass () - "Get password for smtp." - (interactive) - (password-store-copy-field "fastmail.com/[email protected]" "smtp")) + (setf password-store-password-length (+ 20 (random 20))) :bind (("C-c p" . 'thanos/pass) :map thanos/pass @@ -1077,9 +1037,7 @@ Create a temporary frame to execute BODY, which will then be deleted." (when (or is-zeus is-hermes) (use-package mu4e :straight nil - :ensure nil - :init - + :ensure nil :config (require 'server) (require 'mu4e) @@ -1175,7 +1133,7 @@ Create a temporary frame to execute BODY, which will then be deleted." :group 'mu4e :lighter nil (message "mu4e mode")) - + :bind (("C-x m" . 'mu4e)) :hook ;; Sign messages @@ -1211,12 +1169,29 @@ Create a temporary frame to execute BODY, which will then be deleted." (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" memory cores image (if iso (concat "-cdrom " iso) ""))))) -;; misc +;; Misc Functions ;; +;;;;;;;;;;;;;;;;;;;; + (defun thanos/run-in-background (command) "Run COMMAND in the background." (let ((command-parts (split-string command "[ ]+"))) (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) +(defmacro thanos/make-frame (name &rest body) + "Create temporary frame as NAME. + +Create a temporary frame to execute BODY, which will then be deleted." + `(unwind-protect + (with-selected-frame + (make-frame '((name . ,name) + (fullscreen . 0) + (undecorated . t) + (minibuffer . only) + (width . 70) + (height . 15))) + ,@body + (delete-frame)))) + (defun create-text-scratch () "Create a scratch buffer." (interactive) @@ -1343,4 +1318,42 @@ Create a temporary frame to execute BODY, which will then be deleted." :group 'iimage :lighter " iImg" (thanos/iimage-mode-buffer thanos/iimage-mode)) +;; Password + +(defun thanos/pass-autotype (&optional entry) + "Autotype password ENTRY." + (let* ((entry (or entry (password-store--completing-read t))) + (user (password-store-get-field entry "user")) + (pass (password-store-get entry))) + (start-process-shell-command + "wtype" nil + (format "sleep 0.3 && wtype %s -P tab %s" + (shell-quote-argument (if user user "thanosapollo")) + (shell-quote-argument pass))))) + +(defun thanos/pass-launcher () + "Launch Emacs as a front-end for pass." + (interactive) + (thanos/make-frame + "thanos/pass-launcher" + (let* ((choice (completing-read "Choose an action: " + '("AUTO" "COPY PASS" "EDIT" "GENERATE"))) + (action (pcase choice + ("AUTO" #'thanos/pass-autotype) + ("COPY PASS" #'password-store-copy) + ("EDIT" #'password-store-edit) + ("GENERATE" #'password-store-generate)))) + (funcall action (completing-read "Search: " (password-store-list)))))) + +(defun smtp-get-pass () + "Get password for smtp." + (interactive) + (password-store-copy-field "fastmail.com/[email protected]" "smtp")) + +(defun thanos/0x0-upload (&optional file) + "Upload FILE to 0x0.st" + (interactive) + (let ((file (or file (dired-get-filename)))) + (async-shell-command (format "curl -F'file=@%s' https://0x0.st" file)))) + ;;; init.el ends here |