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; 3+ 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] 3+ 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
  2006-01-09 15:49   ` optimal skeleton definition: solved Martin Slouf
  0 siblings, 1 reply; 3+ 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] 3+ messages in thread

* Re: optimal skeleton definition: solved
  2006-01-09  4:07 ` optimal skeleton definition Stefan Monnier
@ 2006-01-09 15:49   ` Martin Slouf
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Slouf @ 2006-01-09 15:49 UTC (permalink / raw)


thanks a lot. m.

On Sun, Jan 08, 2006 at 11:07:13PM -0500, Stefan Monnier wrote:
> > 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
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

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

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

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