From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: copy-region-as-kill => variable Date: Mon, 16 Jan 2006 16:08:37 -0900 Message-ID: <20060117010837.GD17476@johnsons-web.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137460650 28731 80.91.229.2 (17 Jan 2006 01:17:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Jan 2006 01:17:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 17 02:17:25 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EyfTG-0008IL-Tk for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Jan 2006 02:17:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EyfVZ-0000oV-Tz for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jan 2006 20:19:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EyfKe-0005J1-KF for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 20:08:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EyfKX-0005FF-5y for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 20:08:16 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EyfKT-0005F2-K7 for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 20:08:12 -0500 Original-Received: from [208.218.214.23] (helo=mx1.cniweb.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EyfO4-0006EN-Jo for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 20:11:52 -0500 Original-Received: from linus.johnson.com (rdbck-static-445.palmer.mtaonline.net [64.4.232.191]) by mx1.cniweb.net (8.13.5/8.13.5) with ESMTP id k0H15NZJ005909 for ; Mon, 16 Jan 2006 20:05:23 -0500 (EST) Original-Received: from linus.johnson.com (localhost.johnson.com [127.0.0.1]) by linus.johnson.com (8.12.8/8.12.8) with ESMTP id k0H18b5C019312 for ; Mon, 16 Jan 2006 16:08:38 -0900 Original-Received: (from tim@localhost) by linus.johnson.com (8.12.8/8.12.8/Submit) id k0H18bRA019310 for help-gnu-emacs@gnu.org; Mon, 16 Jan 2006 16:08:37 -0900 Original-To: help-gnu-emacs@gnu.org Mail-Followup-To: Tim Johnson , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32693 Archived-At: * Harald Hanche-Olsen [060116 15:08]: > + Tim Johnson : > > | 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 http://www.alaska-internet-solutions.com