[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why is this function not instantaneous?
From: |
B. T. Raven |
Subject: |
Re: why is this function not instantaneous? |
Date: |
Thu, 21 Mar 2013 14:38:37 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 |
Eric wrote:
> (defun my-yank-to-other-window (p m)
> "Yank region to point of other window."
> (interactive "r")
> (let ((s (if (use-region-p)
> (buffer-substring-no-properties p m)
> (current-word))))
> (select-window (next-window))
> (insert s)))
Thanks, Eric. That works without delay. Since I use this only (almost
only) to transfer text between a dictionary and an rcirc window, I will
use this hybrid of my and your functions:
(defun tow (p m) ;; bind to F8
"Copy region text or word to buffer in other window\n"
(interactive "r")
(let ((s (if (use-region-p)
(buffer-substring-no-properties p m)
(current-word nil t))))
(other-window 1)
(insert s)))
I don't really understand the "strict" and "reallyword" optional
arguments to 'current-word but using nil and t for them doesn't cause a
hang-up like my 'copy-region-as-kill function did. (could it be coercing
garbage collection?) In fact, 'current-word was a new function to me.
Thanks for that.
Btw, my pathological naming 'tow is just so I can used M-x tow in case I
want to assign something else to f8.
Ed