Hello,
[...]
>>The reason I'm going to this trouble is simply that I've found a bug and
>>I wanted to test with the latest code before reporting it. Well, now's
>>my chance to report it:
>>
>>
>>With cedet-1.0pre2 I encountered a bug when using Sticky Func mode in
>>some Java files.
>>
>>1. Select "Sticky Func / In This Buffer". This works fine.
>>
>>2. Select "Sticky Func / Globally". This works fine
>>
>>3. Select "Sticky Func / Globally" again to toggle the mode off.
>>Nothing happens, though. The header line is still there.
>>
>>In fact, after (3), it seems impossible to turn off sticky func mode via
>>the menu or with M-x semantic-stickyfunc-mode.
>>
>
> [ ... ]
>
> Hmmm, I see that using "Globally" turns it off ok, but once global is
> on, turning it off locally does not. Seems to require some
> investigation.
Could you please try the following patch. It gives good result for
me. If it solves the problem I will commit it. It is a shame that
Emacs doesn't provide a standard way to safely share the header
line. For now this kind of hack should work provided the header line
is setup/restored in a LIFO way.
Thanks.
David
2005-06-06 David Ponce <david@...>
* cedet/semantic/semantic-util-modes.el
(semantic-stickyfunc-old-hlf): Don't make it automatically buffer
local.
(semantic-stickyfunc-mode-setup): Fix save/restore of previous
header line.
Index: semantic-util-modes.el
===================================================================
RCS file: /cvsroot/cedet/cedet/semantic/semantic-util-modes.el,v
retrieving revision 1.54
diff -c -r1.54 semantic-util-modes.el
*** semantic-util-modes.el 23 Apr 2005 12:50:47 -0000 1.54
--- semantic-util-modes.el 6 Jun 2005 09:00:41 -0000
***************
*** 859,865 ****
(defvar semantic-stickyfunc-old-hlf nil
"Value of the header line when entering sticky func mode.")
- (make-variable-buffer-local 'semantic-stickyfunc-old-hlf)
(defconst semantic-stickyfunc-header-line-format
'(:eval (list semantic-stickyfunc-indent-string
--- 859,864 ----
***************
*** 883,891 ****
(error "Sticky Function mode requires Emacs 21"))
;; Enable the mode
;; Save previous buffer local value of header line format.
- (kill-local-variable 'semantic-stickyfunc-old-hlf)
(when (local-variable-p 'header-line-format (current-buffer))
! (setq semantic-stickyfunc-old-hlf header-line-format))
(setq header-line-format semantic-stickyfunc-header-line-format)
)
;; Disable sticky func mode
--- 882,890 ----
(error "Sticky Function mode requires Emacs 21"))
;; Enable the mode
;; Save previous buffer local value of header line format.
(when (local-variable-p 'header-line-format (current-buffer))
! (set (make-local-variable 'semantic-stickyfunc-old-hlf)
! header-line-format))
(setq header-line-format semantic-stickyfunc-header-line-format)
)
;; Disable sticky func mode
***************
*** 894,900 ****
(when (eq header-line-format semantic-stickyfunc-header-line-format)
(kill-local-variable 'header-line-format)
(when (local-variable-p 'semantic-stickyfunc-old-hlf (current-buffer))
! (setq header-line-format semantic-stickyfunc-old-hlf))))
semantic-stickyfunc-mode)
;;;###autoload
--- 893,900 ----
(when (eq header-line-format semantic-stickyfunc-header-line-format)
(kill-local-variable 'header-line-format)
(when (local-variable-p 'semantic-stickyfunc-old-hlf (current-buffer))
! (setq header-line-format semantic-stickyfunc-old-hlf)
! (kill-local-variable 'semantic-stickyfunc-old-hlf))))
semantic-stickyfunc-mode)
;;;###autoload
|