RE: [CEDET-devel] Re[1]: Inhibit Semantic on certain major-modes and/or files (was ECB question...
Brought to you by:
zappo
From: Berndl, K. <kla...@sd...> - 2004-05-10 09:51:32
|
A big and loud praise from me too! This solutions solves all these problems. Thanks David! Klaus Eric M. Ludlam wrote: > David, > > This is a grand solution for this aspect of the problem. Bravo! > > Please check it in. > Eric > >>>> David Ponce <dav...@wa...> 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 >>> yourself. >> >> 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.). >> >> David >> >> (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 >> 'semantic-inhibit-functions))) >> ;; Force this buffer to have its cache refreshed. >> (semantic-clear-toplevel-cache) >> ;; Here are some buffer local variables we can initialize >> ourselves ;; of a mode does not choose to do so. >> (semantic-lex-init) >> ;; Setup for a needed reparse. >> (semantic-parse-tree-set-needs-rebuild) >> ;; 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. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > _______________________________________________ > Cedet-devel mailing list > Ced...@li... > https://lists.sourceforge.net/lists/listinfo/cedet-devel |