

GitHub - beancount/beancount-mode: Emacs major-mode to work with Beancount ledge...
source link: https://github.com/beancount/beancount-mode
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Emacs major-mode to work with Beancount ledger files
This package provides beancount-mode
an Emacs major-mode
implementing syntax highlighting, indentation, completion , and other
facilities to edit and work with Beancount ledger files.
To instruct Emacs to activate beancount-mode
when opening files with
a .beancount
extension, you can add this code to your Emacs
configuration, typically in the ~/.emacs.d/init.el
file:
(add-to-list 'load-path "/path/to/beancount-mode/") (require 'beancount) (add-to-list 'auto-mode-alist '("\\.beancount\\'" . beancount-mode))
Most facilities commonly provided by Emacs major modes are implemented
by beancount-mode
. Documentation on the provided functionality and on
the default keybindings can be obtained with the describe-mode
command
in a buffer with beancount-mode
active.
In a nutshell, when beancount-mode
is active:
- The “TAB” key either indents, completes, or folds the heading at point, depending on the context.
- Amounts in postings are indented so that the decimal point is at the
beancount-number-alignment-column
column. Setting this variable to 0 will cause the alignment column to be determined from file content. - Postings in transactions, as well as metadata, links, and tags
following directives, and are indented with
beancount-transaction-indent
spaces. - Pressing the “RET” key causes the current line to be automatically indented. If the current line is a posting, the amount will be indented as described above.
The automatic indentation behavior is defined by Emacs auto indent
mechanism, however, it can be surprising or undesired. It can be
disabled setting electric-indent-chars
to nil
after loading
beancount-mode
, for example like this:
(add-hook 'beancount-mode-hook (lambda () (setq-local electric-indent-chars nil)))
Beancount ledger files can grow very large. It is thus often practical
to structure them in sections and subsections. To support this,
beancount-mode
leverages Outline minor-mode to enable navigation of
the document structure to fold and unfold the document sections,
similarly to what is possible in Org mode. Lines starting with one
asterisks ”*
” or three or more semicolons ”;;;
” are interpreted as
section headings. In Beancount, the semicolon starts a comment and all
lines starting with an asterisks are ignored. The number of semicolons
or asterisks determines the heading level.
To enable this functionality, outline-minor-mode
should be
explicitly activated. It is possible to do so automatically when
beancout-mode
is activated:
(add-hook 'beancount-mode-hook #'outline-minor-mode)
Outline minor mode uses a rather peculiar choice of keybindings. It is
possible to map the most used functionality to keys more familiar to
org-mode
users adding a few lines to the Emacs configuration:
(define-key beancount-mode-map (kbd "C-c C-n") #'outline-next-visible-heading) (define-key beancount-mode-map (kbd "C-c C-p") #'outline-previous-visible-heading)
Alternatively the keybindings for outline-minor-mode
can be globally
remapped. Please refer to the outline-minor-mode
documentation in
the Emacs manual for more details.
The etc/emacsrc
file contains some example configuration for
beancount-mode
and some experiments that may find their way into the
main codebase.
Recommend
-
196
vue-mode Emacs major mode for vue.js based on mmm-mode. Preview Install Emacs users may install the package from MELPA. vue-mode should then be activated on all files with a .vue
-
108
I've taken up maintaining hy-mode - a major mode for lispy python. I narrate working through specific problems in...
-
40
README.md vim-beancount This is the beancount filetype for Vim. Includes highlighting and some basic functions. Installation I suggest...
-
35
Initial import. · beancount/beancount@4c45733 · GitHub
-
19
使用 Telegram Bot + Beancount 记账Saturday, March 13, 2021BeancountTelegramBot由于最近听的捕蛇者说的这期播客节目1,去了解了一下经常...
-
18
自从 2017 年开始,我一直使用 网易有钱 记账。不得不说,如果像某落水狗讲的那样,“中国人不在乎隐私” 的话,这确实是一个非常好用的 APP,下载账单、导入数据一气呵成,连余额宝的利息都能够算得分毫不差 ——直到最近,大概是骂挨得太多,或是...
-
17
Files Permalink Latest commit message Commit time
-
15
-
6
使用 Beancount 管理家庭财务 今年春节的时候,由于感受到了使用近 9 年的记账 App 挖财可能无法长期使用了,我便花了 11 小时将其迁移到了强大的
-
7
本文基于的假设是:友人 A 需要购买产品 B,但需要你来代他购买。探讨以下几种事件发生顺序的记账方法。 除了自己已有的 Assets:Bank:Z 外,需要额外建立这些账户: Assets:Receivables:A 先转账...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK