From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: multiple inserts within skeletons
Date: Wed, 30 Apr 2003 11:23:16 +0200 [thread overview]
Message-ID: <uwuhcnxtn.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: m2he8gzym7.fsf@sbcglobal.net
Harry Putnam <hgp@sbcglobal.net> writes:
> Oliver Scholz <alkibiades@gmx.de> writes:
>
> Oliver... I must have some language setting that will help me read
> your response. I see quite a lot of unusual chars, back slashes and
> three diget number in your text.
[...]
That sounds as if the text is interpreted as unibyte text. What is the
value of `enable-multibyte-characters' in this buffer? -- But if it is
t, what does `C-u C-x =' return with point on such a character?
> I've included quite a lot of your answer hoping to show what I see on
> this end, but not sure it will come to you as I see it. Can you
> suggest a setting that will allow me to see in english what you've
> said?
You didn't loose any information. I just have used typographical
English quotations marks (from the Unicode charset) in some places
instead of the usual ASCII-ones. Perhaps I should turn this off
again, it is probably sufficient that I annoy the people in the German
Usenet with this fancy of mine. :-)
[...]
> Thank you. Yes this is what I was after. Putting all you told me
> together I come up with an almost working skeleton. It fails to
> handle the <RET> style of closure unlike your example.
>
> My code produces a double ending if I choose to close with <RET> but
> works if I close with C-g. I'm pretty sure its got some parens
> arranged wrong or not enough `lists withing lists', but since my lisp
> skills are non-existent I've resorted to dozens of trials... so far
> none have worked like your example. Maybe you can spot the short
> comming?
>
>
> (define-skeleton hp-com_keywords
> "Insert commented keywords formatted input."
> "Keywords: "
> "# Keywords: " str \n
> ("Comment: " "# " str "\n")
> & "# "(format-time-string "%b %d %Y %w %T\n")
> & "# && CLOSED WITH <RET>"
> | resume: & "# "(format-time-string "%b %d %Y %w %T\n")"# && CLOSED WITH C-g")
^^^ ^^^
There's an `&' missing in those places. You have to "tye" elements
together that you want to insert conditionally (that is: based on the
*same* condition). An `&' means: "Insert the following element only if
point was moved due to processing of the previous element." (Which
usually means that the previous element caused some insertion.)
An IF-THEN-ELSE statement would look like this:
ELEMENT & ELEMENT [& ELEMENT] | ELEMENT [& ELEMENT]
^ ^
if then ^ else
For example:
(define-skeleton hunt-the-snark
"Insert a silly example sentence."
"Enter the name of a person: "
str & " hunts " & "the " & "snark."
| "Nobody " & "is hunting " & "anyone.")
Delete the `|' or any of the `&'s and you'll probably see what I mean.
(To get through to the THEN-part, hit RET immediately when you are
prompted for the name of a person.)
Of course, if you simply want "&&" at the end, you don't need all
those `&' and `|':
(define-skeleton hp-com_keywords
"Insert commented keywords formatted input."
"Keywords: "
"# Keywords: " str \n
("Comment: " "# " str "\n")
resume:
"# "(format-time-string "%b %d %Y %w %T\n")
"# &&")
Oliver
--
11 Floréal an 211 de la Révolution
Liberté, Egalité, Fraternité!
next prev parent reply other threads:[~2003-04-30 9:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5300.1051558114.21513.help-gnu-emacs@gnu.org>
2003-04-29 9:58 ` multiple inserts within skeletons Oliver Scholz
2003-04-29 10:52 ` Oliver Lohmann
2003-04-29 14:51 ` Harry Putnam
2003-04-29 16:22 ` Oliver Scholz
2003-04-29 23:13 ` Harry Putnam
2003-04-30 9:23 ` Oliver Scholz [this message]
2003-05-07 20:24 ` Multibyte chars [was Re: multiple inserts within skeletons] Harry Putnam
2003-05-08 7:34 ` Multibyte chars Oliver Scholz
2003-05-09 4:33 ` Harry Putnam
2003-04-28 19:29 multiple inserts within skeletons Oliver Lohmann
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=uwuhcnxtn.fsf@ID-87814.user.dfncis.de \
--to=alkibiades@gmx.de \
/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.
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).