[Top][All Lists]

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

Re: copy-region-as-kill => variable

From: Tim Johnson
Subject: Re: copy-region-as-kill => variable
Date: Mon, 16 Jan 2006 16:08:37 -0900
User-agent: Mutt/

* Harald Hanche-Olsen <address@hidden> [060116 15:08]:
> + Tim Johnson <address@hidden>:
> |   Is there a function that would operate as copy-region-as-kill,
> | but instead of copying to kill-ring would copy the data to a variable,
> | such as one created by 'defvar?
> Such a beast is not terribly hard to write:
> (defun copy-region-to-variable (start end variable)
>   (interactive "r\nvCopy region to variable: ")
>   (set variable (buffer-substring start end)))
> Note that this copies text properties as well.
> You may find this confusing.  Or perhaps not.
Hi Harald:

(defun copy-rad-tag-text ()
  "Copy text inside of radio pseudo-tag to custom variable"
  (let ((endpoint (point)))
    (message (number-to-string endpoint))
    (search-backward "rbtn")
    (forward-char 5)
    (setq tj-adhoc-1 (buffer-substring (point) endpoint))))
;; I get a wrong-type-of-argument error with 'set, thus setq.

Thanks for getting me started with this 'buffer-substring was the

Tim Johnson <address@hidden>

reply via email to

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