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: Marcin Borkowski
Subject: Re: Seeking advice on writing a "line-based" major mode
Date: Mon, 08 Jun 2015 00:48:06 +0200

On 2015-06-08, at 00:23, Emanuel Berg <embe8573@student.uu.se> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> This raises two problems.
>>
>> 1. I want to be able to display these objects using
>> some kind of a "template" (not unlike org's
>> "property table", or dired's format etc.). I'd like
>> this "template" to be configurable using a user
>> option (with possibilities like "x characters for
>> a name, then y characters for description, etc.
>> for other fields").
>>
>> 2. When the point is one one of these lines, I want
>> various keybindings to perform some actions on the
>> object in question (like, again, in Dired or
>> org-agenda).
>
> Use the source, Luke!

Yeah, sure.  That's a good idea in general, but it has one drawback:
there's only 24 hours per day.

> If it is like Dired and org-agenda (?) then check out
> that source.

I might be tempted to look at Dired.  I'm scared of org-agenda source
code.

> It sounds like you can also benefit from checking out
> the sources of `package-menu-mode',
> `Buffer-menu-mode', and even the Gnus group and
> summary modes if you are brave.

Well, maybe I am brave, but I'm not mad.  Nor do I want to become
mad. ;-P

> Dig in!
>
>> Of course I could code all that myself - it doesn't
>> seem to be too much work - but why reinvent
>> the wheel?
>
> Answer: because it is enjoyable, interesting, and
> creative as you don't focus on understanding what
> someone else did but instead on what you can do and
> what you can learn how to do, thus getting exactly
> what you want and nothing else - and besides, this
> time a"round" you might stumble on something that will
> revolutionize the entire pitch-black wheel industry!

Again: in general, yes.  OTOH, there are so many other enjoyable,
interesting, and creative activities out there, even if you use
ready-made solutions to /some/ of your problems...  And writing rather
simple and boring Elisp code is not really very high on my list.  (Not
that writing Elisp is simple or boring in general: just that coding this
particular thing seems to me a lot like reimplementing well-known
things, and reimplementing a "format"-like function, for instance, seems
to be not very enjoyable/interesting/creative...)

But I agree with your previous point, studying someone else's code is
a good thing to do.  That is precisely why I assigned a fixed amount of
my time every day to studying code written by others.  I studied most of
ox-latex.el, some portion of AUCTeX source, some parts of simple.el...
Now I'm in the midst of digging through some C.  And I have to admit
that I learn a lot from this experience: both what to do and what not to
do...

Still, I hope that there /might/ be a general enough solution to my
problem so that I don't have to do it from scratch.

Thanks anyway

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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