<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan&#39;s Tech Blog</title>
    <link>https://blog.bekenev.net/tags/ledger-emacs.html</link>
    <description>Software development related stuff</description>
    <language>en-us</language>
    <lastBuildDate>Thu, 13 Oct 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bekenev.net/tags/ledger-emacs/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Emacs ledger-mode with hledger</title>
      <link>https://blog.bekenev.net/2022/10/13/ledger-mode.html</link>
      <pubDate>Thu, 13 Oct 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2022/10/13/ledger-mode.html</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://hledger.org/&#34;&gt;Hledger&lt;/a&gt; is a text based accounting tool.&#xA;It&amp;rsquo;s very similar to &lt;a href=&#34;https://www.ledger-cli.org/&#34;&gt;Ledger&lt;/a&gt; (hence the name).&lt;/p&gt;&#xA;&lt;p&gt;Emacs has great &lt;code&gt;ledger-mode&lt;/code&gt; but if you use Hledger you&amp;rsquo;ll definitely get some issues.&lt;/p&gt;&#xA;&lt;h2 id=&#34;tldr&#34;&gt;TLDR&lt;/h2&gt;&#xA;&lt;p&gt;here is my &lt;code&gt;use-package&lt;/code&gt; block where most of the issues are solved&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-lisp&#34; data-lang=&#34;lisp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;use-package&lt;/span&gt; ledger-mode&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;:straight&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;t&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;;; or :ensure t&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;:init&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (add-to-list &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;auto-mode-alist&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#39;&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\\.\\(h?ledger\\|journal\\|j\\)$&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt; ledger-mode))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-binary-path &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;path-to-fix-hledger-script.see-below&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-mode-should-check-version &lt;span style=&#34;color:#66d9ef&#34;&gt;nil&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-report-links-in-register &lt;span style=&#34;color:#66d9ef&#34;&gt;nil&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-report-auto-width &lt;span style=&#34;color:#66d9ef&#34;&gt;nil&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-report-native-highlighting-arguments &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#39;&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;--color=always&amp;#34;&lt;/span&gt;))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-highlight-xact-under-point &lt;span style=&#34;color:#66d9ef&#34;&gt;nil&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (&lt;span style=&#34;color:#66d9ef&#34;&gt;setq&lt;/span&gt; ledger-default-date-format ledger-iso-date-format))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;add-new-transactions-issue-xact&#34;&gt;Add new transactions issue. xact.&lt;/h2&gt;&#xA;&lt;p&gt;There an error appears when you try to add a new transaction that says &lt;code&gt;xact&lt;/code&gt; isn&amp;rsquo;t available.&#xA;&lt;code&gt;xact&lt;/code&gt; is a tool that comes with ledger but it doesn&amp;rsquo;t exists in hledger package.&lt;/p&gt;&#xA;&lt;p&gt;The tool is basically trying to match records based on the query passed into it and then return the matched record. Kind of minimal autocompletion.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;hledger&lt;/code&gt; has &lt;code&gt;--match&lt;/code&gt; option instead and to make it work I suggest to refer to &lt;a href=&#34;https://github.com/simonmichael/hledger/issues/367#issuecomment-956436493&#34;&gt;this script&lt;/a&gt; provided by Anthony Carrico.&lt;/p&gt;&#xA;&lt;p&gt;Make it executable, put in whatever place you want and update &lt;code&gt;ledger-binary-path&lt;/code&gt; variable in your Emacs config.&lt;/p&gt;&#xA;&lt;p&gt;That should make everything work.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
