From: Pascal Bourguignon <spam@thalassa.informatimago.com>
Subject: Re: boilerplate expansion module?
Date: 15 May 2003 00:10:32 +0200 [thread overview]
Message-ID: <87addpuqlj.fsf@thalassa.informatimago.com> (raw)
In-Reply-To: slrnbc59ul.ji8.ignoramus13246@manifold.algebra.com
Ignoramus13246 <ignoramus13246@NOSPAM.13246.invalid> writes:
> I am looking for some extension that would let me insert boilerplate
> text. For example. Let's say that I have a legal disclaimer saying
> "author is not responsible for errors and omissions". And instead of
> typing it, I would define boilerplate phrase "discl1" to be "author is
> not responsible for errors and omissions". Then as I type text, I
> would enter discl1, press some key like M-M-b, and it would replace
> discl1 with the actual phrase.
>
> Any suggestions?
>
> I use xemacs btw.
>
> i
Untested code follows:
(defvar *boiler-plate-dir* "~/boiler-plates"
"The directory where the boiler plates are stored.")
(defun insert-boiler-plate ()
(interactive "*")
(let* ((start (progn (backward-word) (point)))
(end (progn (forward-word) (point)))
(name (buffer-substring-no-properties start end))
(fname (concat *boiler-plate-dir* "/" name ".txt")))
(unless (file-exists-p fname)
(error "Unknown boiler plate %S" name))
(delete-region start end)
(insert-file fname)))
(global-set-key "M-M-b" 'insert-boiler-plate)
Personnaly, I find that it would be better to type first M-M-b (or
whatever) then have in the minibuffer a completion on the available
boiler plates, but here you have what you asked.
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.
next prev parent reply other threads:[~2003-05-14 22:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-14 20:32 boilerplate expansion module? Ignoramus13246
2003-05-14 20:59 ` kgold
2003-05-15 7:00 ` Friedrich Dominicus
2003-05-14 22:10 ` Pascal Bourguignon [this message]
2003-05-15 9:26 ` Tim X
2003-05-15 14:58 ` Ignoramus7828
2003-05-15 23:54 ` Johan Bockgård
2003-05-16 16:46 ` Ignoramus27625
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=87addpuqlj.fsf@thalassa.informatimago.com \
--to=spam@thalassa.informatimago.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).