emacs-devel
[Top][All Lists]
Advanced

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

Re: Improving Emacs for writing code


From: Stefan Monnier
Subject: Re: Improving Emacs for writing code
Date: Wed, 23 Apr 2008 13:45:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> The first step is to make sure that when installing CEDET in Emacs we
>> get 2 things:
>> 1 - CEDET is easy to enable.
>> 2 - CEDET doesn't affect anyone who doesn't enable it.
>> That is a strict necessity before we can install it.  The second step is:
>> - Make it possible to disable CEDET after enabling it.
>> - Make it possible to enable CEDET in some buffers without it affecting
>> all others.
>> These are very important as well, tho it might be OK to live without
>> them at first, as long as there's a clear commitment to address them.

> Everything in CEDET that changes or augments a behavior is activated
> by hooks, or something in a user's .emacs file.  The CEDET build
> system automatically adds (add-hook ...) type items into the loaddefs
> file which is what you had encountered.  The goal of the CEDET install
> is to minimize the amount of hacking around users have to do to get
> the system up and running.

> The semantic parser and tools work like this:

> * A mode hook sets up variables about how to do parsing.

IIUC this is code similar to what sets up font-lock-defaults or
imenu-generic-expression, right?  I.e. it is conceptually part of the
major mode rather than of CEDET.

> * A change-mode hook (and a couple other hooks) enables "semantic" on
>   any buffer with the right variables set up.

I.e. this is like

  (define-globalized-minor-mode global-semantic-mode semantic-mode
     (lambda () (if vars are set up (semantic-mode 1))))

?

> * Any tool that requires semantic can automatically enable itself via
>   the semantic init hook

I do not understand this: do you mean that a tool can call
(semantic-mode 1), or that a tool can register itself so that whenever
semantic-mode is ON, then that tool is activated as well?
I'll assume you mean the latter.

> As such, what you are requesting is possible, and follows typical
> conventions, but just requires more INSTALL explanation.  I am
> hesitant to add such discussion because the current install
> instruction is short and simple, and discussing all those options
> would make it much less so.  I've batched many modes together into
> "turn on lots of related things" functions which means all sub modes
> would need explaining for basic install.

So IIUC semantic-mode does not in itself affect the behavior, but
because of how features on top of Semantic register themselves in
semantic-init-hook, the mere fact of activating semantic-mode ends up
activating a lot more.

I guess that's fine for now.  All we really need is a way to only enable
semantic (and accompagnying features) in some modes.  E.g. the user can do

  (global-semantic-mode 1)

to get CEDET everywhere, or just:

  (add-hook 'java-mode-hook (lambda () (semantic-mode 1)))

to only get it in in Java mode.  Would that be difficult?  It seems like
you're saying it wouldn't.

> I'm open to any changes in this area to make this easier, as long as
> there continues to be a simple "just make it go" feature.

Sounds good to me,


        Stefan




reply via email to

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