help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting standard blocks of text.


From: Oliver Lohmann
Subject: Re: Inserting standard blocks of text.
Date: Sun, 27 Apr 2003 11:35:09 +0200

Hello Mike,

Saturday, April 26, 2003, 5:49:37 PM, you wrote:

> Is there a way to have a block of text that can be pasted in a
> file at any time (something that will not be overwritten when
> you do a Ctrl-k etc...).  I would like to put a standard header in fron
> of all my functions when I'm programming.  It will always be the same.
> It would be nice to not have to open a file, copy the header,
> switch back to the file I'm working on, and then paste it in. 

What's about writing a skeleton combined with an abbrev?
Kind of this (c-style):

(define-skeleton my-comment
  "insert-skeleton for comments"
  >"/*****************************************************" \n
  >"* "(skeleton-read "function title: ") \n
  >"* " \n
  >"* " _ \n
  >"* " \n
  >"* " \n
  >"*****************************************************/"  \n)

  (define-abbrev c-mode-abbrev-table "cmnt" "" 'my-comment)


just put it in your .emacs file and switch to c-mode type
'cmnt' an it will expand. you could also define a keyboard
shortcut for your purpose. feel free to define it for other
abbrev-tables (m-x list-abbrevs).

i think this solution is more comfortable and flexible as the
insert-file.


-- 
Best regards,
 Oliver Lohmann
____________   ______
\   \~~~\   \  \    /   Fachhochschule Wedel
 \   \   \   \  \  /   Feldstrasse 143
  \   \== \   \==\/   D-22880 Wedel
   \   \   \   \     Fachbereich
    \  /    \  /    Medieninformatik
     \/      \/    http://www.fh-wedel.de/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]