Skip to content

Commit d7f7fb8

Browse files
committed
Make comment completion preserve existing spacing
Complete over the entire comment including the comment marker, so that any intermediate spaces are included.
1 parent 0f3bf20 commit d7f7fb8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ledger-complete.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ an alist (ACCOUNT-ELEMENT . NODE)."
308308
(eq 'comment (car (cdr (ledger-context-at-point))))
309309
(save-excursion
310310
(back-to-indentation)
311-
(search-forward ";")
312-
(skip-chars-forward " \t")
313311
(setq start (point)))
314312
(setq collection (cons 'nullary #'ledger-comments-list)))
315313
(;; Payees
@@ -365,10 +363,12 @@ an alist (ACCOUNT-ELEMENT . NODE)."
365363
(let ((comments '()))
366364
(save-excursion
367365
(goto-char (point-min))
368-
;; FIXME: This only catches comments at beginning of lines and
369-
;; starting with some spaces (so "transaction comments"). There
370-
;; can also be comments after payees or prices too
371-
(while (re-search-forward "^[ \t]+;[ \t]*\\(?1:.+\\)$" nil t)
366+
;; FIXME: This only catches comments at beginning of lines and starting
367+
;; with some spaces (so "transaction comments"). There can also be
368+
;; comments after payees or prices too, as well as comments outside of
369+
;; transactions (the latter should be completed over separately).
370+
;; TODO: Unify this regex with `ledger-comment-regex'
371+
(while (re-search-forward "^[ \t]+\\(?1:;.+\\)$" nil t)
372372
(push (match-string-no-properties 1) comments)))
373373
(sort (delete-dups comments) #'string-lessp)))
374374

0 commit comments

Comments
 (0)