From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: why is this function not instantaneous? Date: Fri, 22 Mar 2013 14:08:16 +0800 Message-ID: <87li9g55m7.fsf@ericabrahamsen.net> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363932181 18229 80.91.229.3 (22 Mar 2013 06:03:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Mar 2013 06:03:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 22 07:03:25 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UIv4V-0004jl-Uv for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Mar 2013 07:03:24 +0100 Original-Received: from localhost ([::1]:53515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIv48-0006xx-HJ for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Mar 2013 02:03:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIv3u-0006xn-7r for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:02:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIv3q-0008DE-2g for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:02:46 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIv3p-0008Cy-SA for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:02:42 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UIv49-0004YZ-RL for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 07:03:01 +0100 Original-Received: from 114.252.240.170 ([114.252.240.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Mar 2013 07:03:01 +0100 Original-Received: from eric by 114.252.240.170 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Mar 2013 07:03:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 114.252.240.170 User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:cud7zLnnUbebaK5k78HZSCk3hD0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89653 Archived-At: "B. T. Raven" 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