all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Johnson <tim@johnsons-web.com>
Subject: Re: Skeleton With Embedded Quotes
Date: Tue, 22 Nov 2005 07:32:37 -0900	[thread overview]
Message-ID: <20051122163237.GB1828@johnsons-web.com> (raw)
In-Reply-To: <1132522006.284995.262890@g47g2000cwa.googlegroups.com>

* 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

      parent reply	other threads:[~2005-11-22 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051122163237.GB1828@johnsons-web.com \
    --to=tim@johnsons-web.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.