From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: multiple inserts within skeletons Date: Wed, 30 Apr 2003 11:23:16 +0200 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1051695080 27462 80.91.224.249 (30 Apr 2003 09:31:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 30 Apr 2003 09:31:20 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 30 11:31:18 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Anvp-00078d-00 for ; Wed, 30 Apr 2003 11:31:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19AnvO-0006ma-02 for gnu-help-gnu-emacs@m.gmane.org; Wed, 30 Apr 2003 05:30:50 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!frnk-d9b9408e.pool.mediaways.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 88 Original-NNTP-Posting-Host: frnk-d9b9408e.pool.mediaways.net (217.185.64.142) Original-X-Trace: fu-berlin.de 1051694924 12412720 217.185.64.142 (16 [87814]) X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6;Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:VATf0EOjTldwet1miQxX2Md1a+0= Original-Xref: shelby.stanford.edu gnu.emacs.help:112554 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:9050 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:9050 Harry Putnam writes: > Oliver Scholz 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 style of closure unlike your example. > > My code produces a double ending if I choose to close with 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 " > | 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é!