summaryrefslogtreecommitdiff
path: root/helm-misc.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-01-26 08:34:47 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-01-26 08:48:23 +0100
commite2b3a703c3059651a08ebf994c7923c97cdb9353 (patch)
treede5437dc8f26df7ce2e007bcb998988c725cf414 /helm-misc.el
parent1f802a3d50be5af63f9027f9377dbfea5349442a (diff)
Fix prevent calling helm-minibuffer-history on itself.
* helm-misc.el (helm-minibuffer-history-map): Use C-r. (helm-minibuffer-history): Do it.
Diffstat (limited to 'helm-misc.el')
-rw-r--r--helm-misc.el68
1 files changed, 37 insertions, 31 deletions
diff --git a/helm-misc.el b/helm-misc.el
index 238105d4..e96f849c 100644
--- a/helm-misc.el
+++ b/helm-misc.el
@@ -198,7 +198,7 @@ It is added to `extended-command-history'.
(defvar helm-minibuffer-history-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map helm-map)
- (define-key map [remap helm-minibuffer-history] 'undefined)
+ (define-key map (kbd "C-r") 'undefined)
map))
(defcustom helm-minibuffer-history-must-match t
@@ -316,36 +316,42 @@ Default action change TZ environment variable locally to emacs."
(interactive)
(cl-assert (minibuffer-window-active-p (selected-window)) nil
"Error: Attempt to use minibuffer history outside a minibuffer")
- (let* ((enable-recursive-minibuffers t)
- (query-replace-p (or (eq last-command 'query-replace)
- (eq last-command 'query-replace-regexp)))
- (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 (not (eq last-command
- 'helm-minibuffer-history)))))
- ;; Fix issue #1667 with emacs-25+ `query-replace-from-to-separator'.
- (when (and (boundp 'query-replace-from-to-separator) query-replace-p)
- (let ((pos (string-match "\0" elm)))
- (and pos
- (add-text-properties
- pos (1+ pos)
- `(display ,query-replace-from-to-separator separator t)
- elm))))
- (delete-minibuffer-contents)
- (insert elm)))
+ (let ((ori-key (car-safe (where-is-internal 'helm-minibuffer-history helm-map))))
+ ;; Disable C-r from helm-map which inherit this key from
+ ;; minibuffer-local-map.
+ (and ori-key (define-key helm-map ori-key 'undefined))
+ (unwind-protect
+ (let* ((enable-recursive-minibuffers t)
+ (query-replace-p (or (eq last-command 'query-replace)
+ (eq last-command 'query-replace-regexp)))
+ (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)))
+ ;; Fix issue #1667 with emacs-25+ `query-replace-from-to-separator'.
+ (when (and (boundp 'query-replace-from-to-separator) query-replace-p)
+ (let ((pos (string-match "\0" elm)))
+ (and pos
+ (add-text-properties
+ pos (1+ pos)
+ `(display ,query-replace-from-to-separator separator t)
+ elm))))
+ (delete-minibuffer-contents)
+ (insert elm))
+ ;; Reinit C-r in helm-map.
+ (and ori-key (define-key helm-map ori-key 'helm-minibuffer-history)))))
;;;###autoload
(defun helm-comint-input-ring ()