all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Skeleton With Embedded Quotes
@ 2005-11-20 21:26 gamename
  2005-11-21 17:25 ` rgb
  2005-11-22 16:32 ` Tim Johnson
  0 siblings, 2 replies; 4+ messages in thread
From: gamename @ 2005-11-20 21:26 UTC (permalink / raw


Hi,

I'm trying to create a skeleton for a debug statement in tcl.  I want
the skeleton to produce something like this:

mylib::debug " "

(The cursor would be placed between the quotations.)

Unfortunately, skeleton uses double quotes as the delimiter for its own
definition.  So, how do you get skeleton to print double quotes?  Here
is what I have so Far:

(define-skeleton tcl-debug
  "Tcl debug statement"  nil
  > "mylib::debug " \ \n)

TIA,
-T

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

* Re: Skeleton With Embedded Quotes
  2005-11-20 21:26 Skeleton With Embedded Quotes gamename
@ 2005-11-21 17:25 ` rgb
  2005-11-21 18:58   ` gamename
  2005-11-22 16:32 ` Tim Johnson
  1 sibling, 1 reply; 4+ messages in thread
From: rgb @ 2005-11-21 17:25 UTC (permalink / raw


> Hi,
>
> I'm trying to create a skeleton for a debug statement in tcl.  I want
> the skeleton to produce something like this:
>
> mylib::debug " "
>
> (The cursor would be placed between the quotations.)
>
> Unfortunately, skeleton uses double quotes as the delimiter for its own
> definition.  So, how do you get skeleton to print double quotes?  Here
> is what I have so Far:
>
> (define-skeleton tcl-debug
>   "Tcl debug statement"  nil
>   > "mylib::debug " \ \n)

(define-skeleton tcl-debug
  "Tcl debug statement"  nil 
  > "mylib::debug \"" _ "\"" \n)

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

* Re: Skeleton With Embedded Quotes
  2005-11-21 17:25 ` rgb
@ 2005-11-21 18:58   ` gamename
  0 siblings, 0 replies; 4+ messages in thread
From: gamename @ 2005-11-21 18:58 UTC (permalink / raw


Perfect! That worked.  Thank you, sir.

-T

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

* Re: Skeleton With Embedded Quotes
  2005-11-20 21:26 Skeleton With Embedded Quotes gamename
  2005-11-21 17:25 ` rgb
@ 2005-11-22 16:32 ` Tim Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Johnson @ 2005-11-22 16:32 UTC (permalink / raw


* gamename <namesagame-usenet@yahoo.com> [051120 12:37]:
> Hi,
 
  Hello:

> I'm trying to create a skeleton for a debug statement in tcl.  I want
> the skeleton to produce something like this:
> 
> mylib::debug " "
> 
> (The cursor would be placed between the quotations.)
> 
> Unfortunately, skeleton uses double quotes as the delimiter for its own
> definition.  So, how do you get skeleton to print double quotes?  Here
> is what I have so Far:
 
  I'm not entirely sure what you are up to here, since your approach
  differs from mine, but you can escape a double quote with a backslash.
  I use the elisp 'insert function for inserting debug stubs.

>
> (define-skeleton tcl-debug
>   "Tcl debug statement"  nil
>   > "mylib::debug " \ \n)

You might find the code below useful as an example - bear in mind, that
I am pretty new to elisp.

(defun debug-stub-global ()
    " Insert debugging code for non-class variable"
    (interactive "*")
    (cond ((string-equal mode-name "Rebol Mode")
           (beginning-of-line-text)
           (insert "dbg ")
           (tj-next-whitespace)
           (insert " ;; DEBUG STUB"))
         ((string-equal mode-name "JavaScript")
           (let (cur-word)
             (setq cur-word (current-word))
             (beginning-of-line-text)
             (kill-line)
             (insert (concat "alert('" cur-word ": ' + " cur-word ");"))))
         ((string-equal mode-name "Python")
           (let (cur-word)
             (setq cur-word (current-word))
             (beginning-of-line-text)
             (kill-line)
             (insert (concat "print \"<BR>" cur-word " = \", " cur-word " # DEBUG " cur-word))))
         (t(message "NOT IMPLEMENTED FOR THIS MODE!"))))
;; this should be the only dependency:
(defun tj-next-whitespace ()
  "Move cursor to next whitespace OR end of line."
  (interactive)
  (re-search-forward "$\\|[\t ]"))

HTH
-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

end of thread, other threads:[~2005-11-22 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-20 21:26 Skeleton With Embedded Quotes gamename
2005-11-21 17:25 ` rgb
2005-11-21 18:58   ` gamename
2005-11-22 16:32 ` Tim Johnson

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.