From 219cc2c34266c8bd8027390e27f5743c94c9bd4e Mon Sep 17 00:00:00 2001 From: Clemens Radermacher Date: Sat, 1 Aug 2020 13:09:34 +0200 Subject: [PATCH] Fix selectrum-insert-current-candidate error when history is ignored --- CHANGELOG.md | 4 ++++ selectrum.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcbb9087..2e5e8676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,10 @@ The format is based on [Keep a Changelog]. `completing-read-multiple` when `crm-separator` has a non default value. Previously it would replace the separator with commas when adding new candidates ([#140]). +* `selectrum-insert-current-candidate` now works from + `selectrum-select-from-history` and other commands which ignore + history by setting `minibuffer-history-variable` to `t`. Previously + an error would be thrown. [#67]: https://github.com/raxod502/selectrum/issues/67 [#82]: https://github.com/raxod502/selectrum/issues/82 diff --git a/selectrum.el b/selectrum.el index 14d6e890..6a380f5e 100644 --- a/selectrum.el +++ b/selectrum.el @@ -1140,7 +1140,8 @@ list). A null or non-positive ARG inserts the candidate corresponding to selectrum--refined-candidates)) (full (selectrum--get-full candidate))) (insert full) - (add-to-history minibuffer-history-variable full) + (unless (eq t minibuffer-history-variable) + (add-to-history minibuffer-history-variable full)) (apply #'run-hook-with-args 'selectrum-candidate-inserted-hook