fixing a bunch of broken stuff I think

This commit is contained in:
Chris Cochrun 2022-02-25 14:16:41 -06:00
parent 0dbc3ead0e
commit 8bace887a2
1551 changed files with 299 additions and 57481 deletions

View file

@ -1,141 +0,0 @@
<p>Emacs has multiple built-in libraries for folding code, as is the case for most things Emacs. The default interface it exposes for folding functions is unwieldy and cumbersome, as is the case for most things Emacs.</p>
<p>There is some overlap between Hideshow-mode and Outline-minor-mode. The latter is mainly for folding and navigating nested Org-like headings, but can be extended with the Foldout library. (Also included in Emacs!) The former works well to hide nested blocks of code. Both libraries use regular expressions and only support a few languages out of the box, so tree-sitter based folding is going to be a welcome addition whenever it arrives. But thats a story for another day. Todays problem is the user interface, which is independent of the folding backend.</p>
<p>Heres the keymap for folding-related functions in the two modes:</p>
<table>
<thead>
<tr>
<th>Key binding</th>
<th>Hideshow mode</th>
<th>Key binding</th>
<th>Outline minor mode</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>C-c @ C-a</code></td>
<td><code>hs-show-all</code></td>
<td><code>C-c @ TAB</code></td>
<td><code>outline-show-children</code></td>
</tr>
<tr>
<td><code>C-c @ C-c</code></td>
<td><code>hs-toggle-hiding</code></td>
<td><code>C-c @ C-k</code></td>
<td><code>outline-show-branches</code></td>
</tr>
<tr>
<td><code>C-c @ C-d</code></td>
<td><code>hs-hide-block</code></td>
<td><code>C-c @ C-o</code></td>
<td><code>outline-hide-other</code></td>
</tr>
<tr>
<td><code>C-c @ C-e</code></td>
<td><code>hs-toggle-hiding</code></td>
<td><code>C-c @ C-q</code></td>
<td><code>outline-hide-sublevels</code></td>
</tr>
<tr>
<td><code>C-c @ C-h</code></td>
<td><code>hs-hide-block</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>C-c @ C-l</code></td>
<td><code>hs-hide-level</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>C-c @ C-s</code></td>
<td><code>hs-show-block</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>C-c @ C-t</code></td>
<td><code>hs-hide-all</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>C-c @ ESC</code></td>
<td><code>Prefix Command</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>C-c @ C-M-h</code></td>
<td><code>hs-hide-all</code></td>
<td></td>
<td></td>
</tr>
<tr>
<td><code>C-c @ C-M-s</code></td>
<td><code>hs-show-all</code></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>This is irritating on two levels.</p>
<ul>
<li>The key bindings are on a difficult to use keymap.</li>
<li>Theres no easy entry point and there are too many commands to do simple tasks.</li>
</ul>
<p>The former is easily rectified by rebinding keys or defining a transient/hydra menu, but the latter takes more work. Designing a better interface to Outline modes folding functions was one of the original reasons for the creation of Org mode, which did a bang-up job: Theres no learning curve to cycling Org headings with <code>TAB</code>. It <strong>just works</strong> and theres nothing to look up or remember!</p>
<p>As of Emacs 28, Outline-mode and its minor-mode variant have acquired <code>outline-cycle</code>, a convenient fold cycling function inspired by Org. If youre on an older Emacs, there are packages for this: <a href="https://github.com/tarsius/bicycle">bicycle</a> and <a href="https://github.com/alphapapa/outshine">outshine</a>. For Hideshow mode theres <a href="https://melpa.org/#/hideshow-org">hideshow-org</a>, but this bugged out for me because it makes assumptions about the behavior of my already overloaded <code>TAB</code> key.</p>
<p>So I took a crack at making a simple Org-like one-key interface to Hideshow.</p>
<div style="width: 100%; height: 0px;"><p><a href="https://karthinks.com/img/hs-cycle.mp4">[HIDESHOW CYCLE DEMO]</a></p></div>
<p>(<a href="https://karthinks.com/img/hs-cycle.mp4">Direct link</a> to demo if the embed fails to load.)</p>
<p>Heres how it works (bind it to whatever, its <code>C-TAB</code> here):</p>
<ul>
<li><code>C-TAB</code> to cycle between showing unfolded, folded and showing children. (Same as Org)</li>
<li><code>C-TAB</code> with a prefix argument to show arg levels. <em>i.e.</em> <code>C-3 C-TAB</code> will show unfolded up to the third level.</li>
<li><code>C-S-TAB</code> to fold/unfold the whole buffer.</li>
</ul>
<p>I find myself calling <code>hs-cycle</code> with a numeric level as the prefix arg all the time to get a top-down overview of code at different levels of detail. Here are three views of the same function, folded and unfolded to levels 2 and 4:
<img alt="" src="https://karthinks.com/img/hs-cycle-level.png" /></p>
<p>Thats it. This combines <code>hs-show-all</code>, <code>hs-hide-all</code>, <code>hs-show-block</code>, <code>hs-hide-block</code>, <code>hs-toggle-hiding</code> and <code>hs-hide-level</code> into two commands with a hopefully familiar usage pattern. Its not much code either:</p>
<div class="highlight"><pre><code class="language-emacs-lisp">(<span style="color: #007020;">defun</span> <span style="color: #963;">hs-cycle</span> (<span style="color: #038; font-weight: bold;">&amp;optional</span> <span style="color: #963;">level</span>)
(<span style="color: #007020;">interactive</span> <span style="background-color: #fff0f0;">"p"</span>)
(<span style="color: #007020;">let</span> (<span style="color: #963;">message-log-max</span>
(<span style="color: #963;">inhibit-message</span> <span style="color: #036; font-weight: bold;">t</span>))
(<span style="color: #007020;">if</span> (<span style="color: #06b; font-weight: bold;">=</span> <span style="color: #963;">level</span> <span style="color: #00d; font-weight: bold;">1</span>)
(<span style="color: #007020;">pcase</span> <span style="color: #963;">last-command</span>
(<span style="color: #a60; background-color: #fff0f0;">'hs-cycle</span>
(<span style="color: #963;">hs-hide-level</span> <span style="color: #00d; font-weight: bold;">1</span>)
(<span style="color: #007020;">setq</span> <span style="color: #963;">this-command</span> <span style="color: #a60; background-color: #fff0f0;">'hs-cycle-children</span>))
(<span style="color: #a60; background-color: #fff0f0;">'hs-cycle-children</span>
<span style="color: #888;">;; TODO: Fix this case. `hs-show-block' needs to be</span>
<span style="color: #888;">;; called twice to open all folds of the parent</span>
<span style="color: #888;">;; block.</span>
(<span style="color: #007020;">save-excursion</span> (<span style="color: #963;">hs-show-block</span>))
(<span style="color: #963;">hs-show-block</span>)
(<span style="color: #007020;">setq</span> <span style="color: #963;">this-command</span> <span style="color: #a60; background-color: #fff0f0;">'hs-cycle-subtree</span>))
(<span style="color: #a60; background-color: #fff0f0;">'hs-cycle-subtree</span>
(<span style="color: #963;">hs-hide-block</span>))
(<span style="color: #963;">_</span>
(<span style="color: #007020;">if</span> (<span style="color: #963;">not</span> (<span style="color: #963;">hs-already-hidden-p</span>))
(<span style="color: #963;">hs-hide-block</span>)
(<span style="color: #963;">hs-hide-level</span> <span style="color: #00d; font-weight: bold;">1</span>)
(<span style="color: #007020;">setq</span> <span style="color: #963;">this-command</span> <span style="color: #a60; background-color: #fff0f0;">'hs-cycle-children</span>))))
(<span style="color: #963;">hs-hide-level</span> <span style="color: #963;">level</span>)
(<span style="color: #007020;">setq</span> <span style="color: #963;">this-command</span> <span style="color: #a60; background-color: #fff0f0;">'hs-hide-level</span>))))
(<span style="color: #007020;">defun</span> <span style="color: #963;">hs-global-cycle</span> ()
(<span style="color: #007020;">interactive</span>)
(<span style="color: #007020;">pcase</span> <span style="color: #963;">last-command</span>
(<span style="color: #a60; background-color: #fff0f0;">'hs-global-cycle</span>
(<span style="color: #007020;">save-excursion</span> (<span style="color: #963;">hs-show-all</span>))
(<span style="color: #007020;">setq</span> <span style="color: #963;">this-command</span> <span style="color: #a60; background-color: #fff0f0;">'hs-global-show</span>))
(<span style="color: #963;">_</span> (<span style="color: #963;">hs-hide-all</span>))))
</code></pre></div><details>
Note to future self
<div class="details">
<p>This code looks like it has some redundant clauses you can refactor using <code>hs-already-hidden-p</code>, and like you dont need to set <code>last-command</code> for all the clauses. Dont try this, it breaks in subtle ways.</p>
</div>
</details>

View file

@ -1 +0,0 @@
<table> <tr><td> <a href="https://www.reddit.com/r/unixporn/comments/r4gm15/plasma_fractal_flower/"> <img src="https://preview.redd.it/if2x4avq0f281.png?width=640&amp;crop=smart&amp;auto=webp&amp;s=9678b73bdfc5159ec284c53fa3cc65ce14853651" alt="[Plasma] Fractal flower" title="[Plasma] Fractal flower" /> </a> </td><td> &#32; submitted by &#32; <a href="https://www.reddit.com/user/juacq97"> /u/juacq97 </a> <br/> <span><a href="https://i.redd.it/if2x4avq0f281.png">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/unixporn/comments/r4gm15/plasma_fractal_flower/">[comments]</a></span> </td></tr></table>

View file

@ -1 +0,0 @@
&#32; submitted by &#32; <a href="https://www.reddit.com/user/MatthewZMD"> /u/MatthewZMD </a> <br/> <span><a href="https://www.youtube.com/watch?v=bh37zbefZk4">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/emacs/comments/r4m6ix/emacsconf2021_emacs_application_framework_a_2021/">[comments]</a></span>

View file

@ -1 +0,0 @@
<table> <tr><td> <a href="https://www.reddit.com/r/unixporn/comments/rspv6j/i3gaps_yoimiya/"> <img src="https://preview.redd.it/65hq2l29gu881.png?width=640&amp;crop=smart&amp;auto=webp&amp;s=555f79270952cf86bb334acb56444263c5aa82b4" alt="[i3-gaps] Yoimiya" title="[i3-gaps] Yoimiya" /> </a> </td><td> &#32; submitted by &#32; <a href="https://www.reddit.com/user/meimei36"> /u/meimei36 </a> <br/> <span><a href="https://i.redd.it/65hq2l29gu881.png">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/unixporn/comments/rspv6j/i3gaps_yoimiya/">[comments]</a></span> </td></tr></table>

View file

@ -1 +0,0 @@
<!-- SC_OFF --><div class="md"><p>Is there a way to make more demanding programs / games to use the amd gpu by default?</p> <p>edit: what if I have 100+ games installed? Then I would have to manually edit every .desktop file to add DRI_PRIME=1 at the beginning of the command. This is a terrible user experience</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/zsido_cia_ugynok"> /u/zsido_cia_ugynok </a> <br/> <span><a href="https://www.reddit.com/r/archlinux/comments/r3a59p/i_have_to_manually_set_games_to_run_on_my_amd_gpu/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/archlinux/comments/r3a59p/i_have_to_manually_set_games_to_run_on_my_amd_gpu/">[comments]</a></span>

View file

@ -1 +0,0 @@
&#32; submitted by &#32; <a href="https://www.reddit.com/user/qrider70"> /u/qrider70 </a> <br/> <span><a href="/r/emacs/comments/r7ghu5/question_about_statistics_cookie_for_todos/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/orgmode/comments/r8hr3t/question_about_statistics_cookie_for_todos/">[comments]</a></span>

View file

@ -1 +0,0 @@
<!-- SC_OFF --><div class="md"><p>I setup my system with iwd, which works fine 99% of times. I feel comfortable with iwctl and I am satisfied. The only edge case I found so far is connecting to wifi using a public hotspot. They usually offer a free wifi network with a welcome/login page that you are redirected to (that gets prompted ragardless the address you type in your browser).</p> <p>My issue is that I am never able to land to that page. It happened already a couple of times, so I think there&#39;s something wrong with my configuration and I decided to fix it.</p> <p>I feel it&#39;s something related to DNS, but I am not sure of it. After playing a bit with systemd-resolved, removing custom config and resetting default config file, it says that the DNS server for my link is the correct one (dns server is now the local address 192.168.x.y of the network I am connected to) but nevertheless is am not able to ping it.</p> <p>I also tried to reset iptables by loading stock simple-firewall configuration.</p> <p>Can you give a couple of bullet points to check in order to debug this issue?</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/-elmuz-"> /u/-elmuz- </a> <br/> <span><a href="https://www.reddit.com/r/archlinux/comments/qyw33x/connecting_to_login_page_of_wifi_hotspot_from/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/archlinux/comments/qyw33x/connecting_to_login_page_of_wifi_hotspot_from/">[comments]</a></span>

View file

@ -1 +0,0 @@
<table> <tr><td> <a href="https://www.reddit.com/r/unixporn/comments/pobf38/xfce_no_title/"> <img src="https://preview.redd.it/edascdoj7jn71.png?width=640&amp;crop=smart&amp;auto=webp&amp;s=abe185c86d8100aae3009f1ec8c4aa8ef49a5243" alt="[XFCE] no title" title="[XFCE] no title" /> </a> </td><td> &#32; submitted by &#32; <a href="https://www.reddit.com/user/san-daniel"> /u/san-daniel </a> <br/> <span><a href="https://i.redd.it/edascdoj7jn71.png">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/unixporn/comments/pobf38/xfce_no_title/">[comments]</a></span> </td></tr></table>

View file

@ -1 +0,0 @@
<table> <tr><td> <a href="https://www.reddit.com/r/unixporn/comments/r1jfwt/sway_simple_colorful_desktop_for_everyday_use/"> <img src="https://preview.redd.it/1ohfkh0ozm181.jpg?width=640&amp;crop=smart&amp;auto=webp&amp;s=a2609a813d1f45cb189761cc7e585d2a7ea51147" alt="[Sway] Simple, colorful desktop for everyday use." title="[Sway] Simple, colorful desktop for everyday use." /> </a> </td><td> &#32; submitted by &#32; <a href="https://www.reddit.com/user/RicArch97"> /u/RicArch97 </a> <br/> <span><a href="https://i.redd.it/1ohfkh0ozm181.jpg">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/unixporn/comments/r1jfwt/sway_simple_colorful_desktop_for_everyday_use/">[comments]</a></span> </td></tr></table>

View file

@ -1,48 +0,0 @@
<p>
As I found the documentation for adding a self-hosted instance of GitLab to to
magit/forge a bit difficult, I thought I'd write a note for my future self (and
anyone else who might find it useful).
</p>
<p>
First put the following in `~/.gitconfig`
</p>
<div class="org-src-container">
<pre class="src src-gitconfig">[<span class="org-type">gitlab</span> <span class="org-function-name">"gitlab.private.com/api/v4"</span>]
<span class="org-variable-name">user</span> = my.username
</pre>
</div>
<p>
Then create an access token on GitLab. I ticked <code>api</code> and <code>write_repository</code>,
which seems to work fine so far. Put the token in <code>~/.authinfo.gpg</code>
</p>
<div class="org-src-container">
<pre class="src src-authinfo"><span class="org-variable-name">machine</span> <span class="org-builtin">gitlab.private.com/api/v4</span> <span class="org-comment-delimiter">login</span> <span class="org-keyword">my.user^forge</span> <span class="org-comment-delimiter">password</span> <span class="org-doc">&lt;token&gt;</span>
</pre>
</div>
<p>
(Remember that a newline is needed at the end of the file.)
</p>
<p>
Finally, add the GitLab instance to <code>'forge-alist</code>
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-keyword">setq</span>
forge-alist
'<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">"gitlab.private.com"</span> <span class="org-string">"gitlab.private.com/api/v4"</span> <span class="org-string">"gitlab.private.com"</span> forge-gitlab-repository<span class="org-rainbow-delimiters-depth-3">)</span>
<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">"github.com"</span> <span class="org-string">"api.github.com"</span> <span class="org-string">"github.com"</span> forge-github-repository<span class="org-rainbow-delimiters-depth-3">)</span>
<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">"gitlab.com"</span> <span class="org-string">"gitlab.com/api/v4"</span> <span class="org-string">"gitlab.com"</span> forge-gitlab-repository<span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>
<span class="org-rainbow-delimiters-depth-1">)</span>
</pre>
</div>
<p>
That's it!
</p>
<div class="taglist"><a href="https://magnus.therning.org/tags.html">Tags</a>: <a href="https://magnus.therning.org/tag-emacs.html">emacs</a> <a href="https://magnus.therning.org/tag-git.html">git</a> <a href="https://magnus.therning.org/tag-magit.html">magit</a> </div>

View file

@ -1 +0,0 @@
<!-- SC_OFF --><div class="md"><pre><code>2021-10-13 12:05:18: PyRun_SimpleFile launching application server... 2021-10-13 12:05:18: Failed to launch the application server, server thread exiting. 2021-10-13 12:05:21: An error occurred initialising the pgAdmin 4 server: Failed to launch the application server, server thread exiting. </code></pre> <p>I&#39;m trying DBeaver but prefer pgAdmin</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/gmfthelp"> /u/gmfthelp </a> <br/> <span><a href="https://www.reddit.com/r/archlinux/comments/q78tn6/pgadmin4_has_anyone_got_round_the_starting_errors/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/archlinux/comments/q78tn6/pgadmin4_has_anyone_got_round_the_starting_errors/">[comments]</a></span>

View file

@ -1 +0,0 @@
<!-- SC_OFF --><div class="md"><p>We finally have crossed the 200k members line a few hours ago - <a href="https://i.imgur.com/4Fvt9Qf.png">https://i.imgur.com/4Fvt9Qf.png</a></p> <p>The community is growing strong thanks to much internal, but also external work. While we all know that we&#39;re not always the best we could be - I think it is fair to say that we are a great group of people who are willing to take time to help others wherever possible. Let&#39;s go on with that.</p> <p>Thanks everyone 💙</p> <p><sup>Here are some more stats:</sup> <a href="https://subredditstats.com/r/archlinux"><sup>https://subredditstats.com/r/archlinux</sup></a></p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/fabi_sh"> /u/fabi_sh </a> <br/> <span><a href="https://www.reddit.com/r/archlinux/comments/r3bdm6/congratulations_rarchlinux_for_200000_members_and/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/archlinux/comments/r3bdm6/congratulations_rarchlinux_for_200000_members_and/">[comments]</a></span>