emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Org-style outline


From: David Maus
Subject: Re: [Orgmode] Org-style outline
Date: Fri, 12 Feb 2010 09:47:12 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.1.92 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hi Chao,

At Fri, 12 Feb 2010 00:38:42 -0500,
Chao Lu wrote:
>
> Dear all,
>
> I'm writing to see if there's anyway to use org-like outline in ALL
> kinds of files, like my emacs configuration file, whose suffix is
> .el. Could I tell Emacs
>
> ;;; headline 1
> ;; headline 2
>
> And it begin to have the ability to display my el file just as Org
> does?
>

I don't think so.

First, on Major Modes:

If you edit a particular sort of text (.el - elisp source code or .org
- orgmode text files) Emacs uses a so called /Major Mode/ that "tells"
Emacs about the common structure of these kind of files and contains
helpful functions to edit such a file. You may think of the Major
Modes as a collection of functions that define the /structure/ of a
particular kind of files (elisp source, c++ source etc.) and the
/meaning/ of the structures.

The assumption thereby is, that if you edit a file you are editing a
special kind or class of a text file -- and that all classes of
text files are distinct from each other. So an Orgmode file and an
elisp source file are both text files but of distinct classes -- that
is: of distinct structure with distinct meaning.

Quoting from the section on Major Modes in the Emacs manual[1]

,----
| Emacs provides many alternative major modes, each of which customizes
| Emacs for editing text of a particular sort. The major modes are
| mutually exclusive, and each buffer has one major mode at any time.
`----

Having Orgmode's outline functions in all classes of files may seem as
a good idea on the first glance but is nothing one could implement
/without limiting the functionality of Emacs itself/. Why? Because
enabling Orgmode's outline functions for all classes of texts is equal
to making Orgmode the superclass of all classes. And this in turn
means that every (!) subclass has to take structure and meaning of
Orgmode's outline into account, that is: MUST define functions that
handle outline functionality -- whether it is useful for this
particular subclass or not.

In contrast the power of Emacsen lies in having raw text files and
hence the /simplest/ form of text files as superclass providing only
functions for the "basic stuff" (e.g. character encoding). This gives
us the freedom to work on files as we like and need. The only thing a
developer of a new Major Mode has to deal with is the smallest
possible set of functions, necessary to deal with text files.

So even if it is technically possible to make Orgmode's outline
functions available in all other modes it would require either to take
in account all ways text files are or could be handled in past,
present and future (impossible) or to impose harsh limitations (read:
break) all existing modes because we would (re)define structure and
meaning for all these modes.

Second, Orgmode as superclass:

On the other hand in certain circumstances it would be extremely useful
to enable Orgmode's features for, say, programming or maintaining a
configuration file. And thanks to the aforementioned freedom Emacsen
give, it is possible to personally use Orgmode as kind of a superclass
for /your/ files.

There is this incredible piece of software called: Org-babel[2]:

,----
| Org-babel extends the very excellent Org-mode with the ability to
| execute source code within Org-mode documents. Org-mode is an Emacs
| major mode for doing almost anything with plain text. If you are not
| familiar with Org-mode please take a moment to read the Org-mode
| homepage before continuing.
`----

And the introduction[3] deals with your wish, maintaining source code
with the help of Orgmode, especially "embedding your Emacs
initialization into Org-mode files".[4]


Third:

> Besides, is there any active mailing list of common Emacs questions?

There is: address@hidden

HTH
 -- David

[1] http://www.gnu.org/software/emacs/manual/html_node/emacs/Major-Modes.html

[2] http://orgmode.org/worg/org-contrib/babel/index.php

[3] http://orgmode.org/worg/org-contrib/babel/intro.php

[4] Of course using Orgmode/Org-babel to facilitate your coding means
accepting the limitations Orgmode/Org-babel -- as this is a different
topic this is just a hint.

[5] http://www.gnu.org/software/emacs/#HelpMailing
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... address@hidden
Email..... address@hidden

Attachment: pgpzUV_tcM8oM.pgp
Description: PGP signature


reply via email to

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