mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
feat(emacs): elfeed-sync, wallabag, dap-php
This commit is contained in:
parent
4b176a5bb1
commit
062233413d
2 changed files with 158 additions and 3 deletions
|
|
@ -1206,6 +1206,7 @@ influence of C1 on the result."
|
|||
(dap-chrome-setup)
|
||||
|
||||
(require 'dap-python)
|
||||
(require 'dap-php)
|
||||
|
||||
(dap-mode 1)
|
||||
(dap-ui-mode 1)
|
||||
|
|
@ -1444,6 +1445,31 @@ Returns (<buffer> . <workspace-index>) or nil."
|
|||
(use-package reformatter
|
||||
:straight t)
|
||||
|
||||
(defun my/copilot-tab ()
|
||||
(interactive)
|
||||
(or (copilot-accept-completion)
|
||||
(indent-for-tab-command)))
|
||||
|
||||
(defun my/setup-copilot ()
|
||||
(use-local-map my/copilot-mode-map))
|
||||
|
||||
(defvar my/copilot-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(evil-define-key* 'insert map
|
||||
(kbd "<tab>") #'my/copilot-tab)
|
||||
map))
|
||||
|
||||
(define-minor-mode my/copilot-mode
|
||||
"My keybings for copilot.el")
|
||||
|
||||
(use-package copilot
|
||||
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
|
||||
:commands (copilot-mode)
|
||||
:init
|
||||
(add-hook 'prog-mode-hook #'copilot-mode)
|
||||
:config
|
||||
(add-hook 'copilot-mode-hook #'my/copilot-mode))
|
||||
|
||||
(defun my/set-smartparens-indent (mode)
|
||||
(sp-local-pair mode "{" nil :post-handlers '(("|| " "SPC") ("||\n[i]" "RET")))
|
||||
(sp-local-pair mode "[" nil :post-handlers '(("|| " "SPC") ("||\n[i]" "RET")))
|
||||
|
|
@ -4037,6 +4063,15 @@ Returns (<buffer> . <workspace-index>) or nil."
|
|||
:config
|
||||
(setq elfeed-summary-filter-by-title t))
|
||||
|
||||
(use-package elfeed-sync
|
||||
:straight (:host github :repo "SqrtMinusOne/elfeed-sync")
|
||||
:after elfeed
|
||||
:config
|
||||
(elfeed-sync-mode)
|
||||
(setq elfeed-sync-tt-rss-instance "https://sqrtminusone.xyz/tt-rss")
|
||||
(setq elfeed-sync-tt-rss-login "sqrtminusone")
|
||||
(setq elfeed-sync-tt-rss-password (my/password-store-get "Selfhosted/tt-rss")))
|
||||
|
||||
(defun my/elfeed-toggle-score-sort ()
|
||||
(interactive)
|
||||
(setq elfeed-search-sort-function
|
||||
|
|
@ -4209,6 +4244,12 @@ Call CALLBACK with the output."
|
|||
(setq-local my/elfeed-show-rdrview-html content)
|
||||
(goto-char (point-min))))))
|
||||
|
||||
(with-eval-after-load 'elfeed
|
||||
(general-define-key
|
||||
:states '(normal)
|
||||
:keymaps 'elfeed-show-mode-map
|
||||
"gp" #'my/rdrview-elfeed-show))
|
||||
|
||||
(setq my/rdrview-template (expand-file-name
|
||||
(concat user-emacs-directory "rdrview.tex")))
|
||||
|
||||
|
|
@ -4257,7 +4298,7 @@ OVERWRITE is non-nil."
|
|||
(funcall callback file-name)))
|
||||
((or (and (eq status 'exit) (> code 0))
|
||||
(eq status 'signal))
|
||||
(user-error "Error in pandoc. Check the *Pandoc* buffer")))))))))
|
||||
(user-error "Error in pandoc. Check the *Pandoc* buffer"))))))))))
|
||||
|
||||
(setq my/elfeed-pdf-dir (expand-file-name "~/.elfeed/pdf/"))
|
||||
|
||||
|
|
@ -4305,6 +4346,12 @@ PDF already exists."
|
|||
:file-name file-name
|
||||
:overwrite current-prefix-arg)))
|
||||
|
||||
(with-eval-after-load 'elfeed
|
||||
(general-define-key
|
||||
:keymaps '(elfeed-show-mode-map)
|
||||
:states '(normal)
|
||||
"gv" #'my/elfeed-open-pdf))
|
||||
|
||||
(defun my/get-languages (url)
|
||||
(let ((main-lang "english")
|
||||
(other-lang "russian"))
|
||||
|
|
@ -4630,6 +4677,28 @@ by the `my/elfeed-youtube-subtitles' function."
|
|||
(interactive)
|
||||
(emms-add-ytel (ytel-get-current-video)))
|
||||
|
||||
(use-package wallabag
|
||||
:straight (:host github :repo "chenyanming/wallabag.el" :files (:defaults "default.css" "emojis.alist"))
|
||||
:commands (wallabag wallabag-add-entry)
|
||||
:config
|
||||
(setq wallabag-host "https://wallabag.sqrtminusone.xyz")
|
||||
(setq wallabag-username "sqrtminusone")
|
||||
(setq wallabag-password (my/password-store-get "Selfhosted/wallabag"))
|
||||
(setq wallabag-clientid (password-store-get-field "Selfhosted/wallabag" "client_id"))
|
||||
(setq wallabag-secret (password-store-get-field "Selfhosted/wallabag" "client_secret")))
|
||||
|
||||
(defun my/elfeed-wallabag (entry)
|
||||
(interactive (list elfeed-show-entry))
|
||||
(wallabag-add-entry (elfeed-entry-link entry)
|
||||
(mapconcat #'symbol-name (elfeed-entry-tags entry) ","))
|
||||
(elfeed-recommender--rate-current 2))
|
||||
|
||||
(with-eval-after-load 'elfeed
|
||||
(general-define-key
|
||||
:states '(normal)
|
||||
:keymaps '(elfeed-show-mode-map)
|
||||
"gw" #'my/elfeed-wallabag))
|
||||
|
||||
(defun my/toggle-shr-use-fonts ()
|
||||
"Toggle the shr-use-fonts variable in buffer"
|
||||
(interactive)
|
||||
|
|
|
|||
90
Emacs.org
90
Emacs.org
|
|
@ -2137,6 +2137,7 @@ References:
|
|||
(dap-chrome-setup)
|
||||
|
||||
(require 'dap-python)
|
||||
(require 'dap-php)
|
||||
|
||||
(dap-mode 1)
|
||||
(dap-ui-mode 1)
|
||||
|
|
@ -2423,7 +2424,6 @@ Some debug templates I frequently use.
|
|||
:name "Node::Attach"
|
||||
:port 9229
|
||||
:program "${workspaceFolder}/dist/bin/www.js")))
|
||||
|
||||
#+end_src
|
||||
*** Reformatter
|
||||
A general-purpose package to run formatters on files. While the most popular formatters are already packaged for Emacs, those that aren't can be invoked with this package.
|
||||
|
|
@ -2432,6 +2432,35 @@ A general-purpose package to run formatters on files. While the most popular for
|
|||
(use-package reformatter
|
||||
:straight t)
|
||||
#+end_src
|
||||
*** copilot
|
||||
[[https://copilot.github.com/][GitHub Copilot]] is a project of GitHub and OpenAI that provides code completions. It's somewhat controversial in the Emacs community but I opt in using it for now.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/copilot-tab ()
|
||||
(interactive)
|
||||
(or (copilot-accept-completion)
|
||||
(indent-for-tab-command)))
|
||||
|
||||
(defun my/setup-copilot ()
|
||||
(use-local-map my/copilot-mode-map))
|
||||
|
||||
(defvar my/copilot-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(evil-define-key* 'insert map
|
||||
(kbd "<tab>") #'my/copilot-tab)
|
||||
map))
|
||||
|
||||
(define-minor-mode my/copilot-mode
|
||||
"My keybings for copilot.el")
|
||||
|
||||
(use-package copilot
|
||||
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
|
||||
:commands (copilot-mode)
|
||||
:init
|
||||
(add-hook 'prog-mode-hook #'copilot-mode)
|
||||
:config
|
||||
(add-hook 'copilot-mode-hook #'my/copilot-mode))
|
||||
#+end_src
|
||||
*** General additional config
|
||||
Make smartparens behave the way I like for C-like languages.
|
||||
#+begin_src emacs-lisp
|
||||
|
|
@ -5896,6 +5925,19 @@ The default interface of elfeed is just a list of all entries, so it gets hard t
|
|||
:config
|
||||
(setq elfeed-summary-filter-by-title t))
|
||||
#+end_src
|
||||
**** elfeed-sync
|
||||
[[https://github.com/SqrtMinusOne/elfeed-sync][elfeed-sync]] is my package to sync elfeed with [[https://tt-rss.org/][tt-rss]].
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elfeed-sync
|
||||
:straight (:host github :repo "SqrtMinusOne/elfeed-sync")
|
||||
:after elfeed
|
||||
:config
|
||||
(elfeed-sync-mode)
|
||||
(setq elfeed-sync-tt-rss-instance "https://sqrtminusone.xyz/tt-rss")
|
||||
(setq elfeed-sync-tt-rss-login "sqrtminusone")
|
||||
(setq elfeed-sync-tt-rss-password (my/password-store-get "Selfhosted/tt-rss")))
|
||||
#+end_src
|
||||
**** elfeed-score
|
||||
[[https://github.com/sp1ff/elfeed-score][elfeed-score]] is a package that implements scoring for the elfeed entries. Entries are scored by a set of rules for tags/title/content/etc and sorted by that score.
|
||||
|
||||
|
|
@ -6114,6 +6156,14 @@ Because I didn't find a smart way to advise the desired behavior into elfeed, he
|
|||
|
||||
That way, calling =M-x my/rdrview-elfeed-show= replaces the original content with one from =rdrview=.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'elfeed
|
||||
(general-define-key
|
||||
:states '(normal)
|
||||
:keymaps 'elfeed-show-mode-map
|
||||
"gp" #'my/rdrview-elfeed-show))
|
||||
#+end_src
|
||||
|
||||
***** How well does it work?
|
||||
Rather ironically, it works well with sites that already ship with proper RSS, like [[https://protesilaos.com/][Protesilaos Stavrou's]] or [[https://karthinks.com/software/simple-folding-with-hideshow/][Karthik Chikmagalur's]] blogs or [[https://www.theatlantic.com/world/][The Atlantic]] magazine.
|
||||
|
||||
|
|
@ -6197,7 +6247,7 @@ OVERWRITE is non-nil."
|
|||
(funcall callback file-name)))
|
||||
((or (and (eq status 'exit) (> code 0))
|
||||
(eq status 'signal))
|
||||
(user-error "Error in pandoc. Check the *Pandoc* buffer")))))))))
|
||||
(user-error "Error in pandoc. Check the *Pandoc* buffer"))))))))))
|
||||
#+end_src
|
||||
|
||||
***** Opening elfeed entries
|
||||
|
|
@ -6254,6 +6304,14 @@ PDF already exists."
|
|||
|
||||
If the =my/elfeed-show-rdrview-html= variable is bound and true, then the content in this buffer was retrieved via =rdrview=, so we'll use that instead of the output of =elfeed-deref=.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'elfeed
|
||||
(general-define-key
|
||||
:keymaps '(elfeed-show-mode-map)
|
||||
:states '(normal)
|
||||
"gv" #'my/elfeed-open-pdf))
|
||||
#+end_src
|
||||
|
||||
Now we can open elfeed entries in a PDF viewer, which I find much nicer to read. Given that RSS feeds generally ship with simpler HTML than the regular websites, results usually look awesome.
|
||||
|
||||
***** Opening arbitrary sites
|
||||
|
|
@ -6727,6 +6785,34 @@ And here is the same kind of integration with EMMS as in the elfeed setup:
|
|||
(interactive)
|
||||
(emms-add-ytel (ytel-get-current-video)))
|
||||
#+end_src
|
||||
*** wallabag
|
||||
[[https://github.com/wallabag/wallabag][Wallabag]] is a self-hosted read-it-later project. I'm not yet sold on integrating it in my workflow, but let's keep it here for now.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package wallabag
|
||||
:straight (:host github :repo "chenyanming/wallabag.el" :files (:defaults "default.css" "emojis.alist"))
|
||||
:commands (wallabag wallabag-add-entry)
|
||||
:config
|
||||
(setq wallabag-host "https://wallabag.sqrtminusone.xyz")
|
||||
(setq wallabag-username "sqrtminusone")
|
||||
(setq wallabag-password (my/password-store-get "Selfhosted/wallabag"))
|
||||
(setq wallabag-clientid (password-store-get-field "Selfhosted/wallabag" "client_id"))
|
||||
(setq wallabag-secret (password-store-get-field "Selfhosted/wallabag" "client_secret")))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/elfeed-wallabag (entry)
|
||||
(interactive (list elfeed-show-entry))
|
||||
(wallabag-add-entry (elfeed-entry-link entry)
|
||||
(mapconcat #'symbol-name (elfeed-entry-tags entry) ","))
|
||||
(elfeed-recommender--rate-current 2))
|
||||
|
||||
(with-eval-after-load 'elfeed
|
||||
(general-define-key
|
||||
:states '(normal)
|
||||
:keymaps '(elfeed-show-mode-map)
|
||||
"gw" #'my/elfeed-wallabag))
|
||||
#+end_src
|
||||
*** EWW
|
||||
Emacs built-in web browser. +I wonder if anyone actually uses it.+
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue