Re: [cedet-semantic] Cursor automatically jumps when switching between buffers
Brought to you by:
zappo
From: Eric M. L. <eri...@gm...> - 2011-07-22 00:38:41
|
[...] snip >>> On 07/05/2011 12:19 AM, Liu Binsheng wrote: >>>> Hi, >>>> >>>> When I use semantic-complete-jump-local to jump in a buffer, and then >>>> switch to another buffer, the cursor in the new buffer automatically >>>> locate in some tag I previously jumped to. >>>> >>>> For example, I use semantic-complete-jump-local to jump to function a >>>> in file a.el, and move the cursor to another line in the same file. >>>> >>>> Then I switch to file b.el and use semantic-complete-jump-local to >>>> jump to function b in file b.el. >>>> >>>> Now if I switch back to file a.el, the cursor automatically locate in >>>> function a instead of the correct line. >>>> >>>> This behavior makes me sometimes confused because I have to relocate >>>> the cursor. Is it intended or configurable? >>>> Hi Again, Richard Kim posted about a different problem also related to push-mark. That made me re-examine what was going on in there, when I discovered that the act of getting the mode of a tag, causes the point to move in those non-current buffers. As such, the below patch for modern Emacsen fixed the bouncing cursor problem. I don't know when save-current-buffer was introduced to know if it should be permanent. 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. It will probably be better to just remove all that extra stuff, and get a hack matching against auto-mode-alist instead. That will fix Richards case, and this case at the same time. Of course, the whole point of checking the mode was to compress out duplicates, and not duplicates if those tags belonged to totally different languages. I don't recall why such strict tag duplicate removal was needed. Perhaps that whole feature can be eliminated? What to others who use the bookmark mode think of that? Eric === 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. |