Re: [cedet-semantic] Cursor automatically jumps when switching between buffers
Brought to you by:
zappo
From: <em...@gm...> - 2011-07-25 02:15:30
|
"Eric M. Ludlam" <eri...@gm...> writes: [...] snip > For Richard's problem (Possible bug in semantic-tag-buffer), I see a > bigger bugaboo which was that the mode fetching was written when I was > attempting to get multi-mode semantic working, so it is moving to a > tag location, and asking what the mode is RiGHT THERE, which is a > waste of time in current CEDET which doesn't support multi-mode. The only "multiple major mode" implementation that I am aware of is mmm-mode <https://sourceforge.net/projects/mmm-mode/> which I have used for several years. Are there other multiple major mode implementations perhaps even built into emacs? To support multiple major modes I would think that semantic would need to be able to detect the proper major mode at each point and generate tags appropriate for that major mode. Does semantic currently have code to do such things? > === modified file 'semantic/semantic-tag.el' > *** semantic/semantic-tag.el 2011-02-28 03:23:22 +0000 > --- semantic/semantic-tag.el 2011-07-22 00:20:40 +0000 > *************** > *** 211,224 **** > (let ((buffer (semantic-tag-buffer tag)) > (start (semantic-tag-start tag)) > (end (semantic-tag-end tag))) > ! (save-excursion > (and buffer (set-buffer buffer)) > ! ;; Unless point is inside TAG bounds, move it to the > ! ;; beginning of TAG. > ! (or (and (>= (point) start) (< (point) end)) > ! (goto-char start)) > ! (require 'semantic-ctxt) > ! (semantic-ctxt-current-mode))))) > > (defsubst semantic--tag-attributes-cdr (tag) > "Return the cons cell whose car is the ATTRIBUTES part of TAG. > --- 211,225 ---- > (let ((buffer (semantic-tag-buffer tag)) > (start (semantic-tag-start tag)) > (end (semantic-tag-end tag))) > ! (save-current-buffer > (and buffer (set-buffer buffer)) > ! (save-excursion > ! ;; Unless point is inside TAG bounds, move it to the > ! ;; beginning of TAG. > ! (or (and (>= (point) start) (< (point) end)) > ! (goto-char start)) > ! (require 'semantic-ctxt) > ! (semantic-ctxt-current-mode)))))) > > (defsubst semantic--tag-attributes-cdr (tag) > "Return the cons cell whose car is the ATTRIBUTES part of TAG. How about changing (and buffer (set-buffer buffer)) to (and buffer (buffer-live-p buffer) (set-buffer buffer)) to make sure that the buffer is still valid? I don't have any empirical evidence that this is needed, but I know that passing a killed buffer to set-buffer results in an error, and I'm not sure that that will not happen. Perhaps I'm being overly concerned. |