diff options
-rw-r--r-- | lisp/ldg-report.el | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/lisp/ldg-report.el b/lisp/ldg-report.el index 29c5ce4c..9a51c32c 100644 --- a/lisp/ldg-report.el +++ b/lisp/ldg-report.el @@ -238,23 +238,27 @@ the default." (format "Command: %s\n" cmd) (make-string (- (window-width) 1) ?=) "\n") - (shell-command - (concat cmd " --prepend-format='%(filename):%(beg_line):'") t nil) - (goto-char (point-min)) - (while (re-search-forward "^\\([^:]+\\)?:\\([0-9]+\\)?:" nil t) - (let ((file (match-string 1)) - (line (string-to-number (match-string 2)))) - (delete-region (match-beginning 0) (match-end 0)) - (set-text-properties (line-beginning-position) (line-end-position) - (list 'ledger-source (cons file line)))))) + (let ((register-report (string-match " reg\\(ister\\)? " cmd))) + (shell-command + (if register-report + (concat cmd " --prepend-format='%(filename):%(beg_line):'") + cmd) t nil) + (when register-report + (goto-char (point-min)) + (while (re-search-forward "^\\([^:]+\\)?:\\([0-9]+\\)?:" nil t) + (let ((file (match-string 1)) + (line (string-to-number (match-string 2)))) + (delete-region (match-beginning 0) (match-end 0)) + (set-text-properties (line-beginning-position) (line-end-position) + (list 'ledger-source (cons file line)))))))) (defun ledger-report-visit-source () (interactive) - (destructuring-bind (file . line) - (get-text-property (point) 'ledger-source) - (find-file-other-window file) - (goto-char (point-min)) - (forward-line (1- line)))) + (let ((prop (get-text-property (point) 'ledger-source))) + (destructuring-bind (file . line) prop + (find-file-other-window file) + (goto-char (point-min)) + (forward-line (1- line))))) (defun ledger-report-goto () "Goto the ledger report buffer." |