[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kill-ring visualization
From: |
Stefan Monnier |
Subject: |
Re: kill-ring visualization |
Date: |
Thu, 25 Mar 2010 22:53:34 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> If you use a `substring' style completion, you're already closer (tho
>> it's not a regexp-search).
> Is the below what you mean?
Yes. Here's my "not for installation" code, FWIW,
Stefan
--- lisp/simple.el 2010-02-16 14:40:45 +0000
+++ lisp/simple.el 2010-03-24 14:52:19 +0000
@@ -3115,7 +3197,7 @@
doc string for `insert-for-yank-1', which see."
(interactive "*p")
(if (not (eq last-command 'yank))
- (error "Previous command was not a yank"))
+ (call-interactively 'yank-browse)
(setq this-command 'yank)
(unless arg (setq arg 1))
(let ((inhibit-read-only t)
@@ -3135,7 +3217,7 @@
;; loop would deactivate the mark because we inserted text.
(goto-char (prog1 (mark t)
(set-marker (mark-marker) (point) (current-buffer))))))
- nil)
+ nil))
(defun yank (&optional arg)
"Reinsert (\"paste\") the last stretch of killed text.
@@ -3171,6 +3257,23 @@
(setq this-command 'yank))
nil)
+(defun yank-browse ()
+ "Browse the `kill-ring' to choose which entry to yank."
+ (interactive)
+ (minibuffer-with-setup-hook
+ (lambda ()
+ (set (make-local-variable 'completion-styles) '(substring))
+ ;; FIXME: use more separation between entries in *Completions*,
+ ;; somehow cleanup the \n in there as well. Maybe indent the
+ ;; entries a little bit.
+ (minibuffer-completion-help))
+ (let* ((kills (delete-dups (append kill-ring-yank-pointer kill-ring)))
+ (entry (completing-read "Yank: " kills nil t))
+ )
+ (setq this-command 'yank)
+ (insert-for-yank entry))))
+
+
(defun rotate-yank-pointer (arg)
"Rotate the yanking point in the kill ring.
With ARG, rotate that many kills forward (or backward, if negative)."
- Re: anything.el inclusion, (continued)
- Re: anything.el inclusion, Ted Zlatanov, 2010/03/26
- Re: anything.el inclusion, Juri Linkov, 2010/03/27
- Re: anything.el inclusion, Johan Busk Eriksson, 2010/03/28
- Re: anything.el inclusion, Yoni Rabkin, 2010/03/28
- Re: anything.el inclusion, joakim, 2010/03/28
- Re: anything.el inclusion, Ted Zlatanov, 2010/03/29
- regexp completion (was: kill-ring visualization), Stefan Monnier, 2010/03/25
- Re: kill-ring visualization, Juri Linkov, 2010/03/25
- Re: kill-ring visualization,
Stefan Monnier <=
- Re: kill-ring visualization, Juri Linkov, 2010/03/26
- Re: kill-ring visualization, Stefan Monnier, 2010/03/26
- Re: kill-ring visualization, Juri Linkov, 2010/03/27
- Re: kill-ring visualization, Stefan Monnier, 2010/03/27
- Re: kill-ring visualization, Juri Linkov, 2010/03/30
- Re: kill-ring visualization, Stefan Monnier, 2010/03/30
- Re: kill-ring visualization, Juri Linkov, 2010/03/31
- RE: kill-ring visualization, Drew Adams, 2010/03/25
RE: kill-ring visualization, Drew Adams, 2010/03/18