diff options
author | Steve Purcell <steve@sanityinc.com> | 2019-07-05 08:15:45 +1200 |
---|---|---|
committer | Steve Purcell <steve@sanityinc.com> | 2019-07-05 08:17:40 +1200 |
commit | 629ce581472910492b8cc3b77963b6a61142a327 (patch) | |
tree | cb05fcc0366a7cbe23c5575e08451bfafc921555 | |
parent | 74091722c6ef5429fc3d87c2132041c28a74d012 (diff) |
Never include the completion prefix in the candidates list
In Emacs 24.3, in particular, the presence of such a candidate causes
completion-at-point to simply report that the current symbol is complete.
-rw-r--r-- | ledger-complete.el | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/ledger-complete.el b/ledger-complete.el index e0c0994..1964818 100644 --- a/ledger-complete.el +++ b/ledger-complete.el @@ -248,16 +248,19 @@ Looks in `ledger-accounts-file' if set, otherwise the current buffer." #'ledger-accounts-tree #'ledger-accounts-list)))) (when collection - (list start end - (if (functionp collection) - (completion-table-dynamic (lambda (_) (funcall collection))) - collection) - :exit-function (lambda (&rest _) - (when delete-suffix - (delete-char delete-suffix)) - (when (and realign-after ledger-post-auto-align) - (ledger-post-align-postings (line-beginning-position) (line-end-position)))) - 'ignore)))) + (let ((prefix (buffer-substring-no-properties start end))) + (list start end + (if (functionp collection) + (completion-table-dynamic + (lambda (_) + (cl-remove-if (apply-partially 'string= prefix) (funcall collection)))) + collection) + :exit-function (lambda (&rest _) + (when delete-suffix + (delete-char delete-suffix)) + (when (and realign-after ledger-post-auto-align) + (ledger-post-align-postings (line-beginning-position) (line-end-position)))) + 'ignore))))) (defun ledger-trim-trailing-whitespace (str) (replace-regexp-in-string "[ \t]*$" "" str)) |