From: Joakim Hove <hove@bccs.no>
Subject: Re: copy-region-to-variable
Date: Wed, 04 Feb 2004 14:14:57 +0100 [thread overview]
Message-ID: <4yllnj56lq.fsf@skjellgran.ii.uib.no> (raw)
In-Reply-To: bvqqpd$uh$1@news.tue.nl
"hans nieuwenhuizen" <j.k.nieuwenhuizen@tue.nl> writes:
> None of the almost 2000 built-in functions of emacs 21.2 seems to copy part
> of the buffer ( region ) into a variable.
>
> You need that e.g. if you have to enlarge the double in the region by a
> factor of
> say 3.456 .
If you just mean the text content of the buffer you can use
(buffer-substring p1 p2)
or
(buffer-substring-no-properties p1 p2)
which return the buffer-content between p1 and p2.
HTH Joakim
Untested:
---------
(defun enlarge-double (p1 p2)
(interactive "r")
(let ((new-number (* 3.456 (string-to-number (buffer-substring-no-properties p1 p2)))))
(kill-region p1 p2)
(goto-char p1)
(insert (format "%s" new-number))))
--
/--------------------------------------------------------------------\
/ Joakim Hove / hove@bccs.no / (55 5) 84076 | \
| Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
| CMU | 5231 Paradis |
\ Thormøhlensgt.55, 5020 Bergen. | 55 91 28 18 /
\--------------------------------------------------------------------/
next prev parent reply other threads:[~2004-02-04 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-04 13:06 copy-region-to-variable hans nieuwenhuizen
2004-02-04 13:14 ` Joakim Hove [this message]
2004-02-04 13:50 ` copy-region-to-variable Johan Bockgård
2004-02-04 19:47 ` copy-region-to-variable Gareth Rees
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=4yllnj56lq.fsf@skjellgran.ii.uib.no \
--to=hove@bccs.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).