diff options
author | Tianxiang Xiong <tianxiang.xiong@gmail.com> | 2017-01-15 12:48:14 -0800 |
---|---|---|
committer | Tianxiang Xiong <tianxiang.xiong@gmail.com> | 2017-01-15 12:55:06 -0800 |
commit | 9705b148ddb1fa90599fc3c918c2f8f8ad7d9e40 (patch) | |
tree | f37509122818d3e7d62a0db55ddf3bc9046c7154 /helm-ring.el | |
parent | 1cd075677f2d2038401e8e7ba8e86f81dc9716b5 (diff) |
Add `M-D` binding to delete elements for `helm-show-kill-ring`
Diffstat (limited to 'helm-ring.el')
-rw-r--r-- | helm-ring.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/helm-ring.el b/helm-ring.el index 5f806bdc..dbd8731b 100644 --- a/helm-ring.el +++ b/helm-ring.el @@ -49,10 +49,7 @@ If nil or zero (disabled), don't truncate candidate, show all." (defcustom helm-kill-ring-actions '(("Yank" . helm-kill-ring-action) - ("Delete" . (lambda (_candidate) - (cl-loop for cand in (helm-marked-candidates) - do (setq kill-ring - (delete cand kill-ring)))))) + ("Delete" . helm-kill-ring-action-delete)) "List of actions for kill ring source." :group 'helm-ring :type '(alist :key-type string :value-type function)) @@ -64,8 +61,9 @@ If nil or zero (disabled), don't truncate candidate, show all." (defvar helm-kill-ring-map (let ((map (make-sparse-keymap))) (set-keymap-parent map helm-map) - (define-key map (kbd "M-y") 'helm-next-line) - (define-key map (kbd "M-u") 'helm-previous-line) + (define-key map (kbd "M-y") #'helm-next-line) + (define-key map (kbd "M-u") #'helm-previous-line) + (define-key map (kbd "M-D") #'helm-kill-ring-delete) map) "Keymap for `helm-show-kill-ring'.") @@ -143,6 +141,20 @@ replace with STR as yanked string." (set-marker (mark-marker) (point) helm-current-buffer)))))) (kill-new str))) +(defun helm-kill-ring-action-delete (_candidate) + "Delete marked candidates from `kill-ring'." + (cl-loop for c in (helm-marked-candidates) + do (setq kill-ring + (delete c kill-ring)))) + +(defun helm-kill-ring-delete () + "Delete marked candidates from `kill-ring'. + +This is a command for `helm-kill-ring-map'." + (interactive) + (with-helm-alive-p + (helm-exit-and-execute-action 'helm-kill-ring-action-delete))) + ;;;; <Mark ring> ;; DO NOT use these sources with other sources use |