all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using comment-region in function
@ 2004-05-13 11:45 Berthold Höllmann
  2004-05-13 12:09 ` Jesper Harder
  2004-05-13 15:44 ` Kevin Rodgers
  0 siblings, 2 replies; 7+ messages in thread
From: Berthold Höllmann @ 2004-05-13 11:45 UTC (permalink / raw)


Hello,

I'm trying to write a skeleton to insert some blurb into newly
generated source files. The text should be the same and inserted as
comment regardles the programming language. I need a hint to achiev
this.

Regards
Berthold
-- 
Dipl.-Ing. Berthold Höllmann   __   Address:
hoel@GL-Group.com           G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374    -+----+- Vorsetzen 32/35    P.O.Box 111606
fax  : +49-40-36149-7320      \__/   D-20459 Hamburg    D-20416 Hamburg

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

* Re: Using comment-region in function
  2004-05-13 11:45 Using comment-region in function Berthold Höllmann
@ 2004-05-13 12:09 ` Jesper Harder
  2004-05-13 15:28   ` Berthold Höllmann
  2004-05-13 15:44 ` Kevin Rodgers
  1 sibling, 1 reply; 7+ messages in thread
From: Jesper Harder @ 2004-05-13 12:09 UTC (permalink / raw)


hoel@gl-group.com (Berthold Höllmann) writes:

> The text should be the same and inserted as comment regardles the
> programming language. I need a hint to achiev this.

Use `comment-region'?

(comment-region 
 (point)
 (progn
   (insert "This is a comment")
   (point)))

-- 
Jesper Harder                                <http://purl.org/harder/>

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

* Re: Using comment-region in function
  2004-05-13 12:09 ` Jesper Harder
@ 2004-05-13 15:28   ` Berthold Höllmann
  2004-05-13 15:44     ` Jesper Harder
  0 siblings, 1 reply; 7+ messages in thread
From: Berthold Höllmann @ 2004-05-13 15:28 UTC (permalink / raw)


Jesper Harder <harder@myrealbox.com> writes:

> hoel@gl-group.com (Berthold Höllmann) writes:
>
>> The text should be the same and inserted as comment regardles the
>> programming language. I need a hint to achiev this.
>
> Use `comment-region'?
>
> (comment-region 
>  (point)
>  (progn
>    (insert "This is a comment")
>    (point)))

This does not work for skeletons:

(define-skeleton blurb-head
  "aa"
  "test: "
  "test " str > n)

(define-skeleton head
  "Insert a standard header for C files"
  ""
  (comment-region 
   (point)
   blurb-head
   (point)))

M-x head 

gives

eval: Symbol's value as variable is void: blurb-head

Changing "head" to

(define-skeleton head
  "Insert a standard header for C files"
  ""
  (comment-region 
   (point)
   (blurb-head)
   (point)))

gives

eval: Wrong type argument: number-or-marker-p, nil

Regards
Berthold
-- 
Dipl.-Ing. Berthold Höllmann   __   Address:
hoel@GL-Group.com           G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374    -+----+- Vorsetzen 32/35    P.O.Box 111606
fax  : +49-40-36149-7320      \__/   D-20459 Hamburg    D-20416 Hamburg

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

* Re: Using comment-region in function
  2004-05-13 15:28   ` Berthold Höllmann
@ 2004-05-13 15:44     ` Jesper Harder
  2004-05-13 19:01       ` Berthold Höllmann
  0 siblings, 1 reply; 7+ messages in thread
From: Jesper Harder @ 2004-05-13 15:44 UTC (permalink / raw)


hoel@gl-group.com (Berthold Höllmann) writes:

> Jesper Harder <harder@myrealbox.com> writes:
>
>> Use `comment-region'?
>>
>> (comment-region 
>>  (point)
>>  (progn
>>    (insert "This is a comment")
>>    (point)))
>
> This does not work for skeletons:

I don't know anything about skeletons, but ...

> (define-skeleton head
>   "Insert a standard header for C files"
>   ""
>   (comment-region 
>    (point)
>    (blurb-head)
>    (point)))

is obviously wrong.  You can't leave out the `progn' from my example.

-- 
Jesper Harder                                <http://purl.org/harder/>

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

* Re: Using comment-region in function
  2004-05-13 11:45 Using comment-region in function Berthold Höllmann
  2004-05-13 12:09 ` Jesper Harder
@ 2004-05-13 15:44 ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2004-05-13 15:44 UTC (permalink / raw)


Berthold Höllmann wrote:

> I'm trying to write a skeleton to insert some blurb into newly
> generated source files.


C-h v find-file-not-found-hooks

-- 
Kevin Rodgers

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

* Re: Using comment-region in function
  2004-05-13 15:44     ` Jesper Harder
@ 2004-05-13 19:01       ` Berthold Höllmann
  2004-05-13 20:48         ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Berthold Höllmann @ 2004-05-13 19:01 UTC (permalink / raw)


Jesper Harder <harder@myrealbox.com> writes:

> hoel@gl-group.com (Berthold Höllmann) writes:
>
>> Jesper Harder <harder@myrealbox.com> writes:
>>
>>> Use `comment-region'?
>>>
...
>>
>> This does not work for skeletons:
>
> I don't know anything about skeletons, but ...
>
...
>
> is obviously wrong.  You can't leave out the `progn' from my example.

Sorry,

(define-skeleton head
  "Insert a standard header for C files"
  ""
  (comment-region 
   (point)
   (progn
     (blurb-head)
   (point))))

does work for this simple example. Still fighting with elisp.

Thanks
Berthold
-- 
bhoel@web.de / http://starship.python.net/crew/bhoel/

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

* Re: Using comment-region in function
  2004-05-13 19:01       ` Berthold Höllmann
@ 2004-05-13 20:48         ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2004-05-13 20:48 UTC (permalink / raw)


> (define-skeleton head
>   "Insert a standard header for C files"
>   ""
>   (comment-region 
>    (point)
>    (progn
>      (blurb-head)
>    (point))))

You need a quote around the call to comment, otherwise skeleton will try to
insert whatever value is returned by comment-region.


        Stefan

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

end of thread, other threads:[~2004-05-13 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-13 11:45 Using comment-region in function Berthold Höllmann
2004-05-13 12:09 ` Jesper Harder
2004-05-13 15:28   ` Berthold Höllmann
2004-05-13 15:44     ` Jesper Harder
2004-05-13 19:01       ` Berthold Höllmann
2004-05-13 20:48         ` Stefan Monnier
2004-05-13 15:44 ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.