[Top][All Lists]

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

Re: CEDET merge

From: Eric M. Ludlam
Subject: Re: CEDET merge
Date: Sun, 04 Oct 2009 10:53:16 -0400

On Sun, 2009-10-04 at 10:37 -0400, Chong Yidong wrote:
> "Eric M. Ludlam" <address@hidden> writes:
> > Of course, that change would force mode-local to start up, which would
> > then enable any other similarly configured mode.
> I'm not sure what this point is.  Loading Semantic already loads
> mode-local, because semantic-fw.el (or semantic/fw.el for Emacs CEDET)
> needs it.

The point was that once mode-local is active, it's active, and you can't
disable it.  As such, if additional semantic mode support were done via
mode-local, those modes would be enabled.  Your solution below, however,
solves that, so this isn't an issue.

> > How could semantic-mode add something to Emacs' running environment to
> > dynamically load in a language's support file?  Would that still be
> > via mode-hooks?
> I was thinking something like this:
> (defcustom semantic-new-buffer-setup-functions
>   '((js-mode . wisent-javascript-setup-parser)
>     (java-mode . wisent-java-default-setup)
>     ...))
> (defun semantic-new-buffer-fcn ()
>   (let ((entry (assq major-mode semantic-new-buffer-setup-functions)))
>     (when entry
>       (funcall (cdr entry))))
>    ... do the stuff we normally do)
> The point is to avoid running the setup-parser functions in the mode
> hooks, because semantic-mode may not be enabled (and the solution used
> upstream, adding it to mode hooks via autoloads, is not acceptable
> either because there's then no convenient way to disable Semantic).

This seems like a fine solution to me, though there is no need to check
if Semantic were already active in a given mode.  ie - the function
semantic-new-buffer-fcn could be called multiple times, and do nothing
if it is called a second or third time.  That is a side effect of the
hooks used to make sure it gets run on a mode change.



reply via email to

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