diff options
Diffstat (limited to 'helm-misc.el')
-rw-r--r-- | helm-misc.el | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/helm-misc.el b/helm-misc.el index 33876bd0..338b226c 100644 --- a/helm-misc.el +++ b/helm-misc.el @@ -201,26 +201,13 @@ It is added to `extended-command-history'. (define-key map [remap helm-minibuffer-history] 'undefined) map)) -(defvar helm-source-minibuffer-history - (helm-build-sync-source "Minibuffer History" - :header-name (lambda (name) - (format "%s (%s)" name minibuffer-history-variable)) - :candidates - (lambda () - (cl-loop for i in - (symbol-value minibuffer-history-variable) - unless (string= "" i) collect i into history - finally return - (if (consp (car history)) - (mapcar 'prin1-to-string history) - history))) - :keymap helm-minibuffer-history-map - :migemo t - :multiline t - :action (lambda (candidate) - (with-helm-current-buffer - (delete-minibuffer-contents) - (insert candidate))))) +(defcustom helm-minibuffer-history-must-match t + "Allow inserting non matching elements when nil or 'confirm." + :group 'helm-misc + :type '(choice + (const :tag "Must match" t) + (const :tag "Confirm" 'confirm) + (const :tag "Always allow" nil))) ;;; Shell history ;; @@ -327,10 +314,27 @@ Default action change TZ environment variable locally to emacs." (defun helm-minibuffer-history () "Preconfigured `helm' for `minibuffer-history'." (interactive) - (let ((enable-recursive-minibuffers t)) - (helm :sources 'helm-source-minibuffer-history - :buffer "*helm minibuffer-history*" - :allow-nest t))) + (cl-assert (minibuffer-window-active-p (selected-window)) nil + "Error: Attempt to use minibuffer history outside a minibuffer") + (let ((enable-recursive-minibuffers t) + (elm (helm-comp-read "pattern: " + (cl-loop for i in + (symbol-value minibuffer-history-variable) + unless (string= "" i) collect i into history + finally return + (if (consp (car history)) + (mapcar 'prin1-to-string history) + history)) + :header-name + (lambda (name) + (format "%s (%s)" name minibuffer-history-variable)) + :buffer "*helm minibuffer-history*" + :must-match helm-minibuffer-history-must-match + :multiline t + :keymap helm-minibuffer-history-map + :allow-nest t))) + (delete-minibuffer-contents) + (insert elm))) ;;;###autoload (defun helm-comint-input-ring () |