unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Inserting standard blocks of text.
@ 2003-04-26 15:49 Michael Solem
  2003-04-26 22:49 ` Leandro Guimarães Faria Corsetti Dutra
  2003-04-27  9:35 ` Oliver Lohmann
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Solem @ 2003-04-26 15:49 UTC (permalink / raw)


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

Mike

-- 
______________________________________________
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr

Powered by Outblaze

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

* Re: Inserting standard blocks of text.
  2003-04-26 15:49 Inserting standard blocks of text Michael Solem
@ 2003-04-26 22:49 ` Leandro Guimarães Faria Corsetti Dutra
  2003-04-27  9:35 ` Oliver Lohmann
  1 sibling, 0 replies; 5+ messages in thread
From: Leandro Guimarães Faria Corsetti Dutra @ 2003-04-26 22:49 UTC (permalink / raw)


On Sat, 26 Apr 2003 10:49:37 -0500, Michael Solem 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.  Thanks.

	C-x i perhaps?


-- 
  _   Leandro Guimarães Faria Corsetti Dutra    +41 (21) 648 11 34
 / \  Lausanne, Vaud, Suisse                    +41 (78) 778 11 34
 \ /  Brasil                                    +55 (11) 5686 2219
 / \  http://geocities.yahoo.com.br/lgcdutra/

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

* Re: Inserting standard blocks of text.
  2003-04-26 15:49 Inserting standard blocks of text Michael Solem
  2003-04-26 22:49 ` Leandro Guimarães Faria Corsetti Dutra
@ 2003-04-27  9:35 ` Oliver Lohmann
  1 sibling, 0 replies; 5+ messages in thread
From: Oliver Lohmann @ 2003-04-27  9:35 UTC (permalink / raw)


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/

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

* Re: Inserting standard blocks of text.
       [not found] <mailman.5231.1051372238.21513.help-gnu-emacs@gnu.org>
@ 2003-04-28 14:47 ` jason haslup
  2003-04-28 20:24 ` kgold
  1 sibling, 0 replies; 5+ messages in thread
From: jason haslup @ 2003-04-28 14:47 UTC (permalink / raw)


"Michael Solem" <msolem@linuxmail.org> writes:
> 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

You could try tempo.el, it's a nice package that lets you get
interactive with standard blocks of text.

If you're using doxygen, I've found that doxymacs
(http://doxymacs.sf.net) is great for doing such insertions.  It uses
tempo.el and automatically finds your parameters and return values and
creates entries for them in the comment.  Fully customizable, of
course.

jason

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

* Re: Inserting standard blocks of text.
       [not found] <mailman.5231.1051372238.21513.help-gnu-emacs@gnu.org>
  2003-04-28 14:47 ` jason haslup
@ 2003-04-28 20:24 ` kgold
  1 sibling, 0 replies; 5+ messages in thread
From: kgold @ 2003-04-28 20:24 UTC (permalink / raw)



(define-key esc-map "K" 'insert-kgold-header)

(defun insert-kgold-header ()
  "Insert header at the current cursor position in the current buffer."
  (interactive)
  (insert 
   "Your standard header ..."
   )
  (insert "\n")
  )

If it's a function header, you then most likely want to have
another function which cut and pastes the function name and parameters into
your header.

Bonus: You can insert a file using:

	C-x i runs the command insert-file

so you don't have to do your "open, copy, switch, paste" anyway.

"Michael Solem" <msolem@linuxmail.org> writes:
> 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.
> Thanks.

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

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

end of thread, other threads:[~2003-04-28 20:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-26 15:49 Inserting standard blocks of text Michael Solem
2003-04-26 22:49 ` Leandro Guimarães Faria Corsetti Dutra
2003-04-27  9:35 ` Oliver Lohmann
     [not found] <mailman.5231.1051372238.21513.help-gnu-emacs@gnu.org>
2003-04-28 14:47 ` jason haslup
2003-04-28 20:24 ` kgold

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