You are absolutely correct.
After I sent out my email, I had a feeling that I should
have done something more to figure this out on my own.
This hook should definitely be added to the manual.
>>>>> "KB" == Klaus Berndl <klaus.berndl@...> writes:
KB> On Sun, 23 Feb 2003, ryk@... wrote:
>> Hi all,
>> I use pcl-cvs (aka pcvs in emacs 21) daily. I use the cvs-mode-idiff
>> differencing command dozens if not hundreds of times each day.
>> Hence the extra 3 or 4 second delay that semantic causes while it
>> parses files cvs-mode-idiff loads for differencing purpose was too
>> much for me especially since these files are used only for
>> differencing and nothing else.
>> So I wrote the code below to conditionally suppress semantic on
>> temporary files. I tracked semantic-activate-mode-bindings down by
>> starting with semantic-post-change-major-mode-function which was in
>> find-file-hook list.
>> What do you think? Is there a better way? Should something like this
>> be a part of semantic?
KB> IMHO there is a better way, means an already builtin way ;-)
KB> Take a look at `semantic-before-toplevel-bovination-hook'.
KB> If i understand your problem and your solution right then the following should
KB> be enough:
KB> | (add-hook 'semantic-before-toplevel-bovination-hook
KB> | (lambda ()
KB> | (not (string-match "\\.\\(HEAD$\\|BASE\\)$" (buffer-name)))))
KB> Any hook-function returning nil prevents semantic from parsing.
KB> At least this should do what your solution does...
>> (defadvice semantic-activate-mode-bindings
>> (around suppress-tmp-files activate compile)
>> "Don't setup semantic for tmp files such as files CVS loads for the
>> purpose of differencing."
>> ;; Bypass files loaded by CVS for differencing.
>> ;; This doesn't work on files retrieved with explicit version numbers.
>> ((string-match "\\.\\(HEAD$\\|BASE\\)$" (buffer-name))
>> ;; Hmm. I thought the line below would not be needed at first,
>> ;; because bypassing the body of semantic-activate-mode-bindings
>> ;; would not setup semantic variables. But this advice does not
>> ;; work without the line below. -ryk2/23/03.
>> (setq semantic-toplevel-bovine-table nil))
>> (t ad-do-it)))
>> This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
>> The most comprehensive and flexible code editor you can use.
>> Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
KB> Klaus Berndl mailto: klaus.berndl@...
KB> sd&m AG http://www.sdm.de
KB> software design & management
KB> Thomas-Dehler-Str. 27, 81737 München, Germany
KB> Tel +49 89 63812-392, Fax -220
KB> This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
KB> The most comprehensive and flexible code editor you can use.
KB> Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
KB> Cedet-devel mailing list