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

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

Re: Seeking advice on writing a "line-based" major mode


From: Emanuel Berg
Subject: Re: Seeking advice on writing a "line-based" major mode
Date: Thu, 18 Jun 2015 17:57:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> Fair enough. I was mentioning Dired more to convey
> my needs than as a suggestion that I'd like to
> mimick its implementation - it is far more complex
> than what I need.

I think there are two schools how to do this.

The easiest way and the way I would do it is to just
write an iteration (or recursive) algorithm to
populate the window with data, which will also serve
as the UI.

Simply have a key (e.g., RET) execute an algorithm to
act on the data:

    (let ((data (thing-at-point ... )))
      (if ( ... data) (action data) ... ))

Last do polishing: font-lock keywords,
(speedified) cursor-movements, etc.

The more advanced way which is more schoolbookish and
ultimately more powerful (but it depends on the
purpose if such power is needed) is to have the UI
window-dressing separated from the logic - which you
instead put in text properties.

Then you can even have the UI format-stringed and have
the user curtain it in whatever way desired, but the
functionality will remain untouched.

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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