help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is there summary of template systems for emacs?


From: Peter Milliken
Subject: Re: is there summary of template systems for emacs?
Date: Tue, 16 Dec 2008 07:21:27 +1100

Well, I wasn't going to do this (project deadlines you know? Hope my project manager doesn't monitor this list !:-)) but I couldn't resist...

Just had a quick look at the YaSnippet video on YouTube and the documentation - without a detailed analysis I didn't see YaSnippet do anything that ELSE doesn't do. It certainly prompted me to think - "what is the history of YaSnippet? Did they look at ELSE before they put in this work?" :-)

The documentation doesn't look that extensive (again, I just browsed it, so I may well be doing it an injustice - or perhaps ELSE's documentation is too "verbose"? I do tend to write so a 14 year old could understand - and some people don't appreciate that! :-)). For example, "transformations" was an interesting section (personally not sure I would bother with it though :-)), but I was left wondering - "what are the list of available transformations?" i.e. capitalize was mentioned in the example - are there more? If so, where are they documented?

I didn't see any facility in YaSnippet for "cascading" templates at all i.e. ELSE allows "expansion" of templates that lead to lower (and more detailed) template structures. A crude example would be when you first invoke else-mode in a new (and empty) file, it will automatically insert the initial placeholder e.g.

{compilation_unit}

which, when expanded (C language template used as an example) to:

[module_level_comments]
[{include_files}...]
 
[{data_types_or_declarations}...]
 
[{function_definition}...]
 
[main_function]

Each item enclosed in {}'s or []'s are "placeholders" that can be easily navigated to and expanded or deleted as required. Most of the placeholders above lead to more detailed templates when expanded.

YaSnippet implements what are defined as "tokens" in ELSE - there is no equivalent to the ELSE "placeholder", so there is no auto-repeating feature in YaSnippet e.g. the ELSE (C language) template for the switch statement looks like this (this is my "customised" version - not from the release files):

switch ({_expression_})
{
    case {constant_expression}:
    [case {constant_expression}:]...
        [statement]...
        break;
    [case_part]...
    default :
        [statement]...
        break;
}

Note that the first "case" portion has an optional case placeholder below it - the ellipses (...) after the closing ']' indicate that if the user chooses to expand this then it will be "repeated" automatically by ELSE on either the next line or the same line (ELSE allows either or tries to determine from context) i.e. after an expansion of the second case placeholder, you have:

switch (type_of_fruit)
{
    case ORANGE:
    case APPLE:
    [case {constant_expression}:]...
        [statement]...
        break;
    [case_part]...
    default :
        [statement]...
        break;
}

When the user decides that a placeholder (text enclosed by either {}'s or []'s) is nolonger required/desired then the placeholder can be deleted with a single command/keystroke.

I presume that new "snippets" are easily defined - ELSE allows the user to modify a definition "on the fly" by allowing the extraction of the definition in the current buffer and then re-compilation for that session. If the change looks like being "permanent", then the changed definition can be saved in the users language customisation template file - which brings to mind something that YaSnippet doesn't do - cater for multiple users with common project coding standards. ELSE allows for loading two template files per major mode - firstly a <lang>.lse file (which would come from a common project directory) and then a <lang>-cust.lse file which could come from the users local directory - the user places their own pet template definitions in the later file (which don't violate the project coding standards! :-)). The later template file can "override"/replace any definitions from the primary template file.

Don't get me wrong though - I do like the look of YaSnippet. It has a very concise definition syntax by the look of it and it is more straightforward in allowing the definition of "mirrors" than ELSE (ELSE allows/implements "mirrors" but the mirror definition is usually removed one level from where it is used). It has a nice "look and feel" to it - it is not intrusive like skeleton et el.

So I believe that ELSE does "more" - whether your typical user would consider the "more" to be worth while or not, is entirely problematical! :-)

Pete


On Tue, Dec 16, 2008 at 5:48 AM, Peter Milliken <peter.milliken@gmail.com> wrote:
Hi Xah,

Well, I use gmail to manage all of the mailing lists I am on - makes it much easier to keep track of things as it keeps track of the threads and everything for me :-)

I might have a look YaSnippet and possibly make comments on the Emacs Wiki page as to how it compares - something which is sometimes not easy because many packages have strengths and weakness, so drawing comparisons is not always straight forward! :-)

I have done some experimentation with generating "autocompletion" with ELSE templates in the past (autocompletion in the sense of the user trying to complete a function call) - this was done with Python. From memory it went quite well, but I never polished it off and took it to completion - probably because of the general lack of desire in people to have autocompletion or template systems in general i.e. why put in work when nobody will use it? :-)

Anyway, all the best with your efforts, I see a lot of emails from you on the mailing list, so you are obviously putting a lot of effort into using Emacs and trying to make it better! So thanks for that :-)

Pete


On Mon, Dec 15, 2008 at 8:37 AM, Xah Lee <xahlee@gmail.com> wrote:
2008-12-14

On Dec 7, 11:14 am, "Peter Milliken" <peter.milli...@gmail.com> wrote:
> Hi Xah,
>
> I'd be interested in your opinion of ELSE. I haven't tried some of the
> others that you mention - ELSE suits me fine. I have tried tempo and
> skeleton etc but were turned off by the "intrusive" and horribly awkward
> interfaces that they presented to the user. I had been exposed to DEC's LSE
> in the past (circa 1985), and found that it didn't "get in my face" or cause
> awkward usage problems, so I decided to "port" their language sensitive
> editor functionality to Emacs (hence E(macs)LSE :-)).
>
> But facilities such as ELSE, tempo, skeleton etc are obviously not very
> popular (which I have never been able to understand!) i.e. I have shown many
> fellow programmers ELSE over the years and not a single one of them has ever
> taken up it's use. In fact, through all the time ELSE has been available on
> the Internet, I have only ever received less than 10 queries/expressions of
> interest in it - which may argue that it just doesn't hit the mark! :-) But
> given the alternatives that were available (especially in the "early days")
> I don't think that was the case. Of course, these days, it is even less
> likely because Emacs just isn't that popular as an editor i.e. there are
> probably 30 - 40 programmers at my current place of employ and there is only
> one other programmer here that uses Emacs - so the opportunities for
> creating "converts" are not good at all!
>
> ELSE does not use (e)lisp like syntax. It has it's own template file for
> generating new templates. It has (what I believe is) extensive documentation
> - something that has always annoyed me about many Emacs packages (such as
> tempo and skeleton) - when they were first available it was very much "read
> the code and examples" - I believe that has changed for skeleton but I had
> long since lost interest by the time somebody rectified that!
>
> So I would echo Drew's call - by all means do a comparison and share the
> results if you can with us all.
>
> Peter
>
> On Wed, Dec 3, 2008 at 11:34 AM, Drew Adams <drew.ad...@oracle.com> wrote:
> > > there seems to be a lot elisp packages for defining templates. Has
> > > anyone studied them and can give a comparison? Basically, i just need
> > > a brief explanation of their syntax and feature.
>
> > > the emacswiki page
> > >http://www.emacswiki.org/emacs/CategoryTemplates
> > > is very helpful in listing them but a clear summary and comparison is
> > > lacking. here's what i found so far....
>
> > Good idea. Please update the wiki with a summary of the info you found and
> > whatever else comes out of this thread that might be helpful. The next
> > person
> > who looks where you did will then find that missing help. ;-)

Hi Peter,

Sorry i missed your post. (i use google groups and sometimes i miss
posts. (regular newsgroup client won't help much in this regard))

Anyway, i've followed Drew's advice and cleaned up the emacswiki a bit
based on what i've studied.

http://www.emacswiki.org/emacs/CategoryTemplates

though, i haven't looked into ELSE. Right now i pretty much settled on
yasnippet.

I really feel sorry emacs's user base is dying. The most important
thing i think is to get emacs to use modern terminologies and be
compatible with the minimum of standard modern UI. On the Mac, emacs
modernization is a huge success with Aquamacs Emacs, which is emacs
with pretty much complete Mac OS X UI. On Windows, there's EmacsW32 by
Lennart Borgman, but i think it primarily just changes emacs the Alt
key to conform to Window's Alt=Menu behavior and the core philosophy
of EmacsW32 is a emacs add-on improvement, as opposed to a whole,
complete, "download and use it" software. If Lennart would change his
philosophy and marketing a bit, i think it'd complete revolutionize
emacs overnight, together with Aquamacs, solves the emacs
modernization problem like XEmacs did 18 years ago.

In this year since June, i've filed 40 bug reports to bug-gnu-emacs.
( http://groups.google.com/group/gnu.emacs.bug/search?q=xah&start=0&scoring=d&
)
About maybe 20 has been fixed. About maybe only 5 of my all reports
are suggestions. (these are really conservative ones, most of these
suggestions are suggested by other developers's encouragement for
sending it to bug-gnu-emacs, as opposed to my owe ideas of critical
modernization issues) Roughly, anything that's not bugs are either
receives no reply, or marked as not bug with a explanation (e.g. emacs
does it THIS way), or piled to "wish list".

 Xah
http://xahlee.org/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]