help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why is this function not instantaneous?


From: Eric Abrahamsen
Subject: Re: why is this function not instantaneous?
Date: Fri, 22 Mar 2013 14:08:16 +0800
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (gnu/linux)

"B. T. Raven" <btraven@nihilo.net> writes:

> 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.

It really beats me why yours was slow, but at least it's solved! The
STRICT arg to current-word, if nil, lets you slurp in the nearest word
(even if it's many spaces distant). If REALLYWORD is nil, it adds a few
less "wordy" characters (those matching the "_" syntax) to what it will
consider a word. I agree the docstring is unhelpful, though. Anyway,
neither of those would cause a hangup, so that's still a mystery...

E




reply via email to

[Prev in Thread] Current Thread [Next in Thread]