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: Wed, 20 Mar 2013 09:30:59 +0800
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2 (gnu/linux)

"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 via email to

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