Allow non-register reports to work again
This commit is contained in:
parent
e6acb5a9cc
commit
d203393cab
1 changed files with 18 additions and 14 deletions
|
|
@ -238,23 +238,27 @@ the default."
|
||||||
(format "Command: %s\n" cmd)
|
(format "Command: %s\n" cmd)
|
||||||
(make-string (- (window-width) 1) ?=)
|
(make-string (- (window-width) 1) ?=)
|
||||||
"\n")
|
"\n")
|
||||||
(shell-command
|
(let ((register-report (string-match " reg\\(ister\\)? " cmd)))
|
||||||
(concat cmd " --prepend-format='%(filename):%(beg_line):'") t nil)
|
(shell-command
|
||||||
(goto-char (point-min))
|
(if register-report
|
||||||
(while (re-search-forward "^\\([^:]+\\)?:\\([0-9]+\\)?:" nil t)
|
(concat cmd " --prepend-format='%(filename):%(beg_line):'")
|
||||||
(let ((file (match-string 1))
|
cmd) t nil)
|
||||||
(line (string-to-number (match-string 2))))
|
(when register-report
|
||||||
(delete-region (match-beginning 0) (match-end 0))
|
(goto-char (point-min))
|
||||||
(set-text-properties (line-beginning-position) (line-end-position)
|
(while (re-search-forward "^\\([^:]+\\)?:\\([0-9]+\\)?:" nil t)
|
||||||
(list 'ledger-source (cons file line))))))
|
(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 ()
|
(defun ledger-report-visit-source ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(destructuring-bind (file . line)
|
(let ((prop (get-text-property (point) 'ledger-source)))
|
||||||
(get-text-property (point) 'ledger-source)
|
(destructuring-bind (file . line) prop
|
||||||
(find-file-other-window file)
|
(find-file-other-window file)
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(forward-line (1- line))))
|
(forward-line (1- line)))))
|
||||||
|
|
||||||
(defun ledger-report-goto ()
|
(defun ledger-report-goto ()
|
||||||
"Goto the ledger report buffer."
|
"Goto the ledger report buffer."
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue