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: rendering a string as a new line? Date: Fri, 19 Sep 2003 06:19:05 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1063945940 8921 80.91.224.253 (19 Sep 2003 04:32:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2003 04:32:20 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 19 06:32:18 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0CwM-0001zL-00 for ; Fri, 19 Sep 2003 06:32:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0CvE-0005wI-Ow for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Sep 2003 00:31:08 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!fu-berlin.de!uni-berlin.de!dialin-145-254-195-010.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 73 Original-NNTP-Posting-Host: dialin-145-254-195-010.arcor-ip.net (145.254.195.10) Original-X-Trace: news.uni-berlin.de 1063945222 696857 145.254.195.10 (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.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:X5Dfu/2EfK4EiVVv4xnExys2oO4= Original-Xref: shelby.stanford.edu gnu.emacs.help:116722 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12643 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12643 "Stefan Monnier" writes: >>>> If the tag is more than 1 character (e.g. an XML tag), >>> That's the case. >> That would probably rule out a coding system as a more efficient >> alternative to font-lock. > > What makes you think so ? [...] It's more or less a guess. It depends on the actual tag. If it is indeed an XML tag among other XML tags, then it could be hairy to write a CCL program. I believe that you could always--as a last resort--implement a state machine to decode arbitrary tags, using the `branch' statement from CCL, but it would still be hairy. As I said, depending on the actual tag. Hmmm, for example if the newline-tag is

: (define-ccl-program egoge-test '(1 ((r0 = 0) (loop (read r1) (branch r0 (if (r1 == ?<) (r0 = 1) (write r1)) (if (r1 == ?p) (r0 = 2) ((write ?<) (write r1) (r0 = 0))) (if (r1 == ?/) (r0 = 3) ((write ?<) (write ?p) (write r1) (r0 = 0))) (if (r1 == ?>) ((r0 = 0) (write ?\n)) ((write ?<) (write ?p) (write ?/) (write r1) (r0 = 0)))) (repeat))))) ;; Testing (let ((str "lirum

larum") (vect (make-vector 9 nil))) (ccl-execute-on-string 'egoge-test vect str)) The question is, where you draw the line between character encoding and formatting markup. If those “tags” are rather formatting markup, then I think it is better to use the functionality already provided by Emacs for this purpose: either `after-insert-file-functions' and `write-file-functions' respectively or the functionality provided by format.el. This has also the benefit that you could put a text property on the converted newlines to distinguish them from regular newlines (if there are any) so that there is no ambiguity, when encoding the buffer again. This is all very hypothetical. Now I am curious how those tags actually look like and what the file format in question is. Oliver -- Jour du Génie de l'Année 211 de la Révolution Liberté, Egalité, Fraternité!