From: Tim Johnson <tim@johnsons-web.com>
Subject: Re: copy-region-as-kill => variable
Date: Mon, 16 Jan 2006 16:08:37 -0900 [thread overview]
Message-ID: <20060117010837.GD17476@johnsons-web.com> (raw)
In-Reply-To: <pcod5irafm5.fsf@shuttle.math.ntnu.no>
* Harald Hanche-Olsen <hanche@math.ntnu.no> [060116 15:08]:
> + Tim Johnson <tim@johnsons-web.com>:
>
> | 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"
(interactive)
(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
key.
Cheers
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
next prev parent reply other threads:[~2006-01-17 1:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1361.1137452959.26925.help-gnu-emacs@gnu.org>
2006-01-16 23:59 ` copy-region-as-kill => variable Harald Hanche-Olsen
2006-01-17 1:08 ` Tim Johnson [this message]
[not found] ` <mailman.1370.1137460102.26925.help-gnu-emacs@gnu.org>
2006-01-17 1:46 ` Harald Hanche-Olsen
2006-01-16 23:09 Tim Johnson
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060117010837.GD17476@johnsons-web.com \
--to=tim@johnsons-web.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).