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: Wed, 20 Mar 2013 09:30:59 +0800 Message-ID: <877gl2eu24.fsf@ericabrahamsen.net> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363742749 27617 80.91.229.3 (20 Mar 2013 01:25:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Mar 2013 01:25:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 20 02:26:14 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 1UI7nB-00089H-HN for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Mar 2013 02:26:13 +0100 Original-Received: from localhost ([::1]:42075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI7mo-00074S-Bb for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Mar 2013 21:25:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI7mU-00073n-AB for help-gnu-emacs@gnu.org; Tue, 19 Mar 2013 21:25:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UI7mO-0005Y8-5X for help-gnu-emacs@gnu.org; Tue, 19 Mar 2013 21:25:30 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:54513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UI7mN-0005Xu-VB for help-gnu-emacs@gnu.org; Tue, 19 Mar 2013 21:25:24 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UI7mj-0007wi-9T for help-gnu-emacs@gnu.org; Wed, 20 Mar 2013 02:25:45 +0100 Original-Received: from 114.250.134.56 ([114.250.134.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Mar 2013 02:25:45 +0100 Original-Received: from eric by 114.250.134.56 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Mar 2013 02:25:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 114.250.134.56 User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:y0nt32VsRhdEQBMIr1AlokslbMI= 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:89604 Archived-At: "B. T. Raven" writes: > A few months ago I somehow misplaced the original of this function: > > > (defun copy-to-other-window (beg end) ;; bind to f8 > "Copy region text to buffer in other window\n" > (interactive "r") > (if (not (use-region-p)) > (progn > (backward-word) > (let ((beg (point))) (forward-word) (copy-region-as-kill \ > beg (point))) > )) > (other-window 1) > (yank) > ) I have no idea why that would bog down your machine, but here's my equivalent version of the same thing -- see if this works? Your use of `other-window' might be better than my `next-window', which could potentially yank into a non-visible window. (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))) HTH, Eric