From: Berndl, Klaus <klaus.berndl@sd...> - 2004-05-10 09:51:32
A big and loud praise from me too! This solutions solves all these problems.
Eric M. Ludlam wrote:
> This is a grand solution for this aspect of the problem. Bravo!
> Please check it in.
>>>> David Ponce <david.ponce@...> seems to think that: Hi Eric,
>>>>> IMHO semantic should offer a mechanism to exclude major-modes
>>>>> and/or files
>>>> (e.g. on a regexp-basis) from being > setup for semantic-parsing -
>>>> even if there is a parser available. Eric, David, what do you say??
>>>> I agree. It would be quite useful.
>>> [ ... ]
>>> There are several per-buffer startup issues of a similar natures I
>>> would like to do near term. For this particular problem in the
>>> short term, you should probably just create your own derived mode
>>> with it's own hook so you can do that disabling work more easily
>> What do you think of the following? It is simple and permits to use
>> any kind of heuristics to inhibit Semantic (buffer name, major mode,
>> buffer size, etc.).
>> (defcustom semantic-inhibit-functions nil
>> "List of functions to call with no arguments before to setup
>> Semantic. If any of these functions returns non-nil, the current
>> buffer is not setup to use Semantic." :group 'semantic
>> :type 'hook)
>> (defun semantic-new-buffer-fcn ()
>> "Setup the current buffer to use Semantic.
>> If the major mode is ready for Semantic, and no
>> `semantic-inhibit-functions' disabled it, the current buffer is setup
>> to use Semantic, and `semantic-init-hook' is run."
>> ;; Do stuff if semantic was activated by a mode hook in this
>> buffer, ;; and not afterwards disabled.
>> (when (and semantic--parse-table
>> (not (run-hook-with-args-until-success
>> ;; Force this buffer to have its cache refreshed.
>> ;; Here are some buffer local variables we can initialize
>> ourselves ;; of a mode does not choose to do so.
>> ;; Setup for a needed reparse.
>> ;; Specify that this function has done it's work.
>> (setq semantic-new-buffer-fcn-was-run t)
>> ;; Call DB hooks before regular init hooks
>> (run-hooks 'semantic-init-db-hooks)
>> ;; Lastly, set up semantic modes
>> (run-hooks 'semantic-init-hooks)
>> ;;; Example that inhibits semantic in buffers whose name contains
>> "test" ;; (add-hook 'semantic-inhibit-functions
>> '(lambda ()
>> (or (string-match "test" (buffer-name)))))
> This SF.Net email is sponsored by Sleepycat Software
> Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
> deliver higher performing products faster, at low TCO.
> Cedet-devel mailing list