all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: why is this function not instantaneous?
Date: Wed, 20 Mar 2013 09:30:59 +0800	[thread overview]
Message-ID: <877gl2eu24.fsf@ericabrahamsen.net> (raw)
In-Reply-To: kiagc10sh0@news7.newsguy.com

"B. T. Raven" <btraven@nihilo.net> 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




  reply	other threads:[~2013-03-20  1:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19 20:04 why is this function not instantaneous? B. T. Raven
2013-03-20  1:30 ` Eric Abrahamsen [this message]
     [not found] ` <mailman.22508.1363742738.855.help-gnu-emacs@gnu.org>
2013-03-21 19:38   ` B. T. Raven
2013-03-22  6:08     ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877gl2eu24.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.