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 10:16:20 +0200	[thread overview]
Message-ID: <87fvytil2j.fsf@gmail.com> (raw)
In-Reply-To: jwvtxn9stj7.fsf-monnier+emacs@gnu.org

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

>> I modified 'outshine.el', 'outorg.el' and 'navi-mode.el' so that they
>> now deal with the special case of "oldschool" elisp headers (";;;+").
>
> I see that the lines that match "^(" aren't treated as "deepest
> headers", as they are in outline-minor-mode.
>
> Since the format of those headers is very different, it might not be
> easy to support them, of course.

Well, the project 'Org-mode outside Org-mode' started with the very
simple yet generic idea to give source-code files the look&feel of
Org-mode files, and (in theory) it should work with all kinds of
major-modes - headlines are just outcommented Org-mode headlines with
whatever comment-syntax the major-mode at hand uses. 

Now I added two hacks - one for Org-mode itself (to enable the use of
'navi-mode' with Org-mode), the other for the oldschool lisp headers.
But its still oriented at Org-mode - only the headlines are matched, not
"^(" or so. 

But with 'navi-mode' its easy to get an overview over the all
definitions (or maybe just the function or just the variable
definitions) in a buffer. These are the keyword searches I defined for
Emacs Lisp in 'navi-mode':

,-------------------------------------------
| [KEY] : [SEARCH]
| ================
|                         a : ALL
|                         f : FUN
|                         v : VAR
|                         x : OBJ
|                         b : DB
|                         F : defun
|                         V : defvar
|                         C : defconst
|                         G : defgroup
|                         U : defcustom
|                         A : defadvice
|                         M : defmarcro
|                         D : defface
|                         S : defstruct
|                         L : defclass
|                         K : global-set-key
|                         T : add-to-list
|                         Q : setq
|                         H : add-hook
|                         O : hook
|                         X : lambda
|                         R : require
`-------------------------------------------

but this is customizable, try

,---------------------------------------------
| M-x customize-variable RET navi-key-mappings
| M-x customize-variable RET navi-keywords
`---------------------------------------------

for examples and explanations

One special thing about 'navi-mode' is that all 'free' ASCII printing
characters are by default bound to 'navi-generic-command', thus after
substracting the reserved one-key bindings from navi-mode itself, the
user still has lots of keys left to define his/her own keyword-searches,
and these key definitions are done by language. Here is e.g. what I
defined for picolisp-mode:

,------------------------------------
| [KEY] : [SEARCH]
| ================
|                         a : ALL
|                         f : FUN
|                         v : VAR
|                         x : OBJ
|                         b : DB
|                         D : de
|                         F : def
|                         C : class
|                         M : dm
|                         R : rel
|                         V : var
|                         X : extend
|                         O : obj
|                         J : object
|                         N : new
|                         S : symbols
|                         L : pool
|                         T : tree
|                         U : clause
|                         G : goal
|                         B : be
|                         P : prove
`------------------------------------
 
>> 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,
>
> Indeed, which is why it's not worth the trouble introducing a new convention.

I'm of course a bit biased towards the Ord-mode style headers, but with
the direct comparison to the 'oldschool headers' possible now, I still
find them much better when it comes to signaling 'this is a headline'
and 'this headline has level X'. But if one of those days one of my
libraries would make it into Emacs, it wouldn't be a problem to convert
them back to the oldschool syntax.

-- 
cheers,
Thorsten




  reply	other threads:[~2013-04-14  8:16 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
2013-04-14  0:24             ` Stefan Monnier
2013-04-14  3:06             ` Stefan Monnier
2013-04-14  8:16               ` Thorsten Jolitz [this message]
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=87fvytil2j.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).