From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.devel Subject: Re: Modern Conventions for Emacs Lisp files? Date: Sun, 14 Apr 2013 01:41:21 +0200 Message-ID: <87li8m3sny.fsf@gmail.com> References: <87hajhswdh.fsf@gmail.com> <87y5csu7ml.fsf@gmail.com> <87hajgu5bp.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365896494 20204 80.91.229.3 (13 Apr 2013 23:41:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Apr 2013 23:41:34 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 14 01:41:38 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1URA4f-0004Lr-QH for ged-emacs-devel@m.gmane.org; Sun, 14 Apr 2013 01:41:38 +0200 Original-Received: from localhost ([::1]:54832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URA4f-0006ss-FK for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2013 19:41:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URA4c-0006sa-2C for emacs-devel@gnu.org; Sat, 13 Apr 2013 19:41:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URA4a-0006HZ-OT for emacs-devel@gnu.org; Sat, 13 Apr 2013 19:41:33 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:48436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URA4a-0006HU-Ht for emacs-devel@gnu.org; Sat, 13 Apr 2013 19:41:32 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1URA4Z-0004FH-7g for emacs-devel@gnu.org; Sun, 14 Apr 2013 01:41:31 +0200 Original-Received: from g231227008.adsl.alicedsl.de ([92.231.227.8]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 14 Apr 2013 01:41:31 +0200 Original-Received: from tjolitz by g231227008.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 14 Apr 2013 01:41:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 118 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231227008.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:bd9yGDQpFitOAqoXAyUvydDsqkU= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158890 Archived-At: Stefan Monnier 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