branch: externals/embark commit 9d02dd1359892d7f72af253e624f19f51a2348e0 Author: Omar Antolín Camarena <omar.anto...@gmail.com> Commit: Omar Antolín Camarena <omar.anto...@gmail.com>
Remove invisible text from input in embark-become This fixes #646 --- CHANGELOG.org | 3 +++ embark.el | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index c568fb14a6..9bb78fdd0f 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -8,6 +8,9 @@ - Added key bindings for org agenda items consistent with those of org headings where possible. Also improved bindings for org targets in general. +- =embark-become= now removes any invisible text from the minibuffer + input on the grounds that users probably expect the target command + to receive exactly the input they can see. * Version 0.22.1 (2023-04-20) ** New feature: selections Now users can select several targets to make an ad hoc collection. The diff --git a/embark.el b/embark.el index f36ad30c4d..cf08fec1fb 100644 --- a/embark.el +++ b/embark.el @@ -2529,11 +2529,12 @@ point." (interactive "P") (unless (minibufferp) (user-error "Not in a minibuffer")) - (let* ((target (if full - (minibuffer-contents) - (pcase-let ((`(,beg . ,end) (embark--boundaries))) - (substring (minibuffer-contents) beg - (+ end (embark--minibuffer-point)))))) + (let* ((target (embark--display-string ; remove invisible portions + (if full + (minibuffer-contents) + (pcase-let ((`(,beg . ,end) (embark--boundaries))) + (substring (minibuffer-contents) beg + (+ end (embark--minibuffer-point))))))) (keymap (embark--become-keymap)) (targets `((:type embark-become :target ,target))) (indicators (mapcar #'funcall embark-indicators))