unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Modern Conventions for Emacs Lisp files?
Date: Sun, 14 Apr 2013 01:41:21 +0200	[thread overview]
Message-ID: <87li8m3sny.fsf@gmail.com> (raw)
In-Reply-To: jwvli8svhpa.fsf-monnier+emacs@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The modern conventions would just be that headlines are outcommented
>> Org-mode headlines with whatever comment syntax the major-mode at hand
>> uses.
>
> But that is incompatible with the current convention to use ";;;+" where
> the number of semi-colons indicates depth.  So it would require massive
> rewrites of pretty much all files.
> A non-starter.
>
>> That are of course different conventions, and I did not want to push any
>> big problematic moves or so. But with all the momentum and popularity
>> Org-mode enjoys, maybe such an 'Org-mode' style structuring of source
>> code files could become an accepted second choice (and if only in
>> libraries that are not part of Emacs).
>
> Couldn't "Org-mode" be made to work with the current convention?
> That would be a lot more useful since it would "just work" on all the
> existing files.

I modified 'outshine.el', 'outorg.el' and 'navi-mode.el' so that they
now deal with the special case of "oldschool" elisp headers (";;;+").

Using this library-trio the way described in their comment-sections or
in this article

,-----------------------------------------------------------
| http://orgmode.org/worg/org-tutorials/org-outside-org.html
`-----------------------------------------------------------

gives any Emacs Lisp buffer with (modern or oldschool) headlines the
looks of an Org-mode buffer and easy keybindings for outline
functionality. Each subtree or the whole buffer can be edited in
temporary Org-mode buffers, and a permanent 'remote-control' *Navi*
buffer can be opened.

I uploaded a short (4 min) demo-video on youtube using 'org-elements.el'
as example file:

,-------------------------------------------
| http://www.youtube.com/watch?v=I0hxTAAlGZQ
`-------------------------------------------

I tried this on several arbitrary .el files from Emacs itself and from
Org-mode, and it worked. Testing several files revealed that many Elisp
libraries did not make much use of outline structuring, or used it in an
inconsistent way. Well structured files I found were e.g. 'ox.el' and
'org-elements.el' from Org-mode, but it seems as if there is room for
improvement in this area.

And while its useless to talk about the esthetics of 'org-style' headers
vs. 'oldschool' headers, my impression is that there is a clear
usability problem with the old conventions. 

This is still easy to spot, while a bit strange (3 times ; signal the
1st level):

,--------------
| ;;; 1st level
`--------------

but this one? Would you recognize the level at first sight?

,-----------------
| ;;;;;; header
`-----------------

(its 4th level)

Are these two at the same or at different levels?

,------------------
| ;;;;;;; header1
| text text text
| text text text
| text text text
| ;;;;;;;; header2
`------------------

Compare the conventional headers to Org-mode style headers:

,--------------
| ;; * 1st level
`--------------

,-----------------
| ;; **** header
`-----------------

,---------------
| ;; ***** header1
| text text text
| text text text
| text text text
| ;; ****** header2
`---------------

But anyway, if this cannot be changed with reasonable effort, its
fruitless to discuss it, and now the new libraries discussed in this
thread can be used for both kinds of header styles.

PS
There is one strange problem I have:

I can not open org.el any more, now that the oldschool elisp headers are
recognized by 'outshine' too. Its a big file, but size can't be the
problem since other quite big files open within 1 or 2 seconds or so.
When I try to open org.el, Emacs apparently goes into an infinite loop
and uses 100pc CPU - I have to kill the Emacs process and restart Emacs
to recover from that.

What might be different in org.el than in all the other elisp files I
tested so far to cause this problem?

-- 
cheers,
Thorsten




  parent reply	other threads:[~2013-04-13 23:41 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08  0:23 Modern Conventions for Emacs Lisp files? Thorsten Jolitz
2013-04-08  9:32 ` Alan Mackenzie
2013-04-08 20:05   ` Thorsten Jolitz
2013-04-08 13:22 ` Stefan Monnier
2013-04-08 13:54   ` Andreas Röhler
2013-04-08 19:51     ` Thorsten Jolitz
2013-04-09  6:05       ` Andreas Röhler
2013-04-08 19:47   ` Thorsten Jolitz
2013-04-08 20:07     ` Stefan Monnier
2013-04-08 20:37       ` Thorsten Jolitz
2013-04-08 21:26         ` Stefan Monnier
2013-04-08 22:21           ` Thorsten Jolitz
2013-04-09  7:29           ` Bastien
2013-04-09 12:27             ` Stefan Monnier
2013-04-09 13:11               ` Bastien
2013-04-09 13:36                 ` Andreas Röhler
2013-04-09 13:41                   ` Bastien
2013-04-13 23:41           ` Thorsten Jolitz [this message]
2013-04-14  0:24             ` Stefan Monnier
2013-04-14  3:06             ` Stefan Monnier
2013-04-14  8:16               ` Thorsten Jolitz
2013-04-15  8:37             ` Thorsten Jolitz
2013-04-15  9:04               ` Eli Zaretskii
2013-04-15 11:16                 ` Thorsten Jolitz
2013-04-15 13:13                   ` Stefan Monnier
2013-04-15  9:09               ` Bastien
2013-04-08 20:55       ` Naming internal functions (was: Modern Conventions for Emacs Lisp files?) Christopher Schmidt
2013-04-08 21:28         ` Naming internal functions Stefan Monnier
2013-04-15 13:46           ` Christopher Schmidt
2013-04-15 14:07             ` Eli Zaretskii
2013-04-15 14:14               ` Christopher Schmidt
2013-04-15 14:25                 ` Eli Zaretskii
2013-04-15 17:08                   ` Christopher Schmidt
2013-04-15 14:16               ` xfq
2013-04-08 22:41   ` Modern Conventions for Emacs Lisp files? Pascal J. Bourguignon
2013-04-08 23:42     ` Thorsten Jolitz
2013-04-09  2:11     ` Stefan Monnier
2013-04-09  8:04       ` Thorsten Jolitz
2013-04-09 12:23         ` Stefan Monnier
2013-04-10 19:06       ` Pascal J. Bourguignon
2013-04-10 20:04         ` Thorsten Jolitz
2013-04-09  9:18 ` Leo Liu
  -- strict thread matches above, loose matches on Subject: below --
2013-04-09 14:00 Barry OReilly
2013-04-09 14:39 ` Nicolas Richard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87li8m3sny.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).