unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* optimal skeleton definition
@ 2006-01-08 17:34 Martin Slouf
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Slouf @ 2006-01-08 17:34 UTC (permalink / raw)


hi,

being not an elisp expert i wrote this kind of skeleton to simplify my java
getter/setter generation, which is later bound to some abbrev to be expanded
automatically.

- - - -

(define-skeleton java-getter-setter
  "inserts java getter/setter pair"
  nil (setq v1 (skeleton-read "Input Java type: "))
  nil (setq v2 (skeleton-read "Input property name: "))
  (setq method-part-name (concat (upcase (substring v2 0 1)) (substring v2 1)))
  nil >"public " v1 " get" method-part-name "() {"?\n
  >"return this." v2 ";"?\n
  "}">""?\n\n
  >"public void set" method-part-name "(" v1 " " v2 ") {"?\n
  >"this." v2 " = " v2 ";"?\n
  "}">)

- - - -

the problem of the code above is, that (setq ...) functions always return a
value and that value is printed into a buffer.  Is there a chance not to print
the value of the setq s-expression to the buffer?

thanks.  martin

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

* Re: optimal skeleton definition
       [not found] <mailman.359.1136741825.26925.help-gnu-emacs@gnu.org>
@ 2006-01-09  4:07 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2006-01-09  4:07 UTC (permalink / raw)


> being not an elisp expert i wrote this kind of skeleton to simplify my java
> getter/setter generation, which is later bound to some abbrev to be expanded
> automatically.

> - - - -

> (define-skeleton java-getter-setter
>   "inserts java getter/setter pair"
>   nil (setq v1 (skeleton-read "Input Java type: "))
>   nil (setq v2 (skeleton-read "Input property name: "))
>   (setq method-part-name (concat (upcase (substring v2 0 1)) (substring v2 1)))
>   nil >"public " v1 " get" method-part-name "() {"?\n
>> "return this." v2 ";"?\n
>   "}">""?\n\n
>> "public void set" method-part-name "(" v1 " " v2 ") {"?\n
>> "this." v2 " = " v2 ";"?\n
>   "}">)

> - - - -

> the problem of the code above is, that (setq ...) functions always return
> a value and that value is printed into a buffer.  Is there a chance not to
> print the value of the setq s-expression to the buffer?

Quote your setq.  I.e. use

            '(setq foo bar)
instead of
            (setq foo bar)


-- Stefan

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

end of thread, other threads:[~2006-01-09  4:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-08 17:34 optimal skeleton definition Martin Slouf
     [not found] <mailman.359.1136741825.26925.help-gnu-emacs@gnu.org>
2006-01-09  4:07 ` Stefan Monnier

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