mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 16:53:00 +00:00
feat(emacs): qwerty
This commit is contained in:
parent
fb9ea29d52
commit
47b8460825
8 changed files with 108 additions and 52 deletions
|
|
@ -6,7 +6,34 @@
|
|||
|
||||
(use-package beancount
|
||||
:mode (("\\.beancount\\'" . beancount-mode)
|
||||
("\\.bean\\'" . beancount-mode)))
|
||||
("\\.bean\\'" . beancount-mode))
|
||||
:init
|
||||
(add-hook 'beancount-mode-hook #'outline-minor-mode)
|
||||
(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)
|
||||
|
||||
(defvar beancount-accounts-files nil "List of account files.")
|
||||
(setq beancount-accounts-files
|
||||
(directory-files "~/Dropbox/beancount/accounts/" 'full (rx ".beancount" eos)))
|
||||
|
||||
(defun w/beancount--collect-accounts-from-files (oldfun regex n)
|
||||
"Collect all accounts from files."
|
||||
(let ((keys (funcall oldfun regex n))
|
||||
(hash (make-hash-table :test 'equal)))
|
||||
(dolist (key keys)
|
||||
(puthash key nil hash))
|
||||
;; collect accounts from files
|
||||
(save-excursion
|
||||
(dolist (f beancount-accounts-files)
|
||||
(with-current-buffer (find-file-noselect f)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward beancount-account-regexp nil t)
|
||||
(puthash (match-string-no-properties n) nil hash)))))
|
||||
(hash-table-keys hash)))
|
||||
|
||||
(advice-add #'beancount-collect
|
||||
:around #'w/beancount--collect-accounts-from-files
|
||||
'((name . "collect accounts from files as well"))))
|
||||
|
||||
|
||||
(provide 'init-beancount)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue