emacs-devel
[Top][All Lists]
Advanced

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

Optional argument in skeleton


From: David Arroyo Menendez
Subject: Optional argument in skeleton
Date: Mon, 25 May 2015 07:37:19 -0400

Hi,

Using define-skeleton, I can create a function, such as

(define-skeleton php-ereg
  "Insert an ereg statement"
  ""
  '(setq regexp (skeleton-read "Regexp? "))
  '(setq string (skeleton-read "String? "))
  > "ereg(" regexp ", " string ");"
)

or 

(define-skeleton php-if
  "Insert a if statement"
  ""
  '(setq condition (skeleton-read "Condition? ")) \n
   > "if( " condition " ) {" \n
   > _ \n
   ( "other condition, %s: "
   > -2 "}" \n  
   > "else if( " str " ) {" \n
   > _ \n)
   > -2 "}" \n
   > "else {" \n
   > _ \n
   resume:
   > -2 "}" \n)

In the second function I've an optional part, but it's repeated n
times. I want a method to express a part conditional, but only 1 time.

Some idea?

Kind regards



reply via email to

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