unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* boilerplate expansion module?
@ 2003-05-14 20:32 Ignoramus13246
  2003-05-14 20:59 ` kgold
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ignoramus13246 @ 2003-05-14 20:32 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: kgold @ 2003-05-14 20:59 UTC (permalink / raw)



abbrev-mode might do it for gnu emacs.

Otherwise try an xemacs group.

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.


-- 
-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  2003-05-14 20:32 boilerplate expansion module? Ignoramus13246
  2003-05-14 20:59 ` kgold
@ 2003-05-14 22:10 ` Pascal Bourguignon
  2003-05-15  9:26 ` Tim X
  2003-05-15 14:58 ` Ignoramus7828
  3 siblings, 0 replies; 8+ messages in thread
From: Pascal Bourguignon @ 2003-05-14 22:10 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  2003-05-14 20:59 ` kgold
@ 2003-05-15  7:00   ` Friedrich Dominicus
  0 siblings, 0 replies; 8+ messages in thread
From: Friedrich Dominicus @ 2003-05-15  7:00 UTC (permalink / raw)


kgold@watson.ibm.com (kgold) writes:

> abbrev-mode might do it for gnu emacs.
> 
> Otherwise try an xemacs group.

you may check skeleton.el

Regards
Friedrich

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  2003-05-14 20:32 boilerplate expansion module? Ignoramus13246
  2003-05-14 20:59 ` kgold
  2003-05-14 22:10 ` Pascal Bourguignon
@ 2003-05-15  9:26 ` Tim X
  2003-05-15 14:58 ` Ignoramus7828
  3 siblings, 0 replies; 8+ messages in thread
From: Tim X @ 2003-05-15  9:26 UTC (permalink / raw)


>>>>> "Ignoramus13246" == Ignoramus13246  <ignoramus13246@NOSPAM.13246.invalid> writes:

 Ignoramus13246> I am looking for some extension that would let me
 Ignoramus13246> insert boilerplate text. For example. Let's say that
 Ignoramus13246> I have a legal disclaimer saying "author is not
 Ignoramus13246> responsible for errors and omissions". And instead of
 Ignoramus13246> typing it, I would define boilerplate phrase "discl1"
 Ignoramus13246> to be "author is not responsible for errors and
 Ignoramus13246> omissions". Then as I type text, I would enter
 Ignoramus13246> discl1, press some key like M-M-b, and it would
 Ignoramus13246> replace discl1 with the actual phrase.

 Ignoramus13246> Any suggestions?

don't know about Xemacs, but in emacs you can achieve this with a
combination of abbrev-mode and skeletons or tempo templates. The emacs
info pages has this under the heading of auto-type I think.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  2003-05-14 20:32 boilerplate expansion module? Ignoramus13246
                   ` (2 preceding siblings ...)
  2003-05-15  9:26 ` Tim X
@ 2003-05-15 14:58 ` Ignoramus7828
  2003-05-15 23:54   ` Johan Bockgård
  3 siblings, 1 reply; 8+ messages in thread
From: Ignoramus7828 @ 2003-05-15 14:58 UTC (permalink / raw)


Ok, I am using abbrev-mode and it is great, with one problem.

What I want is to enable abbrev-mode for all modes and all buffers. 

According to some web page, I placed 

(abbrev-mode 1) 

into my emacs.el file. But that does not apply to buffers that I
open. I have to do same in each buffer, which is a pain. What am I
doing wrong?

thanks

i

In article <slrnbc59ul.ji8.ignoramus13246@manifold.algebra.com>, Ignoramus13246 wrote:
>  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  2003-05-15 14:58 ` Ignoramus7828
@ 2003-05-15 23:54   ` Johan Bockgård
  2003-05-16 16:46     ` Ignoramus27625
  0 siblings, 1 reply; 8+ messages in thread
From: Johan Bockgård @ 2003-05-15 23:54 UTC (permalink / raw)


Ignoramus7828 <ignoramus7828@NOSPAM.7828.invalid> writes:

> What I want is to enable abbrev-mode for all modes and all buffers. 
> According to some web page, I placed 
>
> (abbrev-mode 1) 
>
> into my emacs.el file. But that does not apply to buffers that I
> open. I have to do same in each buffer, which is a pain. What am I
> doing wrong?

,----[ C-h v abbrev-mode RET ]
| [...]
| This variable automatically becomes buffer-local when set in any fashion.
| Changing it with M-x customize sets the default value.
| Use the command `abbrev-mode' to enable or disable Abbrev mode in the current
| buffer.
| 
| You can customize this variable.
`----

Customize abbrev-mode as suggested, or use
(setq-default abbrev-mode t).

-- 
The day Microsoft makes something that doesn't suck is probably the
day they start making vacuum cleaners. -- Ernst Jan Plugge

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: boilerplate expansion module?
  2003-05-15 23:54   ` Johan Bockgård
@ 2003-05-16 16:46     ` Ignoramus27625
  0 siblings, 0 replies; 8+ messages in thread
From: Ignoramus27625 @ 2003-05-16 16:46 UTC (permalink / raw)


Here's what I did: 


In article <yoijllx7lqah.fsf@helm.dd.chalmers.se>, Johan Bockgård wrote:
>  Ignoramus7828 <ignoramus7828@NOSPAM.7828.invalid> writes:
>  
> > What I want is to enable abbrev-mode for all modes and all buffers. 
> > According to some web page, I placed 
> >
> > (abbrev-mode 1) 
> >
> > into my emacs.el file. But that does not apply to buffers that I
> > open. I have to do same in each buffer, which is a pain. What am I
> > doing wrong?
>  
>  ,----[ C-h v abbrev-mode RET ]
> | [...]
> | This variable automatically becomes buffer-local when set in any fashion.
> | Changing it with M-x customize sets the default value.
> | Use the command `abbrev-mode' to enable or disable Abbrev mode in the current
> | buffer.
> | 
> | You can customize this variable.
>  `----
>  
>  Customize abbrev-mode as suggested, or use
>  (setq-default abbrev-mode t).
>  

here's what I did:

(setq default-abbrev-mode t)

works great.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-05-16 16:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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