From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: Writing my first elisp mode...concept Q Date: Tue, 3 Aug 2010 13:15:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9af05e3d-3978-41cb-a6ad-07e7ac1bf7be@h40g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291857233 1410 80.91.229.12 (9 Dec 2010 01:13:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 01:13:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 02:13:49 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQV4t-00074H-Kv for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 02:13:47 +0100 Original-Received: from localhost ([127.0.0.1]:34375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQV4s-0002zU-Vb for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 20:13:47 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!u31g2000pru.googlegroups.com!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help Original-Lines: 78 Original-NNTP-Posting-Host: 67.180.85.8 Original-X-Trace: posting.google.com 1280866516 29500 127.0.0.1 (3 Aug 2010 20:15:16 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 3 Aug 2010 20:15:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u31g2000pru.googlegroups.com; posting-host=67.180.85.8; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4, gzip(gfe) Original-Xref: usenet.stanford.edu comp.emacs:100286 gnu.emacs.help:180320 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76360 Archived-At: On Jul 28, 11:05=C2=A0am, Raindog wrote: > Hello, > > I'm semi-new to emacs and now have a programming need that is list- > based and editing-intensive. =C2=A0So I thought I might take a shot at > writing an emacs mode. =C2=A0I'm curious the best way to approach is. > > Quick summary: I'm looking to write a program to do morphological > forced connections. =C2=A0You make lists of words like this: > > type: cavern, city, county, mountain > material: crystal, wood, flesh, gold > etc. > > And a pattern like this: > > A @type@ made of @material@ @location@ inhabited by @inhabitants@ > @government@ @special@ > > When run, random words are pulled into the pattern: > > "A cavern made of crystal in space inhabited by ghosts ruled by a > hereditary monarch where learning is exalted." > "An island made of wood in the polar regions inhabited by apes ruled > by a ghost which is sacred." > etc. =C2=A0(example from O'Reilly's Mind Performance Hacks) > > So how does look for an elisp package: > > - User starts a new file and selects the mode > - The mode knows about a format to specify lists and patterns (perhaps > comments in the new buffer document it for reference) > - User edits the text file, editing lists and patterns > - When things are as the user likes, he hits a key to "evaluate" which > generates the morph pattern > > Questions: > > (1) Does that sound like the right emacsy approach? yes overall. > (2) I can hack through the lisp to get it to interpret and process the > buffer, but I am not sure how to structure the "hit a key and > evaluate". =C2=A0I may not have read far enough in the docs. it's pretty easy. How exactly to do depends on what kinda interface/ design you want. in anycase, you can have user press a key and the whole buffer's text will be considered as input. (with this choice, the disadvantage is that the buffer context must be pretty much syntactically correct, just like a language. Any extra coma, space, might break it. Or, you could write more elaborate code to parse but the effort quickly gets exponential in proportion on syntax leniency) > (3) One thing I'm not sure about is where to put the results. =C2=A0What = is > the preferred emacs approach: put the results in the buffer? =C2=A0The li= sp > interactive mode puts the results in the minibuffer. again, much of this depends on what YOU want first. You could have the output in a special buffer, which i suggest is easiest. typically, named like this: =E2=80=9C*word output*=E2=80=9D > If I get it going, I'll publish it for others. great. Your task seems pretty easy as elisp coding goes. I think anyone coded elisp for a couple of years can create it in half a day, based on my own experience. (i have some elisp tutorial on my site if you haven't seen already) Xah =E2=88=91 http://xahlee.org/ =E2=98=84