summaryrefslogtreecommitdiff
path: root/helm-ring.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-16 16:39:06 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-16 16:39:06 +0200
commitcd24f1d36f653b4359582ba3b6df4089bff06e1f (patch)
tree7c3fb7b6252cf31b8e84ac20b8cf9bb197be1d62 /helm-ring.el
parent0451d5e8962b7697b1fca4f3677010ccd7a670f3 (diff)
Reenable timers in kill-ring action
to allow detecting mark and point in the previous minibuffer, otherwise point is left at beginning of inserted string. * helm-ring.el (helm-kill-ring-action-yank): Do it.
Diffstat (limited to 'helm-ring.el')
-rw-r--r--helm-ring.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/helm-ring.el b/helm-ring.el
index 3b142063..1c196104 100644
--- a/helm-ring.el
+++ b/helm-ring.el
@@ -155,7 +155,9 @@ replace with STR as yanked string."
(when (and (region-active-p) delete-selection-mode)
(delete-region (region-beginning) (region-end)))
(if (not (eq (helm-attr 'last-command helm-source-kill-ring) 'yank))
- (insert-for-yank str)
+ ;; When yanking in a helm minibuffer we need a small
+ ;; delay to detect the mark in previous minibuffer. [1]
+ (run-with-timer 0.01 nil (lambda () (insert-for-yank str)))
;; from `yank-pop'
(let ((inhibit-read-only t)
(before (< (point) (mark t))))
@@ -164,7 +166,8 @@ replace with STR as yanked string."
(funcall (or yank-undo-function 'delete-region) (mark t) (point)))
(setq yank-undo-function nil)
(set-marker (mark-marker) (point) helm-current-buffer)
- (insert-for-yank str)
+ ;; Same as [1]
+ (run-with-timer 0.01 nil (lambda () (insert-for-yank str)))
;; Set the window start back where it was in the yank command,
;; if possible.
(set-window-start (selected-window) yank-window-start t)