unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Harald Hanche-Olsen <hanche@math.ntnu.no>
Subject: Re: copy-region-as-kill => variable
Date: Tue, 17 Jan 2006 00:59:46 +0100	[thread overview]
Message-ID: <pcod5irafm5.fsf@shuttle.math.ntnu.no> (raw)
In-Reply-To: mailman.1361.1137452959.26925.help-gnu-emacs@gnu.org

+ 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.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow

       reply	other threads:[~2006-01-16 23:59 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 ` Harald Hanche-Olsen [this message]
2006-01-17  1:08   ` copy-region-as-kill => variable Tim Johnson
     [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=pcod5irafm5.fsf@shuttle.math.ntnu.no \
    --to=hanche@math.ntnu.no \
    /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).