<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>Snamellit - emacs</title>
      <link>https://www.snamellit.com</link>
      <description></description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://www.snamellit.com/tags/emacs/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Sat, 28 Jun 2025 13:15:00 +0200</lastBuildDate>
      <item>
          <title>Consolidating Secrets in Pass</title>
          <pubDate>Sat, 28 Jun 2025 13:15:00 +0200</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20250628t131556-consolidating-secrets-in-pass-emacs-linux-security/</link>
          <guid>https://www.snamellit.com/posts/20250628t131556-consolidating-secrets-in-pass-emacs-linux-security/</guid>
          <description xml:base="https://www.snamellit.com/posts/20250628t131556-consolidating-secrets-in-pass-emacs-linux-security/">&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;
&lt;p&gt;Like a lot of people I&#39;ve had  a long history managing passwords and
secrets over the years.  From a little black book, over an Excel sheet,
using a GPG encoded secrets file (works really well with Emacs gpg
support), 1password (till they racked up their prices), lastpass (till
they got bought by the Evil LogMeIn Corp), KeepassXC and lately &lt;a rel=&quot;external&quot; href=&quot;https://passwordstore.org&quot;&gt;pass&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I was perfectly happy with KeepassXC for a very long time, except for
the command line integration.  So I kept ending up with passwords in
&lt;strong&gt;.envrc&lt;/strong&gt; files in folders and excluded in the global &lt;strong&gt;.gitignore&lt;/strong&gt; to avoid
too many red cheeks.  While this does keep secrets out of harms way
mostly, it kept nagging that I had them in plain text in those
files.  In theory there is &lt;strong&gt;keepassxc-cli&lt;/strong&gt; to query the passwords from
the command line, but let&#39;s say the experience does not spark joy.  It
has no easy way to cache the password between calls and it is
optimized for interactive use.  (AFAICT, just the giant size of the
command to type gives me dread).&lt;/p&gt;
&lt;p&gt;Some day I stumbled over &lt;strong&gt;pass&lt;/strong&gt; and found that after setup I could just
&lt;code&gt;pass snamellit/website&lt;/code&gt; to get the password on stdout.  I &lt;a rel=&quot;external&quot; href=&quot;https://www.snamellit.com/blog/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/&quot;&gt;wrote about
the setup and emacs integration in a previous post&lt;/a&gt;. Since it
leverage gpg, password caching is handled by the gpg-agent and my
&lt;strong&gt;.envrc&lt;/strong&gt; files quickly were purged of blasphemous secrets, replace by
pure bliss:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;export&lt;/span&gt;&lt;span&gt; MY_SECRET&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pass&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; my/secret&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;export&lt;/span&gt;&lt;span&gt; OTHER_SECRET&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pass&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; other/secret&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;similarly in emacs I can consistently get my passwords and related
info with:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(org-gcal-client-id (auth-source-pass-get &amp;#39;secret &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;snamellit/org-gcal-client&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(org-gcal-client-secret (auth-source-pass-get &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;snamellit/org-gcal-client&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When needed the &lt;strong&gt;gpg-agent&lt;/strong&gt; will launch the appropriate pin-entry
program whether in terminal or in the GUI and the caching will not
force me to login several times when entering the folder.&lt;/p&gt;
&lt;p&gt;So I ended up with my interactive use covered by &lt;strong&gt;KeepassXC&lt;/strong&gt; and
automated use by &lt;strong&gt;pass&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;However, after some time I ended up with hundreds of secrets in
&lt;strong&gt;KeepassXC&lt;/strong&gt;, hundreds in &lt;strong&gt;pass&lt;/strong&gt;, it is not always clear whether use is
interactive or automated so confusion and duplication starts and
things become harder to manage.  In addition &lt;strong&gt;KeepassXC&lt;/strong&gt; was using
historically Dropbox to make it available on all my devices, recently
migrated to Nextcloud, which has issues with dealing with conflicts
which occasionally bite me in the behind.  On the other hand &lt;strong&gt;pass&lt;/strong&gt;
secrets are stored encrypted in git where conflict punch you in the
face.  I prefer the latter.  And started contemplating whether to move
everything to pass.&lt;/p&gt;
&lt;p&gt;Thanks to the encouragement of SummerEmacs, one of the more
enthusiastic SystemCrafters, ensuring the great experience in browsers
and iOS mobile devices I had no more excuses to keep postponing it.&lt;/p&gt;
&lt;h2 id=&quot;preparation&quot;&gt;Preparation&lt;/h2&gt;
&lt;p&gt;I started out with keeping my pass passwords as part of my
dotfiles.   This was convenient when they were few.  However this is
&lt;span class=&quot;underline&quot;&gt;weird&lt;/span&gt; so this will attract &lt;span class=&quot;underline&quot;&gt;weirdness&lt;/span&gt; when configuring all integrations
I&#39;ll need.&lt;/p&gt;
&lt;p&gt;Also &lt;strong&gt;pass&lt;/strong&gt; supports a &lt;strong&gt;git&lt;/strong&gt; command to manage the password-store with git
which is not really useful when it is part of something else.   So the
first order of the day is to move all secrets to a separate repository
and update the &lt;strong&gt;dotfiles&lt;/strong&gt; to check for presence and clone the repo if
missing (and do a gently pull when it is).
A quick visit to each of the machines in my machine park to apply this
change.
Everything still seems to be working.&lt;/p&gt;
&lt;h2 id=&quot;migration-of-the-keepassxc-data&quot;&gt;Migration of the KeepassXC data&lt;/h2&gt;
&lt;p&gt;I used the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/roddhjav/pass-import&quot;&gt;pass-import&lt;/a&gt; tool which adds in &lt;strong&gt;import&lt;/strong&gt; command to pass which
supports a crazy amount of password managers, including keepassxc.  For
keepassxc it need the &lt;strong&gt;pykeepass&lt;/strong&gt;.  If you&#39;re running on Arch, everything
is a &lt;code&gt;yay -S&lt;/code&gt; away.  However on Ubuntu and its derivatives it is the
usual slog we start to get accustomed to.  It&#39;s all in the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/roddhjav/pass-import&quot;&gt;pass-import
README&lt;/a&gt; , note that on Ubunty the &lt;strong&gt;pykeepass&lt;/strong&gt; library is available with
&lt;code&gt;apt install python3-pykeepass&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Once it is installed I tried  a dry run (with the &lt;code&gt;-d&lt;/code&gt; flag) to see if
basic functionality is working&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pass&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; import -a -d keepassxc ~/Nextcloud/Apps/Keepassxc/Passwords.kdbx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Password&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; for /home/pti/Nextcloud/Apps/Keepassxc/Passwords.kdbx:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Data would be imported from keepassxc to pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   Passwords imported from: /home/pti/Nextcloud/Apps/Keepassxc/Passwords.kdbx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   Passwords exported to: /home/pti/.password-store&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   Number of password imported:&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2035&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   All data imported&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Weak password detected: eDGQqipE might be weak.  Score&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (100000001&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guesses&lt;/span&gt;&lt;span&gt;).  This estimate is based on the sequence eDGQqipE(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;bruteforce&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Weak password detected: eDGQqipE might be weak.  Score&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (100000001&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guesses&lt;/span&gt;&lt;span&gt;).  This estimate is based on the sequence eDGQqipE(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;bruteforce&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Weak password detected: eDGQqipE might be weak.  Score&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (100000001&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guesses&lt;/span&gt;&lt;span&gt;).  This estimate is based on the sequence eDGQqipE(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;bruteforce&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  large list of names of secrets&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This asks for the password of the Keepass file and some remarks it
has.&lt;/p&gt;
&lt;p&gt;This all looks reasonable.  So we can try the import.  Since the
password-store is a git repo no real damage can be done to it (as it
is safely pushed somewhere else where the import tool cannot touch it)
and any damage done can be reverted....&lt;/p&gt;
&lt;p&gt;Now is a good time to check if the mooring lines of your laptop are
properly secured as encrypting all the secrets will spin up the
propellors if the number is large enough.&lt;/p&gt;
&lt;p&gt;I run it again without the &lt;code&gt;-d&lt;/code&gt; flag and after several minutes the
noise dies down and I am left with a lot of additional folders in my
&lt;code&gt;~/.password-store&lt;/code&gt; which match the grouping in KeepassXC.  The files
contain the secrets and the expected metadata.  This looks good so I
add/commit the things to complete the level.&lt;/p&gt;
&lt;h2 id=&quot;integration-with-ios-for-my-iphone&quot;&gt;Integration with iOS for my iPhone&lt;/h2&gt;
&lt;p&gt;Let&#39;s start with the most scary one : the iPhone.&lt;/p&gt;
&lt;p&gt;Upon recommendation I had installed &lt;strong&gt;passforios&lt;/strong&gt; which needs to be
configured.&lt;/p&gt;
&lt;p&gt;Configuring the host, repo and username to use for the git repository
is straightforward enough.&lt;/p&gt;
&lt;p&gt;I always use ssh to access my repos so we need to add an ssh keypair
for this purpose.  There is no support to generate key-pairs in
passforios for reasons, so I have to do it externally and upload the
key. A quick &lt;code&gt;ssh-keygen&lt;/code&gt; , uploading the public key to the forge,
allowing access to the repo and if I can get the private key on my
phone we can access the repo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;passforios&lt;/strong&gt; has a nice feature to load ascii armored keys via a QR
code. A bit digging surfaced the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/yishilin14/asc-key-to-qr-code-gif&quot;&gt;asc-key-to-qr-code-gif tool&lt;/a&gt; which
was made for this specific purpose. The ssh key is already in the
appropriate format so this can be directly converted&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;./asc-to-gif.sh&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.ssh/id-passforios ssh-pub.gif&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ssh-pub.gif&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then go to the repository settings, press the circled i  on the &lt;strong&gt;SSH
Key&lt;/strong&gt; button, select the ASCII-Armor Key and click to scan the QR
code. Point the camera to the QR code on the screen and it should
appear in the key field in the app.&lt;/p&gt;
&lt;p&gt;We have to repeat this 2 more times to get the private and public key
for the password-store into the app. First exporting the keys&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --export -a 1234ABCD&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;gpg.pub&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --export-secret-key -a 1234ABCD&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;gpg.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;converting to a gif, displaying them and scanning them in *Settings -&amp;gt;
PGP Key -&amp;gt; ASCII-Armor Key in the respective fields.&lt;/p&gt;
&lt;p&gt;If, after synching, you go now to the Passwords you should be greeted
with a listing of all folders and keys and the secrets should be
visible if made visible by tapping the eye icon.&lt;/p&gt;
&lt;p&gt;I needed to enable &lt;strong&gt;passforios&lt;/strong&gt; as a source for autofill : Settings -&amp;gt;
Passwords -&amp;gt; Autofill Passwords and slide the toggle for &lt;strong&gt;Pass&lt;/strong&gt;. I also
disabled the toggle for &lt;strong&gt;Strongbox&lt;/strong&gt; which I was using for integration
with the Keepass database.&lt;/p&gt;
&lt;p&gt;Now I see the option to select the secrets from the &lt;strong&gt;passforios&lt;/strong&gt; app. It
does not narrow down to the right key, but that is a problem for
future me.&lt;/p&gt;
&lt;p&gt;Ok, the hard part is done. Or at least the most risky part, ... in my
eyes... whatever. Moving on...&lt;/p&gt;
&lt;h2 id=&quot;integration-with-firefox&quot;&gt;Integration with FireFox&lt;/h2&gt;
&lt;p&gt;Checking at the bottom of the &lt;a rel=&quot;external&quot; href=&quot;https://www.passwordstore.org/&quot;&gt;pass website&lt;/a&gt; we find that &lt;strong&gt;passff&lt;/strong&gt; is the
good stuff for integration with FireFox.  From previous adventures with
KeepassXC and NativeMessaging I assumed there had to be a host part to
be installed too.&lt;/p&gt;
&lt;p&gt;Indeed we are directed to the &lt;a rel=&quot;external&quot; href=&quot;https://codeberg.org/PassFF/passff-host&quot;&gt;passff-host github repo&lt;/a&gt; to get an
install-script which generates the native messaging json for the
different browsers and a small executable python script which contains
remarkable clean and no-dependency code.  Similarly the install script
is straightforward. I do not understand why it support half a dozen
browser, mostly chrome based as for the life of me I cannot find an
extension which uses this host program.  So either I need bigger
glasses or there is some knowledge beyond my grasp.&lt;/p&gt;
&lt;p&gt;Running the installer, installing the extension, restarting firefox
for good luck and the extension appears and offers passwords on the
sites I try.&lt;/p&gt;
&lt;p&gt;Out of curiosity I check the configuration in
~.mozilla/native-messaging :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls .mozilla/native-messaging-hosts/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;org.keepassxc.keepassxc_browser.json&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  passff.json  passff.py&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat .mozilla/native-messaging-hosts/passff.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;name&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;passff&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;description&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Host for communicating with zx2c4 pass&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;path&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/home/pti/.mozilla/native-messaging-hosts/passff.py&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;type&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;stdio&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;allowed_extensions&amp;quot;:&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;passff@invicem.pro&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat .mozilla/native-messaging-hosts/passff.py&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#!/usr/bin/python3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    Host application of the browser extension PassFF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    that wraps around the zx2c4 pass script.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nothing out of the ordinary, the passff.py python is the same as in
the repo.  My old keepassxc extension support is still there.&lt;/p&gt;
&lt;p&gt;Firefox is installed natively on this machine, not with a flatpak
which I assume will come with its own challenges.&lt;/p&gt;
&lt;h2 id=&quot;chromium-support&quot;&gt;Chromium Support&lt;/h2&gt;
&lt;p&gt;Time to tackle the Chrome family. Chrome is required to put food on
the table so we have to get that going eventually. But Chrome is
distributed as a flatpak (or a snap but I am &lt;strong&gt;NOT&lt;/strong&gt; going to deal with
that), and I can install Chromium natively, and apparently native
installs are &lt;strong&gt;MUCH&lt;/strong&gt; better supported than the versions in wrappers so
let&#39;s start with that one first.&lt;/p&gt;
&lt;p&gt;From the &lt;a rel=&quot;external&quot; href=&quot;https://www.passwordstore.org/&quot;&gt;pass website&lt;/a&gt; we find that &lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/browserpass/browserpass-extension&quot;&gt;browserpass&lt;/a&gt;&lt;/strong&gt; is the way to go for
the chrome family. The browser extension installs from the usual
places without drama and starts promptly complaining it cannot find
the native host to talk to.&lt;/p&gt;
&lt;p&gt;The native host in question is from &lt;a rel=&quot;external&quot; href=&quot;https://github.com/browserpass/browserpass-native&quot;&gt;the browsaerpass-native sister
repo&lt;/a&gt; . As usual for all distro&#39;s there are packages ready to install
but because Ubuntu-derivative I can compile from source. Downloading
the source for version 3.1.0 from the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/browserpass/browserpass-native/releases&quot;&gt;releases page&lt;/a&gt;. Again this repo
refers to all browsers including firefox although I cannot for the
life of me find a Firefox Extension supporting this host app.&lt;/p&gt;
&lt;p&gt;Then building and installing timelapse :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tar&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -xzvf ~/Downloads/browserpass-native-3.1.0.tar.gz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; browserpass-native-3.1.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;less&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; README.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PREFIX&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; make&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; configure&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; make PREFIX=/usr/local install&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;which&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; browserpass&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which shows the executable lives at &lt;code&gt;/usr/local/bin/browserpass&lt;/code&gt; and
this totally went fine the first time (NOT!!!!).&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;Makefile&lt;/code&gt; has support to install the magic json to enable native
messaging for the different browsers.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PREFIX&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; make&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; hosts-chromium-user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PREFIX&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; make&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; hosts-chrome-user&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The second invocation is a hail-mary because I already know the Chrome
flatpak does not look in the same places and will require some
additional finnagling&lt;/p&gt;
&lt;p&gt;For now focus on Chromium and check if the configuration looks
reasonable:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cd .config/chromium/NativeMessagingHosts/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.c/c/NativeMessagingHost&lt;/span&gt;&lt;span&gt;s&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;com.github.browserpass.native.json@&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.c/c/NativeMessagingHost&lt;/span&gt;&lt;span&gt;s&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat com.github.browserpass.native.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;name&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;com.github.browserpass.native&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;description&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Browserpass native component for the Chromium extension&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;path&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local/bin/browserpass&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;type&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;stdio&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;allowed_origins&amp;quot;:&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        &amp;quot;chrome-extension://naepdomgkenhinolocfifgehidddafch/&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        &amp;quot;chrome-extension://pjmbgaakjkbhpopmakjoedenlfdmcdgm/&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        &amp;quot;chrome-extension://klfoddkbhleoaabpmiigbmpbjfljimgb/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cool, the executable is looked at where it is installed (this is not
obvious, don&#39;t ask how I know). The rest looks also like how these
things should look. Let&#39;s try...&lt;/p&gt;
&lt;p&gt;The extension settings page is no longer complaining the native host
is missing and there are password entries visible. Checking with some
website shows the password is injected. yay!.&lt;/p&gt;
&lt;p&gt;Level complete, ready for the final boss.&lt;/p&gt;
&lt;h2 id=&quot;enabling-chrome-support-now-with-more-flatpak&quot;&gt;Enabling Chrome Support, now with more Flatpak!&lt;/h2&gt;
&lt;p&gt;Ok, we have a working chromium support so repo access, host app,
native host configuration et al are proven working. We can only focus
on jumping over the Flatpak Firewall...&lt;/p&gt;
&lt;p&gt;As a good cargo cultist I do a literature study and find that I should&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;find the config location of the flatpak app&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;use &lt;code&gt;flatpak-spawn&lt;/code&gt; to spawn the native messaging host app&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;enable D-Bus Session socket access for chrome&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Package up the calling of the host app in a single script to
configure in the json.&lt;/p&gt;
&lt;p&gt;Not necessarily in that order....&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the permission to access D-Bus Session start up &lt;strong&gt;flatseal&lt;/strong&gt; from
flathub, navigate to &lt;strong&gt;com.google.Chrome&lt;/strong&gt; and enable the D-Bus Session
socket. This should be possible with some additional cursing in the
manifest file of Chrome. I cannot find decent reference documentation
in a reasonable time, so &lt;strong&gt;flatseal&lt;/strong&gt; it is.&lt;/p&gt;
&lt;p&gt;The configuration of the flatpak app is easy too, painful experience
seared in my brain that flatpaks look in  &lt;strong&gt;~/.var/app/&lt;/strong&gt; folder so for
Chrome this will be &lt;strong&gt;~/.var/app/com.google.Chrome&lt;/strong&gt; . From the hail-mary
install for chrome done above I know that it just creates a symbolic
link to
&lt;strong&gt;/usr/local/lib/browserpass/hosts/chromium/com.github.browserpass.native&lt;/strong&gt;
so we can start from there. We will have to edit that so copy it. We
also need a wrapper to call the native host app&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.var/app/com.google.Chrome/config/google-chrome/NativeMessagingHosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cp&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; /usr/local/lib/browserpass/hosts/chromium/com.github.browserpass.native&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ec&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; browserpass.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the content of the wrapper&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;/usr/bin/flatpak-spawn&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --host /usr/local/bin/browserpass&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/tmp/browserpass-error.log&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I added the optional redirect of &lt;strong&gt;stderr&lt;/strong&gt; to an error logfile because
from experience I know nothing ever goes wrong if you enable error
reporting beforehand.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;chmod&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; +x browserpass.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pwd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pwd&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; wl-copy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ec&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; com.github.browserpass.native.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Installing the browserpass extension in Chrome after restarting it (I
am not superstitious, just careful) and I can bask in the glory of
seeing proposals for passwords when trying to log in. Most of the
proposals are pretty garbage, but that is a problem for future me.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I have access to my password-store secrets on my phone, my browsers on laptop and
desktop, and most importantly &lt;strong&gt;Emacs&lt;/strong&gt;. Narrowing of the proposed secrets
is, euhmmm, sub-optimal, but since it is sub-optimal in the same way
on all platforms I assume that some TLC in the password-store and
cleaning of the migrated secrets will fix that in time.&lt;/p&gt;
&lt;p&gt;In the process I gained much more confidence in configuring flatpak
apps. I can decommission the keepassxc system including dealing with
the sync conflicts (which was admittedly super easy with the merge
database feature in KeepassXC). I no longer have to deal with giving
the KeepassXC window a place on the desktop and autostarting it.&lt;/p&gt;
&lt;p&gt;I am a bit puzzled about the host-apps referring to supporting
browsers for which no extensions are available. This probably might
warrant some additional investigation.&lt;/p&gt;
&lt;p&gt;Big step forward&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Refactoring Emacs Config using Org</title>
          <pubDate>Sun, 28 Jul 2024 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/emacs-refactor/</link>
          <guid>https://www.snamellit.com/posts/emacs-refactor/</guid>
          <description xml:base="https://www.snamellit.com/posts/emacs-refactor/">&lt;h1 id=&quot;refactoring-my-emacs-config&quot;&gt;Refactoring my Emacs Config&lt;/h1&gt;
&lt;p&gt;It is time to work on my Emacs config. Not because it is hopelessly broken, but to prevent that from happening. A long time ago I had a literate config I had to declare Emacs bankrupcy on because of the amount of cruft and lack of TLC. It had grown to a 4000 line 100kB+ inconsistent mess. It was nice to have evrything in a single file with documentation in place.&lt;/p&gt;
&lt;p&gt;To reduce my config and leverage newer packages I then tried some of the big distros, Spacemacs and Doomemacs. This reduced the size I had to maintain to about 30k allowing me to keep on top of it. My personal modifications were then in a config.org file.&lt;/p&gt;
&lt;p&gt;A few years ago I wanted to get better on using Windows and switched my main machine to a Windows desktop. I immediately noticed Doom Emacs being slow. Then a search started to find the right version of Emacs on Windows : msvc version, cygwin, msys2, wsl, ..., which all had different integration issues. I finally figured out that there is something in Doom which caused the sluggishness, and it is far less present in much more minimal config.
*
Hence I started relatively fresh using Rational Emacs, later Crafted Emacs as a base and organizing core. This is a regular elisp modular configuration. I split my personal configuration settings in different custom modules: pti-ui-XXX, pti-ide-XXX, pti-org-XXX, pti-evil-XXX.&lt;/p&gt;
&lt;h1 id=&quot;goals-to-achieve&quot;&gt;Goals to achieve&lt;/h1&gt;
&lt;p&gt;I like to jot down some things I want to achieve to help me decide when is done and guide some decision along the way to avoid me getting stuck in the middle of a bramble forrest.&lt;/p&gt;
&lt;p&gt;I came up with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Manage &lt;em&gt;init.el&lt;/em&gt; as an org-file&lt;/li&gt;
&lt;li&gt;Use a simple robust tangling solution which works together with
Crafted Emacs&lt;/li&gt;
&lt;li&gt;Leverage inclusion of &lt;del&gt;use-package&lt;/del&gt; in Emacs29 for configuration and
loading&lt;/li&gt;
&lt;li&gt;Reduce dependencies : read evaluate the value a package brings
before including it&lt;/li&gt;
&lt;li&gt;Refactor existing configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In typical fashion the first goal is not a goal but what I will be doing, but judging from other &lt;em&gt;Business Analysis&lt;/em&gt; efforts, this is part for the course. &lt;em&gt;What is the goal of the project? Do the project on time and in budget!&lt;/em&gt; (real helpful...)&lt;/p&gt;
&lt;p&gt;I actually added this when I notice the path getting all tangly and thorny and I remembered I forgot to list what I wanted to do. Well better late than never.&lt;/p&gt;
&lt;h1 id=&quot;approach&quot;&gt;Approach&lt;/h1&gt;
&lt;p&gt;There are couple of constraints and probable consequences.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;likely editing the generated file instead of the source file&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;navigation-between-functions&quot;&gt;Navigation Between Functions&lt;/h2&gt;
&lt;p&gt;Normally in Emacs Lisp buffers navigation between functions is magic. Who knows how this will pan out in org-babel.&lt;/p&gt;
&lt;p&gt;That being said I found that in configuring emacs previously I use little homebrew functions which are usually close to where I use them and for the other functions &lt;code&gt;C-h f&lt;/code&gt; is a good friend.&lt;/p&gt;
&lt;h2 id=&quot;editing-the-generated-file-iso-the-org-sources&quot;&gt;Editing the Generated File iso the Org Sources&lt;/h2&gt;
&lt;p&gt;That is a &lt;em&gt;me&lt;/em&gt; problem. I am &lt;em&gt;going&lt;/em&gt; to be editing the generated file. So I need early feedback for this.&lt;/p&gt;
&lt;h2 id=&quot;tangling-and-git&quot;&gt;Tangling and Git&lt;/h2&gt;
&lt;p&gt;Adding generated files in git is a no-no. I will have to add the generated file to the gitignore.&lt;/p&gt;
&lt;p&gt;Then there is the issue that the config source file ideally is close to the generated file (see above). If I tangle the file from the git location into &lt;em&gt;~/.config/emacs&lt;/em&gt; then I&#39;ll have to navigate between the two locations. Probably there is an easy solution for this, but I don&#39;t have it now.&lt;/p&gt;
&lt;p&gt;If I symbolic link the file from the git location to &lt;em&gt;~/.config/emacs&lt;/em&gt; then it is unclear if emacs will compare the creation date of the symbolic link or the file it points to. Probably this is well defined but I remember being bitten by this in the past.&lt;/p&gt;
&lt;p&gt;But of course no-one is mandating that the emacs configuration has to be part of the &lt;em&gt;dotfiles&lt;/em&gt; repo. I want to refactor that shortly and if I remove all the emacs stuff from the dotfiles repo then I can just clone the emacs config repo to &lt;em&gt;~/.config/emacs&lt;/em&gt; and be done with it. And I have less to migrate in the dotfiles. So that is a win in my book.&lt;/p&gt;
&lt;h2 id=&quot;do-i-want-to-factor-out-crafted-emacs&quot;&gt;Do I want to factor out Crafted Emacs?&lt;/h2&gt;
&lt;p&gt;I am not sure. I like the idea of having a base configuration which is well maintained and I can just add my personal configuration to. The upstream moves forward with the times, I can pull in the changes and the (mild) breakage over time will push me to keep my configuration up to date.&lt;/p&gt;
&lt;p&gt;But I also like the idea of having a configuration which is mine and mine alone. I can do whatever I want with it. I can add a package, remove a package, change a package. I can do whatever I want.&lt;/p&gt;
&lt;p&gt;However it is not on the goals list. I will keep it in mind and see how it goes.&lt;/p&gt;
&lt;h2 id=&quot;do-i-want-to-factor-out-the-custom-modules&quot;&gt;Do I want to factor out the custom modules?&lt;/h2&gt;
&lt;p&gt;Yes. In the past I was pretty happy with a single org file. Before I declared emacs bankruptcy and moved to Spacemacs and Doom Emacs I had a single org file. I liked it. I could search for things easily. I could see the context of the configuration I could add documentation in context. I liked it.&lt;/p&gt;
&lt;p&gt;What I did not like was technical debt and conflicting modules which were integrated at different times and not necessarily work well together. The experience was inconsistent and I felt I was running behind the current state of the art. Hence the need to explore the big distros.&lt;/p&gt;
&lt;p&gt;After the big distros I moved to a modular configuration based on &lt;em&gt;Rational Emacs&lt;/em&gt;, later renamed to &lt;em&gt;Crafted Emacs&lt;/em&gt;. This was a good move. I could keep up with the changes in the emacs world and I could keep my configuration in check. It was all emacs lisp and this worked well for me.&lt;/p&gt;
&lt;p&gt;I added a number of custom modules to the configuration. This works well bt I think the tools in org-mode can do better for this use-case. An Emacs config is not just code to do features. Emacs is also an integration platform where workflows are at least as important as the code. Having a place to document the workflows and the code in context is a big win. Also the code blocks can generate other files which integrate with the Emacs modules. And being able to run code blocks in the org file is a big win to show running examples or have ad-hoc tools available. Now this is also possible with comments in the source code, but I was brainwashed that comments are bad and code is good so I not comfortable with large comments in the source code. (Although that is changing slowly).&lt;/p&gt;
&lt;h1 id=&quot;approach-1&quot;&gt;Approach&lt;/h1&gt;
&lt;h2 id=&quot;recover-the-infrastructure-from-the-old-configuration&quot;&gt;Recover the Infrastructure from the Old Configuration&lt;/h2&gt;
&lt;p&gt;The tangling code proved to be very robust and will work fine with Crafted Emacs.&lt;/p&gt;
&lt;h2 id=&quot;use-elpaca-as-package-manager&quot;&gt;Use Elpaca as Package Manager&lt;/h2&gt;
&lt;p&gt;I used &lt;em&gt;straight&lt;/em&gt; as package manager with Crafted Emacs. I will switch to &lt;em&gt;elpaca&lt;/em&gt; as one of the co-maintainers of &lt;em&gt;straight&lt;/em&gt; started &lt;em&gt;elpaca&lt;/em&gt; as a more user-friendly package manager.&lt;/p&gt;
&lt;p&gt;The integration with &lt;em&gt;use-package&lt;/em&gt; is more seamless and the configuration is more concise compared to &lt;em&gt;straight&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I had to add &lt;em&gt;quelpa&lt;/em&gt; in the mix for some reason. Part of the refactor is to remove both &lt;em&gt;straight&lt;/em&gt; and &lt;em&gt;quelpa&lt;/em&gt; and use &lt;em&gt;elpaca&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;It also seems to be more in line with the modern package managers in &lt;em&gt;neovim&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;use-org-babel-for-configuration&quot;&gt;Use Org-Babel for Configuration&lt;/h2&gt;
&lt;p&gt;Yeah, Duh. This is the whole point of the exercise.&lt;/p&gt;
&lt;p&gt;But it also for maintenance support, running examples and (if needed) generating support scripts.&lt;/p&gt;
&lt;h2 id=&quot;use-use-package-for-configuration&quot;&gt;Use &lt;em&gt;use-package&lt;/em&gt; for Configuration&lt;/h2&gt;
&lt;p&gt;Crafted Emacs leverages the customize infrastructure, including &lt;em&gt;package-install-selected-packages&lt;/em&gt; to install packages. This means that adding the packages and configuring them is a two-step process and they end up in different modules.&lt;/p&gt;
&lt;p&gt;Also there are subtle issues with state being persisted in the saved &lt;em&gt;custom.el&lt;/em&gt; file. I maintain half a dozen systems which I want to be consistent. I have the feeling that &lt;em&gt;use-package&lt;/em&gt; is better supported by the upstream package and I can steal more configs from the respective README&#39;s. Time will tell.&lt;/p&gt;
&lt;p&gt;However it is a new tool to learn and I never used it at this scale.&lt;/p&gt;
&lt;h2 id=&quot;no-new-features&quot;&gt;No new features&lt;/h2&gt;
&lt;p&gt;My config suits me so I need no new features. I just want the same behavior after as before. I can quickly compare behavior on different machines. I will wait to update my VPS until I have a baseline on the desktop of the migration.&lt;/p&gt;
&lt;h2 id=&quot;do-incremental-changes&quot;&gt;Do incremental changes&lt;/h2&gt;
&lt;p&gt;I kept my &lt;em&gt;init.el&lt;/em&gt; relatively small and moved big chunks to separate modules. I can repeatedly copy a file in an org babel block and tangle it to the &lt;em&gt;init.el&lt;/em&gt; file. Then the resulting config has to be the same&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I will start with the &lt;em&gt;init.el&lt;/em&gt; as an org file&lt;/li&gt;
&lt;li&gt;Verify it works and behaves the same&lt;/li&gt;
&lt;li&gt;Split the block in logical pieces give them an Org Header.&lt;/li&gt;
&lt;li&gt;Evaluate if they are in the right place and move if needed.&lt;/li&gt;
&lt;li&gt;Migrate the config to use &lt;em&gt;use-package&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Verify it works and behaves the same&lt;/li&gt;
&lt;li&gt;Repeat until done&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When a file is migrated, I baseline to the master branch and push it to the remote.&lt;/p&gt;
&lt;p&gt;Then the next file.&lt;/p&gt;
&lt;h1 id=&quot;doing-it&quot;&gt;Doing it.&lt;/h1&gt;
&lt;p&gt;I will spare the grind of the actual migration. Actually migrating was no problem. Dealing with the long tail of issues was.&lt;/p&gt;
&lt;h2 id=&quot;issues&quot;&gt;Issues&lt;/h2&gt;
&lt;h3 id=&quot;use-package-defer-and-loading-behavior&quot;&gt;Use-Package defer and loading behavior.&lt;/h3&gt;
&lt;p&gt;I faced quite some issues with the loading behavior of the packages. I started with &lt;code&gt;:defer nil&lt;/code&gt; to get things working. If Emacs took 15s to load then that was not a priority to fix. This bit me in the backend afterwards.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I misundertood the documentation and made the classic mistake of attributing *magic* properties to things as `:commands`, `:hook` and `:bind`. Although it is documented that these can only define to functions in the package, I made the mistake that other functions would trigger loading the package. Since this auto loading is a thin veneer over the standard Emacs loading mechanism, this is not the case. I formulated the rule that you can only refer to a thing in the package from a thing which is already loaded. That helped debugging and avoiding this issue.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;I put a delay between 3 and 10s for modules I would classify as *creature comforts*. This is a good compromise between loading time and usability. I can always lower the delay if I feel the need for speed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;It took some time to get this directed acyclic graph sorted out. &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;use-package-and-custom&quot;&gt;Use-Package and :custom&lt;/h3&gt;
&lt;p&gt;Since Crafted Emacs uses the customize infrastructure, and I adopted that it would make sense to use the &lt;code&gt;:custom&lt;/code&gt; keyword in &lt;code&gt;use-package&lt;/code&gt;. Of course the penny dropped after I moved ton to &lt;code&gt;setq&lt;/code&gt; forms in the &lt;code&gt;:init&lt;/code&gt; blocks. This in turn caused issues with getting passwords with the &lt;em&gt;pass&lt;/em&gt; command which is slow and requires sometimes a pin-entry.&lt;/p&gt;
&lt;p&gt;Using &lt;code&gt;:custom&lt;/code&gt; ensures the variables are still defined on loading the package so it can bootstrap and and the password will be unlocked at that time, which is probably when I do something that actually needs it.&lt;/p&gt;
&lt;h3 id=&quot;pinentry-in-emacs&quot;&gt;Pinentry in Emacs&lt;/h3&gt;
&lt;p&gt;I did not have this issue before but Emacs seemed to hang when started from the i3 launcher. From comparing to starting on the terminal this is likely because it was waiting for the pinentry to be entered when the &lt;em&gt;emacs --daemon&lt;/em&gt; was started which has no GUI frame. This resulted in multiple &lt;code&gt;emacs --daemon&lt;/code&gt; processes in the process list, which surprised me as I never experienced this before.&lt;/p&gt;
&lt;p&gt;I disabled the emacs pinentry support and then it pops up a GUI window so I could enter the password. This is not ideal but it works. In the mean time this is fixed as no more passwords are asked before Emacs is fully started. But it is likely this issue will return.&lt;/p&gt;
&lt;h3 id=&quot;elpaca-and-dev-releases-from-emacs&quot;&gt;Elpaca and Dev Releases from Emacs&lt;/h3&gt;
&lt;p&gt;Elpaca needs the build date of emacs to compare to package versions or
something. However it does not support all dev versions. It has a
table to map released versions to date codes to compare to the build
date of emacs with the date of potential packages. (or something
similar).&lt;/p&gt;
&lt;p&gt;This caused some headscratching how to get this and I finally settled on the
birthdate of the .drv package installed by &lt;em&gt;guix&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For guix emacs-next packages you can find the date with: ( &lt;C-c C-c&gt;
in the source block below:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#+BEGIN_SRC shell&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stat /gnu/store/*emacs-next-[23]*.drv | rg Birth | cut -d&amp;#39; &amp;#39; -f3 | tr -d &amp;#39;-&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#+END_SRC&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#+RESULTS:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| 20240727 |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;| 20240727 |&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is possible there are more so probably the most recent one is the
one to use.&lt;/p&gt;
&lt;p&gt;I override the elpaca generated one with the one I found in &lt;em&gt;early-init.el&lt;/em&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(setq elpaca-core-date &amp;quot;20240727&amp;quot;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is manual for now. Maybe I should trigger this on &lt;code&gt;guix home reconfigure&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&quot;results&quot;&gt;Results&lt;/h1&gt;
&lt;p&gt;I now like visiting my config more&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/emacs-refactor/first-things.png&quot; alt=&quot;config screenshot&quot; /&gt;&lt;/p&gt;
&lt;p&gt;I separated the config from my main dotfiles and published separately in a &lt;a rel=&quot;external&quot; href=&quot;https://forge.snamellit.com/pti/website&quot;&gt;public repo on my forge&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here is an example with workflow notes and executable sample code :&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/emacs-refactor/pass-sample.png&quot; alt=&quot;example of workflow notes and sample code&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Looking at the git log:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 008f173ef49e2dfe175c4d84e6c87425442d1468&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Tue Jul 30 16:51:18 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;switch to new emacs config, burn old bridges&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 2b44a918653890950b0985a4a5e8d65be22507c7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Tue Jul 30 16:47:28 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;save crafted emacs before deleting;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit f79ab7ec6d8cd7af35253db997b291029174c38e&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Tue Jul 30 00:49:19 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rework and testing of the new config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit acf915e24b43d4eb3950931b13121a037b77a659&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Mon Jul 29 17:51:19 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;finished porting emacs init to org-mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit a1cd08f6e157e918f5979e57f0ee50b01688b98f&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Mon Jul 29 11:25:56 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remove dependency on general to define evil keybindings&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 739c067427c6944c96ba5cf1990788a99beb9386&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Mon Jul 29 10:04:56 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remove migrated config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 4010de3d8eb8a7621d9e20bb7bc8af663059a527&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Mon Jul 29 10:01:17 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fix issues with starting emacs.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- migrated pti-org-packages and pti-org-config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- migrated last requires&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- resolved some existing conflicts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commit 99c83bb248a896c99700cca6025777a938d36701&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Author: Peter Tillemans &amp;lt;pti@snamellit.com&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Date:   Mon Jul 29 01:26:08 2024 +0200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Start refactor emacs config to org-mode again.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I started on July 27th at 01:30 and the initial migration was done on July 19th 18:00 about. At that point the emacs config moved to a new repo.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/emacs-refactor/grus-plan.jpg&quot; alt=&quot;Gru evaluates before and after&quot; /&gt;&lt;/p&gt;
&lt;p&gt;comparing the results we see that the files reduced from 12 to 3, total lines is the same (1851 vs 1871). However total size increased  from 67kB to about 85kB.&lt;/p&gt;
&lt;p&gt;I am pretty happy with the change. I removed some duplication, removed some packages I hardly used, found some configs in the wrong place and I have held everything in my hands for a late spring cleaning.&lt;/p&gt;
&lt;p&gt;Is it better than my before emacs lisp configuration? I don&#39;t know. It is just a tradeoff, exchanging some consequences for other consequences. I learned a ton which will help maintain it in the future. Maybe I change my mind in a few years and migrate back, which will be another great opportunity for a spring cleaning.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Terraform workflow using Guix and Emacs</title>
          <pubDate>Wed, 05 Jun 2024 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/terraform-workflow-using-guix-and-emacs/</link>
          <guid>https://www.snamellit.com/posts/terraform-workflow-using-guix-and-emacs/</guid>
          <description xml:base="https://www.snamellit.com/posts/terraform-workflow-using-guix-and-emacs/">&lt;h1 id=&quot;terraform-deployments&quot;&gt;Terraform Deployments&lt;/h1&gt;
&lt;p&gt;Terraform allows infrastructure to be defined to deploy applications
and other solutions as code and supports a plethora of on-premise and
cloud deployment targets.&lt;/p&gt;
&lt;p&gt;It is essentially based on building a graph of dependencies between
resources, data and modules using the terraform language.&lt;/p&gt;
&lt;p&gt;Due to the nature of the beast these things tend to run in the CI
pipelines which makes editing these files frustrating as the edits
have to be committed, pushed, runners have to be scheduled and usually
the deploy pipeline is not the first job.&lt;/p&gt;
&lt;p&gt;So good local tooling is needed to get fast feedback.&lt;/p&gt;
&lt;h1 id=&quot;terraform-tooling-on-guix&quot;&gt;Terraform tooling on GUIX&lt;/h1&gt;
&lt;p&gt;In order to run terraform I need to first package it as it is not
available in the GUIX repositories.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(define-public terraform&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (name &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;snam-terraform&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;1.8.4&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (source (origin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;method&lt;/span&gt;&lt;span&gt; url-fetch)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (uri (string-append &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;https://releases.hashicorp.com/terraform/&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/terraform_&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;_linux_amd64.zip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (sha256&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             (base32&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	       &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;1i181cmzwlrx8d40z1spilcwgnhkzwalrg8822d23sqdmrs7a5hj&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (build-system binary-build-system)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (supported-systems &amp;#39;(&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;x86_64-linux&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (arguments &amp;#39;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;      #&lt;/span&gt;&lt;span&gt;:install-plan&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      `((&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;terraform&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;) &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;bin/&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;      #&lt;/span&gt;&lt;span&gt;:phases&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (modify-phases %standard-phases&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;		     ;; this is required because standard unpack expects&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;		     ;; the archive to contain a directory with everything inside it,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;		     ;; while babashka&amp;#39;s release .tar.gz only contains the `bb` binary.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		     (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;replace&lt;/span&gt;&lt;span&gt; &amp;#39;unpack&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			      (lambda* (&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;#&lt;/span&gt;&lt;span&gt;:key inputs &lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;#&lt;/span&gt;&lt;span&gt;:allow-other-keys)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;				(system* (which &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;unzip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;					 (assoc-ref inputs &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;source&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;				#t)))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (inputs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    `((&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;libstdc++&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; ,(make-libstdc++ gcc))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      (&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;zlib&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; ,zlib)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (native-inputs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    `((&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;unzip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; ,unzip)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (synopsis &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;A tool to describe and deploy infrastructure as code&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (description&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;    &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Terraform allows you to describe your complete infrastructure in the form of code. Even if your servers come from different providers such as AWS or Azure, Terraform helps you build and manage these resources in parallel across providers.&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (home-page &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;https://hashicorp.com/terraform&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (license #f)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(define-public snam-terraform-1.6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;package&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (inherit terraform)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;1.6.6&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (source (origin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             (&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;method&lt;/span&gt;&lt;span&gt; url-fetch)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             (uri (string-append &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;https://releases.hashicorp.com/terraform/&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/terraform_&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;_linux_amd64.zip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             (sha256&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              (base32&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	       &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;002g0ypkkfqy5nf989jyk3m1l7l0455hsaq11xfhr5lbv4zqh5yi&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I immediately added support to build older versions because that&#39;s
what the customer is on and terraform is quite version dependent
AFAICT.&lt;/p&gt;
&lt;p&gt;Now I can create a manifest for this project. I usually bootstrap them
with &lt;code&gt;guile shell --export-manifes go gopls&lt;/code&gt; or similar and then add
stuff when it comes up.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;;; What follows is a &amp;quot;manifest&amp;quot; equivalent to the command line you gave.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;;; You can store it in a file that you may then pass to any &amp;#39;guix&amp;#39; command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;;; that accepts a &amp;#39;--manifest&amp;#39; (or &amp;#39;-m&amp;#39;) option.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(specifications-&amp;gt;manifest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;gopls&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;google-cloud-sdk&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;postgresql&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;snam-terraform-1.6&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #616E88;&quot;&gt; ; from snamellit channel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;direnv-support&quot;&gt;Direnv support&lt;/h1&gt;
&lt;p&gt;In order to manage my project environment and align it with the CI
environment I added the expected variables and use the guix support in
the stdlib of direnv. This will create a guix environment configured
from the manifest.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;use guix&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; DB_URL=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;postgresql://&amp;lt;db_ip&amp;gt;/myproj&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; DB_USER=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;xyz&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; DB_PASSWORD=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;secret&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; PGPASSWORD=$DB_PASSWORD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; VAULT_TOKEN=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;&amp;lt;blablabla&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt; APPTIO_URL=https&lt;/span&gt;&lt;span&gt;://acme.tpondemand.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; APPTIO_TOKEN=&amp;lt;blablabla&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; OPENAI_API_KEY=&amp;lt;blablabla&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt; VAULT_ADDR=https&lt;/span&gt;&lt;span&gt;://vault.acme.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; STATE_BUCKET=com-acme-test-myproj-tf-state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; TF_VAR_project_short=myproj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;export&lt;/span&gt;&lt;span&gt; TF_VAR_project=com-acme-test-${TF_VAR_project_short}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PATH_add ./node_modules/.bin&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;emacs-support&quot;&gt;Emacs support&lt;/h1&gt;
&lt;h2 id=&quot;direnv-support-1&quot;&gt;Direnv Support&lt;/h2&gt;
&lt;p&gt;Emacs &lt;em&gt;direnv mode&lt;/em&gt; will load the configuration from the &lt;em&gt;.envrc&lt;/em&gt; file
when opening a file in that project. The variables and apps are then
available for complition, LSP, shell, etc.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;;; enable direnv mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(direnv-mode)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I just enable it globally because I want that always, not just for
terraform.&lt;/p&gt;
&lt;h2 id=&quot;terraform-support&quot;&gt;Terraform Support&lt;/h2&gt;
&lt;p&gt;Enable some syntax highlighting and more importantly documentation
help. Also set &lt;code&gt;format-on-save&lt;/code&gt; and the indent to 2 spaces&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;;; configure terraform support&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;require&lt;/span&gt;&lt;span&gt; &amp;#39;terraform-mode)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(add-hook &amp;#39;terraform-mode-hook &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;lambda&lt;/span&gt;&lt;span&gt; ()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (outline-minor-mode &lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;1&lt;/span&gt;&lt;span&gt;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(custom-set-variables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;#39;(terraform-indent-level &lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;2&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;#39;(terraform-format-on-save &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;t&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and expose the functionality in similar keybindings as I use for LSP
support :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(evil-define-key &amp;#39;normal terraform-mode-map&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (kbd &amp;quot;&amp;lt;leader&amp;gt;c k&amp;quot;) #&amp;#39;terraform-open-doc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (kbd &amp;quot;&amp;lt;leader&amp;gt;c f&amp;quot;) #&amp;#39;terraform-format&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (kbd &amp;quot;&amp;lt;leader&amp;gt;c F&amp;quot;) #&amp;#39;terraform-format-buffer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (kbd &amp;quot;&amp;lt;leader&amp;gt;c n&amp;quot;) &amp;#39;flymake-goto-next-error&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (kbd &amp;quot;&amp;lt;leader&amp;gt;c p&amp;quot;) &amp;#39;flymake-goto-prev-error)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;&lt;SPACE c k&gt;&lt;/em&gt; will now open a browser window with the documentation of
the terraform element under the cursor. This does need terraform to be
installed though.&lt;/p&gt;
&lt;h2 id=&quot;add-support-to-makefile&quot;&gt;Add support to Makefile&lt;/h2&gt;
&lt;p&gt;In order to save me from remembering the commandlines and because I
keep the terraform files in a &lt;em&gt;terraform&lt;/em&gt; directory I make some &lt;em&gt;make&lt;/em&gt;
targets to quickly access them.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;make&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tfinit&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	terraform -chdir=terraform init -backend-config=&amp;quot;bucket=&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;${&lt;/span&gt;&lt;span&gt;STATE_BUCKET&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;}&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tfcheck&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	terraform -chdir=terraform validate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tfapply&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	terraform -chdir=terraform apply&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tfplan&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	terraform -chdir=terraform plan&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tflint&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	docker run --rm -v `pwd`/terraform:/data -t ghcr.io/terraform-linters/tflint&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;workflow-tips&quot;&gt;Workflow tips&lt;/h1&gt;
&lt;p&gt;Most of it is essentially hidden in the normal workflow. i.e. opening
a terraform file will load it, saving formats it. The &lt;em&gt;compile&lt;/em&gt; feature
can be used to do file checking and linting.&lt;/p&gt;
&lt;p&gt;Magit commit - push triggers the CI pipeline to run the deploy.&lt;/p&gt;
&lt;p&gt;It is easy to test things out locally with the Makefile and it reduces
the number of steps in the CI script , so less things which can do
weird things.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Emacs Debugging with Dape</title>
          <pubDate>Fri, 20 Oct 2023 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/dape/</link>
          <guid>https://www.snamellit.com/posts/dape/</guid>
          <description xml:base="https://www.snamellit.com/posts/dape/">&lt;p&gt;For reasons I keep a set of machines where I regularly work on in sync so they offer a familiar environment. This includes a dual boot desktop (Ubuntu/Windows+WSL), laptop (Arch/Windows+WSL), a VPS(Arch) doing stuff, a  virtual Ubuntu thing which is always running to monitor stuff on my NAS, and a Steam deck (Arch kinda). I expect these to be familiar environments so I can do some light development and scripting on them at least.&lt;/p&gt;
&lt;h1 id=&quot;test-plan&quot;&gt;Test plan&lt;/h1&gt;
&lt;p&gt;In order to test the debugging support we need some minimum set of requirements to avoid descending in the abyss of incremental details.&lt;/p&gt;
&lt;p&gt;To evaluate the configuration for a  language we need&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a simple project in order not to be debugging the build system or the code itself taking more time than setting up the debugging. DAP is plenty complicated on its own.&lt;/li&gt;
&lt;li&gt;The DAP adapter installed with minimal manual work because otherwise it wont get done and there will be too much variance/rework between systems&lt;/li&gt;
&lt;li&gt;A set of familiar keybindings&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My requirements are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I can run the program in the debugger&lt;/li&gt;
&lt;li&gt;I can pass command line arguments to the script&lt;/li&gt;
&lt;li&gt;I can break the program on a line in the editor&lt;/li&gt;
&lt;li&gt;I can examine variables in scope when the breakpoint is hit&lt;/li&gt;
&lt;li&gt;I can see the output of the program&lt;/li&gt;
&lt;li&gt;I can quit/restart and there should not be leaking of processes/network ports/buffers. I.e. I can get back to editing and debugging without rebooting my PC.&lt;/li&gt;
&lt;li&gt;(I would like to pass environment variables too, but since apparently direnv works fine for my purposes I hardly ever use it anymore, so keep that on the backburner for now.)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I do not really use debugging for something else. I actually seldom use the debugger. Mostly for learning new programming languages or playing with libraries concepts. If things get hairy I return back to logging/println debugging anyway (or adding more tests to herd the bugs in a small area).&lt;/p&gt;
&lt;p&gt;My test procedure is as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;open the source code&lt;/li&gt;
&lt;li&gt;place a breakpoint early in the program after some variables are set&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;leader&amp;gt;dd&lt;/code&gt; to start the debugger&lt;/li&gt;
&lt;li&gt;curse on the dape prompt to select the program and pass arguments, set the &lt;em&gt;cwd&lt;/em&gt; and more of that fun.&lt;/li&gt;
&lt;li&gt;check if the breakpoint is hit&lt;/li&gt;
&lt;li&gt;examine the variables&lt;/li&gt;
&lt;li&gt;continue to see the program continue with &lt;code&gt;&amp;lt;leader&amp;gt;dc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;quit the program with &lt;code&gt;&amp;lt;leader&amp;gt;dq&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;verify we are back in our familiar editing session&lt;/li&gt;
&lt;li&gt;do a quick &lt;code&gt;ps ax&lt;/code&gt; to see if we do not have unwanted critters still crawling around the process space.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is far from a comprehensive test, but we are testing here if the DAP adapter is properly installed and behaving as expected in my environment, not a validation test of the adapter itself.&lt;/p&gt;
&lt;h2 id=&quot;javascript-typescript-example&quot;&gt;Javascript/Typescript example&lt;/h2&gt;
&lt;p&gt;I assume that if I can debug typescript, I can debug javascript. So I created a little typescript program to calculate the answer to the meaning of life, the universe and everything.&lt;/p&gt;
&lt;p&gt;But first installing the DAP adapter. It is a bit fiddly and I do not want to repeat that on all my systems so I let emacs to the heavy lifting. It are just the instructions from the &lt;em&gt;dape&lt;/em&gt; repo:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(setq snam-vscode-js-debug-dir (file-name-concat user-emacs-directory &amp;quot;dape/vscode-js-debug&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(defun snam-install-vscode-js-debug ()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;Run installation procedure to install JS debugging support&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (interactive)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (mkdir snam-vscode-js-debug-dir t)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (let ((default-directory (expand-file-name snam-vscode-js-debug-dir)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (vc-git-clone &amp;quot;https://github.com/microsoft/vscode-js-debug.git&amp;quot; &amp;quot;.&amp;quot; nil)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (message &amp;quot;git repository created&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (call-process &amp;quot;npm&amp;quot; nil &amp;quot;*snam-install*&amp;quot; t &amp;quot;install&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (message &amp;quot;npm dependencies installed&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (call-process &amp;quot;npx&amp;quot; nil &amp;quot;*snam-install*&amp;quot; t &amp;quot;gulp&amp;quot; &amp;quot;dapDebugServer&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (message &amp;quot;vscode-js-debug installed&amp;quot;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then add the  dap config for the javascript and typescript modes:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (add-to-list &amp;#39;dape-configs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         `(vscode-js-node&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           modes (js-mode js-ts-mode typescript-mode typescript-ts-mode)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           host &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;localhost&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           port &lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;8123&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;node&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-cwd ,(file-name-concat snam-vscode-js-debug-dir &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;dist&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-args (&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;src/dapDebugServer.js&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;8123&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :type&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;pwa-node&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :request&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;launch&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :program dape-find-file-buffer-default&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :outputCapture&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :sourceMapRenames&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :pauseForSourceMap&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; nil&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :enableContentValidation&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :autoAttachChildProcesses&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :console&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;internalConsole&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :killBehavior&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;forceful&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The debugging our little app. Answer at the prompt:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;vscode-js-node :program &amp;quot;src/main.ts&amp;quot; &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and the debug view opens:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/dape/typescript_example.png&quot; alt=&quot;Typescript Debug Example&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;python-example&quot;&gt;Python example&lt;/h2&gt;
&lt;p&gt;As indicated on the dape repo install the python DAP adapter&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; pip install debugpy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the default settings to &lt;code&gt;dape-configs&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (add-to-list &amp;#39;dape-configs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         `(debugpy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           modes (python-ts-mode python-mode)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;c:/Python312/python.exe&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-args (&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;-m&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;debugpy.adapter&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :type&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;executable&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :request&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;launch&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :program dape-find-file-buffer-default))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and update the command to wherever python is installed. This is from my windows machine which succeeded again to lose its default python config so I have to coerce it a bit to find it.&lt;/p&gt;
&lt;p&gt;Open a python file, and start the debugger. On the &lt;code&gt;Dape config:&lt;/code&gt; prompt enter:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;debugpy :args [&amp;quot;6&amp;quot; &amp;quot;7&amp;quot;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are many more parameters, but &lt;em&gt;dape&lt;/em&gt; will ask the missing ones with the functions in the configuration, here &lt;code&gt;dapy-cwd-fn&lt;/code&gt; to fill in the current working directory (usually the project root) in the &lt;code&gt;:cwd&lt;/code&gt; field and &lt;code&gt;dape-find-file-buffer-default&lt;/code&gt; will propose the open file to run as the program to debug.&lt;/p&gt;
&lt;p&gt;It cannot meaningfully guess which parameters I want to pass so I add manually the &lt;code&gt;:attr&lt;/code&gt; field with the values &lt;code&gt;&quot;6&quot;&lt;/code&gt; and &lt;code&gt;&quot;7&quot;&lt;/code&gt; in a vector. Do not use a list for that as that is not properly encoded by the json converter.&lt;/p&gt;
&lt;p&gt;It asks to confirm the program and opens the debugging views:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/dape/python_example.png&quot; alt=&quot;Python debugging views&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;go-example&quot;&gt;Go Example&lt;/h2&gt;
&lt;p&gt;Installing the go adapter is just installing &lt;em&gt;delve&lt;/em&gt; with your favorite package manager. If your package manager does not help (looking at you, chocolatey):&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;go&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; install github.com/go-delve/delve/cmd/dlv@latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I did not bother to emacsify this as it is completely different for all my systems and I probably revisit that some time if I have a good idea to somehow abstract the differences away.&lt;/p&gt;
&lt;p&gt;Adding the config to &lt;code&gt;dape-configs&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (add-to-list &amp;#39;dape-configs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         `(delve&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           modes (go-mode go-ts-mode)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command &amp;quot;dlv&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-args (&amp;quot;dap&amp;quot; &amp;quot;--listen&amp;quot; &amp;quot;127.0.0.1:55878&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           host &amp;quot;127.0.0.1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           port 55878&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :type &amp;quot;debug&amp;quot;       ;; needed to set the adapterID correctly as a string type&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :request &amp;quot;launch&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :program dape-cwd-fn))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;see debugging tips for an experience report (I made some typo while copy pasting... ). I used it to illustrate how I got around installation hickups.&lt;/p&gt;
&lt;h2 id=&quot;rust-example&quot;&gt;Rust Example&lt;/h2&gt;
&lt;p&gt;Similar to Typescript I assume that if I can debug Rust, I should be able to debug C/C++ (which I try to avoid as much as possible).&lt;/p&gt;
&lt;p&gt;I automated the installation of the DAP adapter for LLD&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;setq&lt;/span&gt;&lt;span&gt; snam-codelldb-dir (file-name-concat user-emacs-directory &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;dape/codelldb&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;defun&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; snam-install-codelldb&lt;/span&gt;&lt;span&gt; ()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Install Vadimcn.Vscode-Lldb DAP server for C/C++/RUST&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (interactive)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;let*&lt;/span&gt;&lt;span&gt; ((default-directory snam-codelldb-dir)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (arch (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;car&lt;/span&gt;&lt;span&gt; (split-string system-configuration &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; nil nil&lt;/span&gt;&lt;span&gt;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (os (pcase system-type&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               (=&amp;#39;windows-nt &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;windows&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               (=&amp;#39;gnu/linux &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;linux&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               (=&amp;#39;darwin &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;darwin&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               (&amp;#39;_ &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;unknown&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;1.10.0&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (release-url (concat &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;https://github.com/vadimcn/codelldb/releases/download/v&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; version &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/codelldb-&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; arch &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; os &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;.vsix&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mkdir default-directory &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;t&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (url-copy-file release-url &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;codelldb.zip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; t&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (message &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;codelldb archive downloaded&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (call-process &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;unzip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; nil&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;*snam-install*&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; t&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;codelldb.zip&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (message &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;codelldb installed&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Again this is just the installation instructions from the &lt;em&gt;dape&lt;/em&gt; repo in emacs lisp.&lt;/p&gt;
&lt;p&gt;adding the default config:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (add-to-list &amp;#39;dape-configs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         `(codelldb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           modes (c-mode c-ts-mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                         c++-mode c++-ts-mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                         rust-ts-mode rust-mode)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;                           ;; Replace vadimcn.vscode-lldb with the vsix directory you just extracted&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command ,(expand-file-name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                     (file-name-concat&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                      snam-codelldb-dir&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                      (concat &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;extension/adapter/codelldb&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                              (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;eq&lt;/span&gt;&lt;span&gt; system-type &amp;#39;windows-nt)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;                                                  &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;.exe&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;                                                &amp;quot;&amp;quot;&lt;/span&gt;&lt;span&gt;))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           host &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;localhost&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           port &lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;5818&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-args (&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;--port&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;5818&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :type&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;lldb&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :request&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;launch&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :program dape-find-file))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since here the DAP is a binary I have to finagle the Windows file extension to make it work.&lt;/p&gt;
&lt;p&gt;Then opening a rust binary, here &lt;code&gt;src/main.rs&lt;/code&gt;, setting a breakpoint and launching the debugger.&lt;/p&gt;
&lt;p&gt;I answered on the prompt&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;codelldb :args [&amp;quot;on&amp;quot;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to specify the arguments for the program to be debugged.&lt;/p&gt;
&lt;p&gt;Dape sees that the program is not specified so it asks for it and with tab completion &lt;code&gt;tar&amp;lt;TAB&amp;gt;deb&amp;lt;TAB&amp;gt;bil&amp;lt;TAB&amp;gt;&lt;/code&gt; this is quickly selected and I am greeted with:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/dape/rust_example.png&quot; alt=&quot;Rust debugging example&quot; /&gt;&lt;/p&gt;
&lt;h2 id=&quot;debugging-tips&quot;&gt;Debugging Tips&lt;/h2&gt;
&lt;p&gt;When trying the Go example I hit a snag : the debugger started but no active thread was present.&lt;/p&gt;
&lt;p&gt;First stop is to open &lt;code&gt;*dape_debug*&lt;/code&gt; buffer :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[info] Starting new multi session&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[info] Server process started (&amp;quot;dlv&amp;quot; &amp;quot;dap&amp;quot; &amp;quot;--listen&amp;quot; &amp;quot;127.0.0.1:55878&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[info] &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Process (&amp;quot;dlv&amp;quot; &amp;quot;dap&amp;quot; &amp;quot;--listen&amp;quot; &amp;quot;127.0.0.1:55878&amp;quot;) exited with 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[info] Connection to server established 127.0.0.1:55878&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[io] Sending:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(:arguments&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (:clientID &amp;quot;dape&amp;quot; :adapterID nil :pathFormat &amp;quot;path&amp;quot; :linesStartAt1 t :columnsStartAt1 t :supportsRunInTerminalRequest t :supportsProgressReporting t :supportsStartDebuggingRequest t)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; :type &amp;quot;request&amp;quot; :command &amp;quot;initialize&amp;quot; :seq 1)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[info] &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Process nil exited with 256&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[error] Timeout for reached for seq 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So the process immediately exits, but we see no output. It would be nice to get that in the buffer, but it isn&#39;t...&lt;/p&gt;
&lt;p&gt;Let&#39;s steal the command and run it in a terminal :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Zeus :: ~ % dlv dap --listen 127.0.0.1:55878                                                                      &amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DAP server listening at: 127.0.0.1:55878&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now restart the debugger by quitting the debug session and starting a fresh one (we cannot use the restart command as the adapter is not running, we need to restart the adapter not the debugged program).&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Zeus :: ~ % dlv dap --listen 127.0.0.1:55878                                                                      &amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DAP server listening at: 127.0.0.1:55878&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2023-10-20T18:13:02+02:00 error layer=dap DAP error: json: cannot unmarshal bool into Go struct field InitializeRequestArguments.arguments.adapterID of type string&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Zeus :: ~ %      &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, the typechecker got a bool where it expected a string.  Opening &lt;em&gt;dape.el&lt;/em&gt; and searching for &lt;code&gt;json-serialize&lt;/code&gt; we find the location.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(defun dape-send-object (process seq object)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;Helper for `dape-request&amp;#39; to send SEQ request with OBJECT to PROCESS.&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (let* ((object (plist-put object :seq seq))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (json (json-serialize object :false-object nil))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (string (format &amp;quot;Content-Length: %d\r\n\r\n%s&amp;quot; (length json) json)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (dape--debug &amp;#39;io &amp;quot;Sending:\n%s&amp;quot; (pp-to-string object))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (process-send-string process string)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let&#39;s print out the JSON we&#39;re sending :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(defun dape-send-object (process seq object)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;Helper for `dape-request&amp;#39; to send SEQ request with OBJECT to PROCESS.&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (let* ((object (plist-put object :seq seq))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (json (json-serialize object :false-object nil))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         (string (format &amp;quot;Content-Length: %d\r\n\r\n%s&amp;quot; (length json) json)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (dape--debug &amp;#39;io &amp;quot;Sending:\n%s&amp;quot; (pp-to-string object))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (dape--debug &amp;#39;io &amp;quot;Sending JSON:\n%s&amp;quot; json)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (process-send-string process string)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;this gives&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(:arguments&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (:clientID &amp;quot;dape&amp;quot; :adapterID nil :pathFormat &amp;quot;path&amp;quot; :linesStartAt1 t :columnsStartAt1 t :supportsRunInTerminalRequest t :supportsProgressReporting t :supportsStartDebuggingRequest t)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; :type &amp;quot;request&amp;quot; :command &amp;quot;initialize&amp;quot; :seq 1)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[io] Sending JSON:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&amp;quot;arguments&amp;quot;:{&amp;quot;clientID&amp;quot;:&amp;quot;dape&amp;quot;,&amp;quot;adapterID&amp;quot;:false,&amp;quot;pathFormat&amp;quot;:&amp;quot;path&amp;quot;,&amp;quot;linesStartAt1&amp;quot;:true,&amp;quot;columnsStartAt1&amp;quot;:true,&amp;quot;supportsRunInTerminalRequest&amp;quot;:true,&amp;quot;supportsProgressReporting&amp;quot;:true,&amp;quot;supportsStartDebuggingRequest&amp;quot;:true},&amp;quot;type&amp;quot;:&amp;quot;request&amp;quot;,&amp;quot;command&amp;quot;:&amp;quot;initialize&amp;quot;,&amp;quot;seq&amp;quot;:1}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[info] &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The supportsXXX things look to be bools, but the &lt;em&gt;adapterID&lt;/em&gt; feels funny to be a bool... Where does this come from?&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(defun dape--initialize (process)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;Send initialize request to PROCESS.&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (dape-request process&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &amp;quot;initialize&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (list :clientID &amp;quot;dape&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :adapterID (plist-get dape--config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                            :type)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :pathFormat &amp;quot;path&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :linesStartAt1 t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :columnsStartAt1 t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:locale &amp;quot;en-US&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsVariableType t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsVariablePaging t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :supportsRunInTerminalRequest t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsMemoryReferences t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsInvalidatedEvent t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsMemoryEvent t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsArgsCanBeInterpretedByShell t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :supportsProgressReporting t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      :supportsStartDebuggingRequest t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      ;;:supportsVariableType t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      )&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, it comes from the config &lt;code&gt;:type&lt;/code&gt; attribute... What do I have in my config???&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (add-to-list &amp;#39;dape-configs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         `(delve&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           modes (go-mode go-ts-mode)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command &amp;quot;dlv&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-args (&amp;quot;dap&amp;quot; &amp;quot;--listen&amp;quot; &amp;quot;127.0.0.1:55878&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           command-cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           host &amp;quot;127.0.0.1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           port 55878&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           dape &amp;quot;debug&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :request &amp;quot;launch&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :cwd dape-cwd-fn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           :program dape-cwd-fn))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hmm... what is that &lt;code&gt;dape&lt;/code&gt; attribute. In all other configs there is a &lt;code&gt;:type&lt;/code&gt; in that place. That seems a slip of the finger triggering an unlucky evil command. (I checked on the repo and it was correct there so it was my fault). Let&#39;s change it to &lt;code&gt;:type&lt;/code&gt; and &lt;code&gt;C-x C-e&lt;/code&gt; the &lt;code&gt;add-to-list&lt;/code&gt; expression to update the default config.&lt;/p&gt;
&lt;p&gt;Let&#39;s try again :&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.snamellit.com/posts/dape/go_example.png&quot; alt=&quot;go debug example&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Ok, now we&#39;re cookin&#39; with fire!!!&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Running Emacs with wsl2-xrdp</title>
          <pubDate>Sun, 17 Jan 2021 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/running-emacs-with-wsl2-xrdp/</link>
          <guid>https://www.snamellit.com/posts/running-emacs-with-wsl2-xrdp/</guid>
          <description xml:base="https://www.snamellit.com/posts/running-emacs-with-wsl2-xrdp/">&lt;h1 id=&quot;why&quot;&gt;Why&lt;/h1&gt;
&lt;p&gt;I have been using Emacs in WSL2 using an X server running in Windows and
that works fine as long as long as the computer does not go to sleep.
When the computer goes to sleep, the X connection is cut and the emacs
process crashes. I like to just have my emacs session available so I can
continue where I was last time and I like my computer to go to sleep
when I not use it because Global Warming.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;start emacs in WSL2 in GUI mode&lt;/li&gt;
&lt;li&gt;can be reconnected after sleep&lt;/li&gt;
&lt;li&gt;copy-paste works transparent&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;plan&quot;&gt;Plan&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;use &lt;strong&gt;xrdp&lt;/strong&gt; as remote desktop is built into windows&lt;/li&gt;
&lt;li&gt;configure xrdp to startup in WSL2&lt;/li&gt;
&lt;li&gt;run emacs in a remote desktop session&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;installation&quot;&gt;Installation&lt;/h1&gt;
&lt;h2 id=&quot;install-xrdp&quot;&gt;Install xrdp&lt;/h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://wiki.archlinux.org/index.php/xrdp&quot;&gt;Arch wiki page for xrdp&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; yay -S xrdp xorgxrdp-git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We do not have systemd in WSL2 so I started the daemons manually with a
small script */usr/local/bin/start-xrdp:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; /usr/sbin/xrdp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; /usr/sbin/xrdp-sesman&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can now start it with &lt;strong&gt;start-xrdp&lt;/strong&gt; from the bash command line or
using &lt;strong&gt;wsl -u root /usr/local/bin/start-xrdp&lt;/strong&gt;. If not running as root
(or recently authenticated sudo access) it will ask for your Linux
password to allow running as &lt;strong&gt;sudo&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Trying to connect lets me login but after a timeout is shows a dialog
box telling me Xorg did not want to start. This is confirmed in the
&lt;strong&gt;/var/log/xrdp-sesman.log&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;The root cause is that I cannot read properly because if I could, I
would have read to add &lt;em&gt;allowed\&lt;del&gt;users&lt;/del&gt;=anybody&lt;/em&gt; to the
&lt;strong&gt;/etc/X11/Xwrapper.config&lt;/strong&gt; file to allow &lt;strong&gt;Xorg&lt;/strong&gt; to be started by
regular users like me instead of only &lt;strong&gt;root&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Once that is there I get a nice black screen after login.&lt;/p&gt;
&lt;p&gt;Note: Each time WSL2 restarts it gets a random ip address. So I created
a small script to dig out the actual ip address out of the output of
&lt;strong&gt;ip address&lt;/strong&gt; :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; address show dev eth0&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; grep&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;inet &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; sed&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -e&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;s/.*inet \([^/]*\).*/\1/&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which I gave the original name of &lt;strong&gt;/usr/local/bin/ip-address&lt;/strong&gt; (do not
forget to &lt;code&gt;chmod +x /usr/local/bin/ip-address&lt;/code&gt; to make it executable) so
I can easily call it from powershell with &lt;code&gt;wsl ip-address&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;installing-dbus-replacement&quot;&gt;Installing DBUS replacement&lt;/h2&gt;
&lt;p&gt;DBUS is the de-facto GNU/Linux desktop communication bus which glues all
kind of GUI apps together. I do not know if it is directly used by Emacs
or any of the extensions I use, however it reduces the amount of errors
and warnings.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; yay -S dbus-x11&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;allows xfce and other programs to feel happy and display the desktop
with an emacs window. Now just maximizing the window and the goal is
reached.&lt;/p&gt;
&lt;h2 id=&quot;automatic-start-of-emacs-only&quot;&gt;Automatic start of Emacs only&lt;/h2&gt;
&lt;p&gt;In order to just start emacs maximized in a single remote desktop window
we only need to start it as the only program in the XSession. This of
course also means there is no chrome on the X-Window or the ability to
lauch other programs outside of Emacs. This is exactly how I like it.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#file:~/.xinitrc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;emacs&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -mm&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you rather have a full desktop environment, see further.&lt;/p&gt;
&lt;h2 id=&quot;installing-xfce4-optional&quot;&gt;Installing Xfce4 (Optional)&lt;/h2&gt;
&lt;p&gt;I&#39;d rather have something more lightweight as window manager, but I
have experience with Xfce4 in Arch and I also like something which just
works.&lt;/p&gt;
&lt;p&gt;I only intend to run emacs in the window however having something a bit
more capable which works can help me debug the environment. (I have some
font things to sort out too...)&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sudo pacman -S xfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then start it form &lt;strong&gt;~/.xinitrc&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;emacs&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;startxfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you have skipped the &lt;strong&gt;DBUS&lt;/strong&gt; setup above, this hangs while the
&lt;strong&gt;~/.xorgxrdp.log&lt;/strong&gt; file is filling up with errors complaining about
missing connection to dbus.&lt;/p&gt;
&lt;h1 id=&quot;using-this-from-windows&quot;&gt;Using this from Windows&lt;/h1&gt;
&lt;h2 id=&quot;starting-from-the-command-line&quot;&gt;Starting from the command-line&lt;/h2&gt;
&lt;p&gt;We can start remote desktop session using&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;_ mstsc /v:$(wsl ip-address) /h:2560 /w:1600&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This works, however we get now a prompt to accept the certificate and we
still need to login. We can make this smoother&lt;/p&gt;
&lt;h2 id=&quot;accepting-the-certificate&quot;&gt;Accepting the certificate&lt;/h2&gt;
&lt;p&gt;You can accept the certificate and let remote desktop add it to your
certificate stores. This solves this interruption.&lt;/p&gt;
&lt;p&gt;However, this still happens each time the ip address changes.&lt;/p&gt;
&lt;h2 id=&quot;automatic-login&quot;&gt;Automatic login&lt;/h2&gt;
&lt;p&gt;Start &lt;strong&gt;remote desktop&lt;/strong&gt; GUI using the search or from the start menu.&lt;/p&gt;
&lt;p&gt;Fill in the ip address returned by &lt;code&gt;wsl ip-address&lt;/code&gt; and your username.
Enable the flag to store your password. Login and save the configuration
as e.g. &lt;strong&gt;emacs.rdp&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;We can now start emacs using&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;_ cmdkey /generic:$(wsl ip-address) /user:&amp;lt;username&amp;gt; /pass:&amp;lt;password&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;gt;_ mstsc /v:$(wsl ip-address)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can assemble this is a small script &lt;strong&gt;wsl-emacs.ps1&lt;/strong&gt; somewhere on
your path:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;powershell&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wsl &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;-&lt;/span&gt;&lt;span&gt;u root &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;/&lt;/span&gt;&lt;span&gt;usr&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;/&lt;/span&gt;&lt;span&gt;local&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;/&lt;/span&gt;&lt;span&gt;bin&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;start-xrdp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;address&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; $(&lt;/span&gt;&lt;span&gt;wsl ip&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;-&lt;/span&gt;&lt;span&gt;address&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;userName&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;pti&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;userPwd&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;shht!Secret&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cmdkey &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;/&lt;/span&gt;&lt;span&gt;generic:&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;address&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; /&lt;/span&gt;&lt;span&gt;user:&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;userName&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; /&lt;/span&gt;&lt;span&gt;pass:&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;userPwd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstsc &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;/&lt;/span&gt;&lt;span&gt;v:&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;$&lt;/span&gt;&lt;span&gt;address&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which allows us to start our &lt;strong&gt;wsl-emacs&lt;/strong&gt; from powershell or as a
startup application with a shortcut. It ensures the &lt;strong&gt;xrdp&lt;/strong&gt; daemons are
running (they are idempotent, so the script can be run multiple times),
then the credentials are created so they can be picked up by remote
desktop.&lt;/p&gt;
&lt;p&gt;To add a shortcut to the start menu:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Type Win-R and open
*%AppData%&lt;code&gt;\Microsoft&lt;/code&gt;{=latex}&lt;code&gt;\Windows&lt;/code&gt;{=latex}&lt;code&gt;\Start&lt;/code&gt;{=latex}
Menu&lt;code&gt;\Programs*&lt;/code&gt;{=latex}&lt;/li&gt;
&lt;li&gt;create a new shortcut&lt;/li&gt;
&lt;li&gt;set as target *powershell.exe &quot;&amp;amp;
&#39;&amp;lt;path-of-script&amp;gt;&lt;code&gt;\wsl&lt;/code&gt;{=latex}-emacs.ps1&#39;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note the weird &lt;strong&gt;&quot;&amp;amp;&lt;/strong&gt; on the command-line.&lt;/p&gt;
&lt;h2 id=&quot;a-note-on-security&quot;&gt;A note on security&lt;/h2&gt;
&lt;p&gt;Since you can run any command from the windows command-line as root, the
current logged in person has full access to anything in the WSL Linux
machines. As such there is not a big hole added by adding your linux
password somewhere securely in your account files such as the startup
script.&lt;/p&gt;
&lt;p&gt;This does not mean you should not have secure passwords, as your linux
box can expose its ports (not by default but just assume they are) and
allow e.g. ssh access. Since I assume a lot of WSL2 hosts will be used
fast and loose as a development box, there is a good chance that sooner
or later a port is opened for reasons.&lt;/p&gt;
&lt;p&gt;So I would not worry too much your linux box password is exposed in the
emacs startup script as long as it is hard enough and not used anywhere
else. If you&#39;d like to get it from some secure vault on your PC or from
your infrastructure, go for it.&lt;/p&gt;
&lt;p&gt;tldr;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use a strong password for your WSL box&lt;/li&gt;
&lt;li&gt;do not reuse an existing password&lt;/li&gt;
&lt;li&gt;secure your startup script so it is only readable by you.&lt;/li&gt;
&lt;/ul&gt;
</description>
      </item>
      <item>
          <title>Enable real idletime for Org Mode on Ubuntu</title>
          <pubDate>Mon, 04 Jul 2011 09:11:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/enable-real-idletime-for-org-mode-on-ubuntu/</link>
          <guid>https://www.snamellit.com/posts/enable-real-idletime-for-org-mode-on-ubuntu/</guid>
          <description xml:base="https://www.snamellit.com/posts/enable-real-idletime-for-org-mode-on-ubuntu/">&lt;p&gt;Org Mode can use the idle time to correct time tracking entries. On the Mac this works on the idle time of the computer, on other platforms it uses the idle time of emacs. Hence if you do a significant task in another program it will be idle for org-mode. There is a little program delivered with org-mode sources to estimate the &quot;real&quot; idle time based on the information used by screensavers. Unfortunaltely it is in source code and needs to be compiled first. Everything is actually well documented, just scattered. Let&#39;s see where that little program is located&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ locate x11idle&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/home/pti/.emacs.d/vendor/org-mode/UTILITIES/x11idle.c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This conveniently shows the location of the source file. If you might find a &lt;strong&gt;x11info&lt;/strong&gt; file (without .c) in a bin directory then it is already installed and you&#39;re done. If you get no results and there is some remark that the database is too old then it is time to refresh it using &lt;strong&gt;sudo updatedb&lt;/strong&gt;. Then the lookup should find the file. Now go to the folder where the file is located. In my case :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd ~/.emacs.d/vendor/org-mode/UTILITIES&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We need to make sure we have the necessary X screensaver libraries for compiling :```&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sudo apt-get install lib-xss-de&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo apt-get install libxss-dev&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Reading package lists... Done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Building dependency tree&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Reading state information... Done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following extra packages will be installed:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  x11proto-scrnsaver-dev&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The following NEW packages will be installed:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  libxss-dev x11proto-scrnsaver-dev&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Need to get 34.1 kB of archives.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;After this operation, 225 kB of additional disk space will be used.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Do you want to continue \[Y/n\]?&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Get:1 http://be.archive.ubuntu.com/ubuntu/ natty/main x11proto-scrnsaver-dev all 1.2.1-1 \[21.3 kB\]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Get:2 http://be.archive.ubuntu.com/ubuntu/ natty/main libxss-dev amd64 1:1.2.1-1 \[12.9 kB\]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fetched 34.1 kB in 0s (200 kB/s)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Selecting previously deselected package x11proto-scrnsaver-dev.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(Reading database ... 567603 files and directories currently installed.)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Unpacking x11proto-scrnsaver-dev (from .../x11proto-scrnsaver-dev\_1.2.1-1\_all.deb) ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Selecting previously deselected package libxss-dev.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Unpacking libxss-dev (from .../libxss-dev\_1%3a1.2.1-1\_amd64.deb) ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Processing triggers for man-db ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Setting up x11proto-scrnsaver-dev (1.2.1-1) ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Setting up libxss-dev (1:1.2.1-1) ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we can compile &lt;strong&gt;x11idle&lt;/strong&gt;. We need to specify to link against the X11 and X Screensaver libraries (Xss). I immediately place the resulting executable file in &lt;strong&gt;~/bin/x11idle&lt;/strong&gt;. Alternatively you could use the /usr/local/bin folder, but first compile to a temporary location like &lt;strong&gt;/tmp&lt;/strong&gt; and move it there : &lt;strong&gt;sudo mv /tmp/x11idle /usr/local/bin&lt;/strong&gt;.```&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ gcc -o ~/bin/x11idle -lX11 -lXss x11idle.c&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x11idle.c: In function ‘main’:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x11idle.c:19:5: warning: format ‘%u’ expects type ‘unsigned int’, but argument 2 has type ‘long unsigned int’&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ x11idle&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;22&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ x11idle&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;20&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tried to run it using the normal path and got 22 and 20 seconds idle time : it works !!! The orgmode code will now find and use it. For more background info see&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/&quot;&gt;Blogpost about getting idle time in linux.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;http://osdir.com/ml/emacs-orgmode-gnu/2009-10/msg00545.html&quot;&gt;The message with the patch proposal for including it with org-mode&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;2011-07-04 Mon 11:11 &lt;a href=&quot;file:///home/pti/org/emacs.html&quot;&gt;Track down reason for Dangling Time References&lt;/a&gt;&lt;/p&gt;
</description>
      </item>
    </channel>
</rss>
