mirror of
https://github.com/SqrtMinusOne/sqrtminusone.github.io.git
synced 2025-12-11 00:03:02 +03:00
deploy: 8ed5a5305f
This commit is contained in:
parent
25b4d86cb8
commit
40cb934c2c
6 changed files with 62 additions and 32 deletions
|
|
@ -355,7 +355,7 @@
|
|||
</span></span><span style="display:flex;"><span> init_conda
|
||||
</span></span><span style="display:flex;"><span><span style="color:#008000;font-weight:bold">fi</span>
|
||||
</span></span></code></pre></div><h4 id="starship">Starship</h4>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#008000;font-weight:bold">if</span> <span style="color:#666">[[</span> -z <span style="color:#ba2121">"</span><span style="color:#19177c">$SIMPLE</span><span style="color:#ba2121">"</span> <span style="color:#666">]]</span>; <span style="color:#008000;font-weight:bold">then</span>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#008000;font-weight:bold">if</span> <span style="color:#666">[[</span> -z <span style="color:#ba2121">"</span><span style="color:#19177c">$SIMPLE</span><span style="color:#ba2121">"</span> <span style="color:#666">&&</span> <span style="color:#ba2121">"</span><span style="color:#19177c">$TERM</span><span style="color:#ba2121">"</span> !<span style="color:#666">=</span> <span style="color:#ba2121">"dumb"</span> <span style="color:#666">]]</span>; <span style="color:#008000;font-weight:bold">then</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">eval</span> <span style="color:#ba2121">"</span><span style="color:#008000;font-weight:bold">$(</span>starship init bash<span style="color:#008000;font-weight:bold">)</span><span style="color:#ba2121">"</span>
|
||||
</span></span><span style="display:flex;"><span><span style="color:#008000;font-weight:bold">fi</span>
|
||||
</span></span></code></pre></div><h2 id="fish">Fish</h2>
|
||||
|
|
@ -375,7 +375,9 @@
|
|||
</table>
|
||||
<p><a href="https://fishshell.com/">Fish shell</a> is a non-POSIX-compliant shell, which offers some fancy UI & UX features.</p>
|
||||
<p>Launch starship</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fish" data-lang="fish"><span style="display:flex;"><span><span style="color:#00f">starship</span> init <span style="color:#008000">fish</span> <span style="color:#666">|</span> <span style="color:#008000">source</span>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fish" data-lang="fish"><span style="display:flex;"><span><span style="color:#008000;font-weight:bold">if</span> <span style="color:#666">[</span> <span style="color:#ba2121">"</span><span style="color:#19177c">$TERM</span><span style="color:#ba2121">"</span> !<span style="color:#666">=</span> <span style="color:#ba2121">"dumb"</span> <span style="color:#666">]</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#00f">starship</span> init <span style="color:#008000">fish</span> <span style="color:#666">|</span> <span style="color:#008000">source
|
||||
</span></span></span><span style="display:flex;"><span><span style="color:#008000"></span><span style="color:#008000;font-weight:bold">end</span>
|
||||
</span></span></code></pre></div><p>Enable vi keybindings & aliases. The alias syntax is the same as in bash, so it’s just a noweb reference to <code>.bashrc</code>.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-fish" data-lang="fish"><span style="display:flex;"><span><span style="color:#00f">fish_vi_key_bindings</span>
|
||||
</span></span><span style="display:flex;"><span>
|
||||
|
|
|
|||
|
|
@ -398,7 +398,11 @@
|
|||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">use-package</span> <span style="color:#19177c">exwm-modeline</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:straight</span> (<span style="color:#008000">:host</span> <span style="color:#19177c">github</span> <span style="color:#008000">:repo</span> <span style="color:#ba2121">"SqrtMinusOne/exwm-modeline"</span>)
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:config</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">add-hook</span> <span style="color:#19177c">'exwm-init-hook</span> <span style="color:#00f">#'</span><span style="color:#19177c">exwm-modeline-mode</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">add-hook</span> <span style="color:#19177c">'exwm-init-hook</span> <span style="color:#00f">#'</span><span style="color:#19177c">exwm-modeline-mode</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">my/use-doom-colors</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">exwm-modeline-current-workspace</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:foreground</span> (<span style="color:#19177c">doom-color</span> <span style="color:#19177c">'yellow</span>)
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:weight</span> <span style="color:#19177c">'bold</span>)))
|
||||
</span></span></code></pre></div><h3 id="windows">Windows</h3>
|
||||
<p>A bunch of functions related to managing windows in EXWM.</p>
|
||||
<h4 id="moving-windows">Moving windows</h4>
|
||||
|
|
|
|||
|
|
@ -1296,6 +1296,16 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">my/use-doom-colors</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">auto-dim-other-buffers-face</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:background</span> (<span style="color:#19177c">color-darken-name</span> (<span style="color:#19177c">doom-color</span> <span style="color:#19177c">'bg</span>) <span style="color:#666">3</span>))))
|
||||
</span></span></code></pre></div><h4 id="toggle-light-dark">Toggle light/dark</h4>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">defun</span> <span style="color:#19177c">my/toggle-dark-light-theme</span> ()
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">interactive</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">let</span> ((<span style="color:#19177c">is-dark</span> (<span style="color:#00f">member</span> <span style="color:#19177c">'doom-palenight</span> <span style="color:#19177c">custom-enabled-themes</span>)))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">if</span> <span style="color:#19177c">is-dark</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">progn</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">load-theme</span> <span style="color:#19177c">'doom-one-light</span> <span style="color:#800">t</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">disable-theme</span> <span style="color:#19177c">'doom-palenight</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">load-theme</span> <span style="color:#19177c">'doom-palenight</span> <span style="color:#800">t</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">disable-theme</span> <span style="color:#19177c">'doom-one-light</span>))))
|
||||
</span></span></code></pre></div><h3 id="fonts">Fonts</h3>
|
||||
<h4 id="frame-font">Frame font</h4>
|
||||
<p>To install a font, download the font and unpack it into the <code>.local/share/fonts</code> directory. Create one if it doesn’t exist.</p>
|
||||
|
|
@ -4820,17 +4830,10 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span>
|
||||
</span></span><span style="display:flex;"><span>(<span style="color:#19177c">my-leader-def</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#ba2121">"cf"</span> <span style="color:#666">'</span>(<span style="color:#19177c">my/open-yadm-file</span> <span style="color:#008000">:wk</span> <span style="color:#ba2121">"yadm file"</span>))
|
||||
</span></span></code></pre></div><h3 id="internet-and-multimedia">Internet & Multimedia</h3>
|
||||
<h4 id="notmuch">Notmuch</h4>
|
||||
<p>My notmuch config now resides in <a href="/configs/mail/">Mail.org</a>.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">unless</span> (<span style="color:#008000">or</span> <span style="color:#19177c">my/is-termux</span> <span style="color:#19177c">my/remote-server</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">let</span> ((<span style="color:#19177c">mail-file</span> (<span style="color:#00f">expand-file-name</span> <span style="color:#ba2121">"mail.el"</span> <span style="color:#19177c">user-emacs-directory</span>)))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">if</span> (<span style="color:#00f">file-exists-p</span> <span style="color:#19177c">mail-file</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">load-file</span> <span style="color:#19177c">mail-file</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#00f">message</span> <span style="color:#ba2121">"Can't load mail.el"</span>))))
|
||||
</span></span></code></pre></div><h4 id="elfeed">Elfeed</h4>
|
||||
</span></span></code></pre></div><h3 id="elfeed">Elfeed</h3>
|
||||
<p><a href="https://github.com/skeeto/elfeed">elfeed</a> is one of the most popular Emacs packages, and it’s also one in which I ended up investing a lot of effort.</p>
|
||||
<h5 id="general-settings-5">General settings</h5>
|
||||
<p>There’s a lot of stuff in this section, so it’s here and not in “Internet and Multimedia”.</p>
|
||||
<h4 id="general-settings-5">General settings</h4>
|
||||
<p>The advice there sets <code>shr-use-fonts</code> to nil while rendering HTML, so the <code>elfeed-show</code> buffer will use monospace font.</p>
|
||||
<p>Using my own fork until the modifications are merged into master.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">use-package</span> <span style="color:#19177c">elfeed</span>
|
||||
|
|
@ -4864,7 +4867,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:config</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">setq</span> <span style="color:#19177c">rmh-elfeed-org-files</span> <span style="color:#666">'</span>(<span style="color:#ba2121">"~/.emacs.d/private.org"</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">elfeed-org</span>))
|
||||
</span></span></code></pre></div><h5 id="some-additions">Some additions</h5>
|
||||
</span></span></code></pre></div><h4 id="some-additions">Some additions</h4>
|
||||
<p>Filter elfeed search buffer by the feed under the cursor.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">defun</span> <span style="color:#19177c">my/elfeed-search-filter-source</span> (<span style="color:#19177c">entry</span>)
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#ba2121">"Filter elfeed search buffer by the feed under cursor."</span>
|
||||
|
|
@ -4886,7 +4889,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">let</span> ((<span style="color:#19177c">link</span> (<span style="color:#19177c">elfeed-entry-link</span> <span style="color:#19177c">elfeed-show-entry</span>)))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">when</span> <span style="color:#19177c">link</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">eww</span> <span style="color:#19177c">link</span>))))
|
||||
</span></span></code></pre></div><h5 id="custom-faces">Custom faces</h5>
|
||||
</span></span></code></pre></div><h4 id="custom-faces">Custom faces</h4>
|
||||
<p>Setting up custom faces for certain tags to make the feed look a bit nicer.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">defface</span> <span style="color:#19177c">elfeed-videos-entry</span> <span style="color:#800">nil</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#ba2121">"Face for the elfeed entries with tag \"videos\""</span>)
|
||||
|
|
@ -4944,7 +4947,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span>(<span style="color:#19177c">advice-add</span> <span style="color:#19177c">'load-theme</span> <span style="color:#008000">:after</span> <span style="color:#00f">#'</span><span style="color:#19177c">my/update-my-theme-elfeed</span>)
|
||||
</span></span><span style="display:flex;"><span>(<span style="color:#008000">when</span> (<span style="color:#00f">fboundp</span> <span style="color:#19177c">'doom-color</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">my/update-my-theme-elfeed</span>))
|
||||
</span></span></code></pre></div><h5 id="elfeed-summary">elfeed-summary</h5>
|
||||
</span></span></code></pre></div><h4 id="elfeed-summary">elfeed-summary</h4>
|
||||
<p><a href="https://github.com/SqrtMinusOne/elfeed-summary">elfeed-summary</a> is my package that provides a feed summary interface for elfeed.</p>
|
||||
<p>The default interface of elfeed is just a list of all entries, so it gets hard to navigate when there are a lot of sources with varying frequencies of posts. This is my attempt to address this issue.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">use-package</span> <span style="color:#19177c">elfeed-summary</span>
|
||||
|
|
@ -4952,7 +4955,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:straight</span> <span style="color:#800">t</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:config</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">setq</span> <span style="color:#19177c">elfeed-summary-filter-by-title</span> <span style="color:#800">t</span>))
|
||||
</span></span></code></pre></div><h5 id="elfeed-sync">elfeed-sync</h5>
|
||||
</span></span></code></pre></div><h4 id="elfeed-sync">elfeed-sync</h4>
|
||||
<p><a href="https://github.com/SqrtMinusOne/elfeed-sync">elfeed-sync</a> is my package to sync elfeed with <a href="https://tt-rss.org/">tt-rss</a>.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">use-package</span> <span style="color:#19177c">elfeed-sync</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:straight</span> (<span style="color:#008000">:host</span> <span style="color:#19177c">github</span> <span style="color:#008000">:repo</span> <span style="color:#ba2121">"SqrtMinusOne/elfeed-sync"</span>)
|
||||
|
|
@ -4962,7 +4965,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">setq</span> <span style="color:#19177c">elfeed-sync-tt-rss-instance</span> <span style="color:#ba2121">"https://sqrtminusone.xyz/tt-rss"</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">setq</span> <span style="color:#19177c">elfeed-sync-tt-rss-login</span> <span style="color:#ba2121">"sqrtminusone"</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">setq</span> <span style="color:#19177c">elfeed-sync-tt-rss-password</span> (<span style="color:#19177c">my/password-store-get</span> <span style="color:#ba2121">"Selfhosted/tt-rss"</span>)))
|
||||
</span></span></code></pre></div><h5 id="youtube-podcasts-and-emms">YouTube, podcasts & EMMS</h5>
|
||||
</span></span></code></pre></div><h4 id="youtube-podcasts-and-emms">YouTube, podcasts & EMMS</h4>
|
||||
<p>Previously this block was opening MPV with <code>start-process</code>, but now I’ve managed to hook up MPV with EMMS. So there is the EMMS+elfeed “integration”.</p>
|
||||
<p>There are multiple kinds of entries that I want to be opened by EMMS. First, a function that returns a YouTube URL:</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">defun</span> <span style="color:#19177c">my/get-youtube-url</span> (<span style="color:#19177c">entry</span>)
|
||||
|
|
@ -5000,10 +5003,10 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:states</span> <span style="color:#666">'</span>(<span style="color:#19177c">normal</span>)
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:keymaps</span> <span style="color:#19177c">'elfeed-show-mode-map</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#ba2121">"gm"</span> <span style="color:#00f">#'</span><span style="color:#19177c">my/elfeed-add-emms</span>))
|
||||
</span></span></code></pre></div><h5 id="rdrview">rdrview</h5>
|
||||
</span></span></code></pre></div><h4 id="rdrview">rdrview</h4>
|
||||
<p><a href="https://github.com/eafer/rdrview">rdrview</a> is a command-line tool to strip webpages from clutter, extracting only parts related to the actual content. It’s a standalone port of the corresponding feature of Firefox, called <a href="https://support.mozilla.org/en-US/kb/firefox-reader-view-clutter-free-web-pages">Reader View</a>.</p>
|
||||
<p>It seems like the tool <a href="https://repology.org/project/rdrview/versions">isn’t available</a> in a whole lot of package repositories, but it’s pretty easy to compile. I’ve put together a <a href="https://github.com/SqrtMinusOne/channel-q/blob/master/rdrview.scm">Guix definition</a>, which <em>one day</em> I’ll submit to upstream.</p>
|
||||
<h6 id="integrating-rdrview-with-emacs">Integrating rdrview with Emacs</h6>
|
||||
<h5 id="integrating-rdrview-with-emacs">Integrating rdrview with Emacs</h5>
|
||||
<p>Let’s start by integrating <code>rdrview</code> with Emacs. In the general case, we want to fetch both metadata and the actual content from the page.</p>
|
||||
<p>However, the interface of <code>rdrview</code> is a bit awkward in this part, so we have the following options:</p>
|
||||
<ul>
|
||||
|
|
@ -5071,7 +5074,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">content</span> <span style="color:#666">.</span> <span style="color:#666">,</span>(<span style="color:#008000">with-temp-buffer</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">dom-print</span> <span style="color:#19177c">content</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#00f">buffer-string</span>)))))))
|
||||
</span></span></code></pre></div><h6 id="using-rdrview-from-elfeed">Using rdrview from elfeed</h6>
|
||||
</span></span></code></pre></div><h5 id="using-rdrview-from-elfeed">Using rdrview from elfeed</h5>
|
||||
<p>Because I didn’t find a smart way to advise the desired behavior into elfeed, here’s a modification of the <code>elfeed-show-refresh--mail-style</code> function with two changes:</p>
|
||||
<ul>
|
||||
<li>it uses <code>rdrview</code> to fetch the HTML;</li>
|
||||
|
|
@ -5135,14 +5138,14 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:states</span> <span style="color:#666">'</span>(<span style="color:#19177c">normal</span>)
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:keymaps</span> <span style="color:#19177c">'elfeed-show-mode-map</span>
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#ba2121">"gp"</span> <span style="color:#00f">#'</span><span style="color:#19177c">my/rdrview-elfeed-show</span>))
|
||||
</span></span></code></pre></div><h6 id="how-well-does-it-work">How well does it work?</h6>
|
||||
</span></span></code></pre></div><h5 id="how-well-does-it-work">How well does it work?</h5>
|
||||
<p>Rather ironically, it works well with sites that already ship with proper RSS, like <a href="https://protesilaos.com/">Protesilaos Stavrou’s</a> or <a href="https://karthinks.com/software/simple-folding-with-hideshow/">Karthik Chikmagalur’s</a> blogs or <a href="https://www.theatlantic.com/world/">The Atlantic</a> magazine.</p>
|
||||
<p>Of my other subscriptions, it does a pretty good job with <a href="https://www.theverge.com/">The Verge</a>, which by default sends entries truncated by the words “Read the full article”. For <a href="https://arstechnica.com/">Ars Technica</a>, it works only if the story is not large enough, otherwise the site returns its HTML-based pagination interface.</p>
|
||||
<p>For paywalled sites such as <a href="https://www.nytimes.com/">New York Times</a> or <a href="https://www.economist.com/">The Economist</a>, this usually doesn’t work (by the way, what’s the problem with providing individual RSS feeds for subscribers?). If you need this kind of thing, I’d suggest using the <a href="https://github.com/RSS-Bridge/rss-bridge">RSS-Bridge</a> project. And if something is not available, contributing business logic there definitely makes more sense than implementing workarounds in Emacs Lisp.</p>
|
||||
<h5 id="latex-and-pandoc">LaTeX and pandoc</h5>
|
||||
<h4 id="latex-and-pandoc">LaTeX and pandoc</h4>
|
||||
<p>However, I also find that I’m not really a fan of reading articles from Emacs. Somehow what works for program code doesn’t work that well for natural text. When I have to, I usually switch the Emacs theme to a light one.</p>
|
||||
<p>But the best solution I’ve found so far is to render the required articles as PDFs. I may even print out some large articles I want to read.</p>
|
||||
<h6 id="template">Template</h6>
|
||||
<h5 id="template">Template</h5>
|
||||
<p>So first, we need a LaTeX template. Pandoc already ships with one, but I don’t like it too much, so I’ve put up a template from my LaTeX styles, targeting my preferred XeLaTeX engine.</p>
|
||||
<p>The code for the template is available <a href=".emacs.d/rdrview.tex">dotfiles repo</a>. If you use LaTeX, you’ll probably be better off using your own setup. Be sure to define the following variables:</p>
|
||||
<ul>
|
||||
|
|
@ -5152,7 +5155,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
<li><code>author</code></li>
|
||||
<li><code>date</code></li>
|
||||
</ul>
|
||||
<h6 id="invoking-pandoc">Invoking pandoc</h6>
|
||||
<h5 id="invoking-pandoc">Invoking pandoc</h5>
|
||||
<p>Now that we have the template, let’s save it somewhere and store the path to a variable:</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">setq</span> <span style="color:#19177c">my/rdrview-template</span> (<span style="color:#00f">expand-file-name</span>
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#00f">concat</span> <span style="color:#19177c">user-emacs-directory</span> <span style="color:#ba2121">"rdrview.tex"</span>)))
|
||||
|
|
@ -5211,7 +5214,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> ((<span style="color:#008000">or</span> (<span style="color:#008000">and</span> (<span style="color:#00f">eq</span> <span style="color:#19177c">status</span> <span style="color:#19177c">'exit</span>) (<span style="color:#00f">></span> <span style="color:#19177c">code</span> <span style="color:#666">0</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#00f">eq</span> <span style="color:#19177c">status</span> <span style="color:#19177c">'signal</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#d2413a;font-weight:bold">user-error</span> <span style="color:#ba2121">"Error in pandoc. Check the *Pandoc* buffer"</span>))))))))))
|
||||
</span></span></code></pre></div><h6 id="opening-elfeed-entries">Opening elfeed entries</h6>
|
||||
</span></span></code></pre></div><h5 id="opening-elfeed-entries">Opening elfeed entries</h5>
|
||||
<p>Now we have everything required to open elfeed entries.</p>
|
||||
<p>Also, in my case elfeed entries come in two languages, so I have to set <code>main-lang</code> and <code>other-lang</code> variables accordingly. Here’s the main function:</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">setq</span> <span style="color:#19177c">my/elfeed-pdf-dir</span> (<span style="color:#00f">expand-file-name</span> <span style="color:#ba2121">"~/.elfeed/pdf/"</span>))
|
||||
|
|
@ -5266,7 +5269,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> <span style="color:#008000">:states</span> <span style="color:#666">'</span>(<span style="color:#19177c">normal</span>)
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#ba2121">"gv"</span> <span style="color:#00f">#'</span><span style="color:#19177c">my/elfeed-open-pdf</span>))
|
||||
</span></span></code></pre></div><p>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.</p>
|
||||
<h6 id="opening-arbitrary-sites">Opening arbitrary sites</h6>
|
||||
<h5 id="opening-arbitrary-sites">Opening arbitrary sites</h5>
|
||||
<p>As you may have noticed, we also can display arbitrary web pages with this setup, so let’s go ahead and implement that:</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">defun</span> <span style="color:#19177c">my/get-languages</span> (<span style="color:#19177c">url</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">let</span> ((<span style="color:#19177c">main-lang</span> <span style="color:#ba2121">"english"</span>)
|
||||
|
|
@ -5302,8 +5305,8 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span></code></pre></div><p>Unfortunately, this part doesn’t work that well, so we can’t just uninstall Firefox or Chromium and browse the web from a PDF viewer.</p>
|
||||
<p>The most common problem I’ve encountered is incorrectly formed pictures, such as <code>.png</code> files without the boundary info. I’m sure you’ve also come across this if you ever tried to insert a lot of Internet pictures into a LaTeX document.</p>
|
||||
<p>However, sans the pictures issue, for certain sites like Wikipedia this is usable.</p>
|
||||
<h5 id="youtube-transcripts">YouTube transcripts</h5>
|
||||
<h6 id="getting-subtitles">Getting subtitles</h6>
|
||||
<h4 id="youtube-transcripts">YouTube transcripts</h4>
|
||||
<h5 id="getting-subtitles">Getting subtitles</h5>
|
||||
<p>Finally, let’s get to transcripts.</p>
|
||||
<p>In principle, the YouTube API allows for downloading subtitles, but I’ve found <a href="https://github.com/jdepoix/youtube-transcript-api">this awesome Python script</a> which does the same. You can install it from <code>pip</code>, or here’s mine <a href="https://github.com/SqrtMinusOne/channel-q/blob/master/youtube-transcript-api.scm">Guix definition</a> once again.</p>
|
||||
<p>Much like the previous cases, we need to invoke the program and save the output. The <a href="https://en.wikipedia.org/wiki/WebVTT">WebVTT</a> format will work well enough for our purposes. Here comes the function:</p>
|
||||
|
|
@ -5346,7 +5349,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> (<span style="color:#00f">kill-buffer</span> (<span style="color:#00f">process-buffer</span> <span style="color:#19177c">process</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#d2413a;font-weight:bold">user-error</span> <span style="color:#ba2121">"Error in youtube_transcript_api: %s"</span> <span style="color:#19177c">err</span>)))))))
|
||||
</span></span><span style="display:flex;"><span> <span style="color:#19177c">proc</span>)))
|
||||
</span></span></code></pre></div><h6 id="elfeed-and-subed">elfeed and subed</h6>
|
||||
</span></span></code></pre></div><h5 id="elfeed-and-subed">elfeed and subed</h5>
|
||||
<p>Now that we have a standalone function, let’s invoke it with the current <code>elfeed-show-entry</code>:</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">setq</span> <span style="color:#19177c">my/elfeed-srt-dir</span> (<span style="color:#00f">expand-file-name</span> <span style="color:#ba2121">"~/.elfeed/srt/"</span>))
|
||||
</span></span><span style="display:flex;"><span>
|
||||
|
|
@ -5396,7 +5399,15 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">setq-local</span> <span style="color:#19177c">subed-mpv-video-file</span> (<span style="color:#19177c">elfeed-entry-link</span> <span style="color:#19177c">entry</span>))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">subed-mpv--play</span> <span style="color:#19177c">subed-mpv-video-file</span>))
|
||||
</span></span></code></pre></div><p>Keep in mind that this function has to be launched inside the buffer opened by the <code>my/elfeed-youtube-subtitles</code> function.</p>
|
||||
<h4 id="emms">EMMS</h4>
|
||||
<h3 id="internet-and-multimedia">Internet & Multimedia</h3>
|
||||
<h4 id="notmuch">Notmuch</h4>
|
||||
<p>My notmuch config now resides in <a href="/configs/mail/">Mail.org</a>.</p>
|
||||
<div class="highlight"><pre tabindex="0" style=";-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-emacs-lisp" data-lang="emacs-lisp"><span style="display:flex;"><span>(<span style="color:#008000">unless</span> (<span style="color:#008000">or</span> <span style="color:#19177c">my/is-termux</span> <span style="color:#19177c">my/remote-server</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">let</span> ((<span style="color:#19177c">mail-file</span> (<span style="color:#00f">expand-file-name</span> <span style="color:#ba2121">"mail.el"</span> <span style="color:#19177c">user-emacs-directory</span>)))
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#008000">if</span> (<span style="color:#00f">file-exists-p</span> <span style="color:#19177c">mail-file</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#19177c">load-file</span> <span style="color:#19177c">mail-file</span>)
|
||||
</span></span><span style="display:flex;"><span> (<span style="color:#00f">message</span> <span style="color:#ba2121">"Can't load mail.el"</span>))))
|
||||
</span></span></code></pre></div><h4 id="emms">EMMS</h4>
|
||||
<p>EMMS is the Emacs Multi-Media System. I use it to control MPD & MPV.</p>
|
||||
<p>References:</p>
|
||||
<ul>
|
||||
|
|
@ -6301,6 +6312,7 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
<li><a href="#doom-themes">Doom themes</a></li>
|
||||
<li><a href="#custom-theme">Custom theme</a></li>
|
||||
<li><a href="#dim-inactive-buffers">Dim inactive buffers</a></li>
|
||||
<li><a href="#toggle-light-dark">Toggle light/dark</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#fonts">Fonts</a>
|
||||
|
|
@ -6525,10 +6537,22 @@ Emacs is also particularly good at writing Lisp code, e.g. Clojure, Common Lisp,
|
|||
<li><a href="#open-a-dotfile">Open a dotfile</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#elfeed">Elfeed</a>
|
||||
<ul>
|
||||
<li><a href="#general-settings-5">General settings</a></li>
|
||||
<li><a href="#some-additions">Some additions</a></li>
|
||||
<li><a href="#custom-faces">Custom faces</a></li>
|
||||
<li><a href="#elfeed-summary">elfeed-summary</a></li>
|
||||
<li><a href="#elfeed-sync">elfeed-sync</a></li>
|
||||
<li><a href="#youtube-podcasts-and-emms">YouTube, podcasts & EMMS</a></li>
|
||||
<li><a href="#rdrview">rdrview</a></li>
|
||||
<li><a href="#latex-and-pandoc">LaTeX and pandoc</a></li>
|
||||
<li><a href="#youtube-transcripts">YouTube transcripts</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#internet-and-multimedia">Internet & Multimedia</a>
|
||||
<ul>
|
||||
<li><a href="#notmuch">Notmuch</a></li>
|
||||
<li><a href="#elfeed">Elfeed</a></li>
|
||||
<li><a href="#emms">EMMS</a></li>
|
||||
<li><a href="#ytel">ytel</a></li>
|
||||
<li><a href="#wallabag">wallabag</a></li>
|
||||
|
|
|
|||
BIN
stats/all.png
BIN
stats/all.png
Binary file not shown.
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 122 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
Loading…
Add table
Reference in a new issue