branch: elpa/beancount
commit 9a688bb6cf1450c046a3e9a64269c1eea59879dd
Author: Martin Blais <bl...@furius.ca>
Commit: Martin Blais <bl...@furius.ca>

    Added an experimental Emacs binding for reformatting the entire file using 
bean-format.
---
 etc/emacsrc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/etc/emacsrc b/etc/emacsrc
index 2c3cb74012..f910c8a3d0 100644
--- a/etc/emacsrc
+++ b/etc/emacsrc
@@ -22,3 +22,15 @@
   (add-to-list
    'compilation-error-regexp-alist 'python-logging)
   )
+
+
+;; Experimental: Bind a key to reformat the entire file using bean-format.
+(defun beancount-format-file ()
+  (interactive)
+  (let ((line-no (line-number-at-pos)))
+      (call-process-region (point-min) (point-max) "bean-format" t 
(current-buffer))
+      (goto-line line-no)
+      (recenter)
+      ))
+
+(define-key* beancount-mode-map [(control c)(F)] 'beancount-format-file)

Reply via email to