Hi,
Thanks for explanation - now i understand the mechanism - and i have found a bug in
The override function of semantic-documentation-for-tag for emacs-lisp-mode (s.b.)
The usage of (semantic-tag-start...) is not save because when called for a just local
variable in elisp code (e.g. via semantic-ia-show-doc) then this override-function
will be called with a position-less tag for that local-variable and it fails with
a (wrong-type-argument arrayp nil)!
The code should check if the tag has a position ....
But IMHO the root-problem is in the overloadable function (s.a.b.)
semantic-documentation-for-tag because there is a check if tag has position - but if not
then things go on nevertheless.. IMHO the '(when..' should enclose the :override-block
too because for a positionless tag it would be quite impossible to get a documentation....
Or maybe i have something misunderstood? Anyway, the current code fails and should be fixed... ;-)
Thoughts?
Klaus
(define-mode-local-override semantic-documentation-for-tag
emacs-lisp-mode (tag &optional nosnarf)
"Return the documentation string for TAG.
Optional argument NOSNARF is ignored."
(let ((d (semantic-tag-docstring tag)))
(when (not d)
(cond ((semantic-tag-buffer tag)
;; Doc isn't in the tag itself. Lets pull it out of the
;; sources.
(let ((semantic-elisp-store-documentation-in-tag t))
(setq tag (with-current-buffer (semantic-tag-buffer tag)
(goto-char (semantic-tag-start tag))
(semantic-elisp-use-read
;; concoct a lexical token.
(cons (semantic-tag-start tag)
(semantic-tag-end tag))))
d (semantic-tag-docstring tag))))
;; The tag may be the result of a system search.
((intern-soft (semantic-tag-name tag))
(let ((sym (intern-soft (semantic-tag-name tag))))
;; Query into the global table o stuff.
(cond ((eq (semantic-tag-class tag) 'function)
(setq d (documentation sym)))
(t
(setq d (documentation-property
sym 'variable-documentation)))))
;; Label it as system doc.. perhaps just for debugging
;; purposes.
(if d (setq d (concat "Sytem Doc: \n" d)))
))
)
(when d
(concat
(substitute-command-keys
(if (and (> (length d) 0) (= (aref d 0) ?*))
(substring d 1)
d))
(semantic-emacs-lisp-overridable-doc tag)
(semantic-emacs-lisp-obsoleted-doc tag)))))
(define-overloadable-function semantic-documentation-for-tag (&optional tag nosnarf)
"Find documentation from TAG and return it as a clean string.
TAG might have DOCUMENTATION set in it already. If not, there may be
some documentation in a comment preceding TAG's definition which we
can look for. When appropriate, this can be overridden by a language specific
enhancement.
Optional argument NOSNARF means to only return the lexical analyzer token for it.
If nosnarf if 'lex, then only return the lex token."
(if (not tag) (setq tag (semantic-current-tag)))
(save-excursion
(when (semantic-tag-with-position-p tag)
(set-buffer (semantic-tag-buffer tag)))
(:override
;; No override. Try something simple to find documentation nearby
(save-excursion
(semantic-go-to-tag tag)
(let ((doctmp (semantic-tag-docstring tag (current-buffer))))
(or
;; Is there doc in the tag???
doctmp
;; Check just before the definition.
(when (semantic-tag-with-position-p tag)
(semantic-documentation-comment-preceeding-tag tag nosnarf))
;; Lets look for comments either after the definition, but before code:
;; Not sure yet. Fill in something clever later....
nil))))))
-----Ursprüngliche Nachricht-----
Von: Eric M. Ludlam [mailto:eric@...]
Gesendet: Mittwoch, 27. Mai 2009 13:17
An: Berndl, Klaus
Cc: cedet-devel@...
Betreff: Re: [CEDET-devel] semantic-tag-docstring....
Hi Klaus,
It is possible to get the documentation for a tag regardless of variable you list below. The implementation is in semantic-documentation-for-tag. I'll add a reference in the doc from the function you found to this higher level function.
Also, see semantic-ia-show-doc for an example.
Eric
On Wed, 2009-05-27 at 12:27 +0200, klaus.berndl@... wrote:
> Now i have found it: `semantic-elisp-store-documentation-in-tag'...
> but it seems that this is a somehow hidden variable, it is not
> customizable....i didn't find it in the info-manuals...
> Should it be used or not?
>
>
> ______________________________________________________________________
> Von: Berndl, Klaus
> Gesendet: Mittwoch, 27. Mai 2009 11:42
> An: 'cedet-devel@...'
> Betreff: semantic-tag-docstring....
>
>
>
> Hi,
>
> why (semantic-tag-docstring (semantic-current-tag) (current-buffer))
> returns always nil if run in an elisp buffer when point stay onto a
> function which has definitely a docstring?
>
> Ciao,
> Klaus
>
> ____________________________________________________________
>
> Klaus Berndl / Capgemini sd&m / München Senior-Berater / Öffentlicher
> Sektor
> Tel: +49 89 63812-392 / Fax: +49 89 63812-444 /
> http://www.de.capgemini-sdm.com
> Mobil: +49 162 2842051 / klaus.berndl@... Capgemini sd&m
> AG, Carl-Wery-Straße 42, 81739 München
> ____________________________________________________________
>
> Vorstand: Edmund Küpper (Vorsitzender), Burkhard Kehrbusch, Rüdiger
> Azone, Dr. Uwe Dumslaff, Kai Grambow, Dr. Michael Rading, Josef Ranner
> Aufsichtsrat: Pierre Hessler (Vorsitzender) Sitz und Amtsgericht:
> München HRB 126057
>
> ----------------------------------------------------------------------
> -------- Register Now for Creativity and Technology (CaT), June 3rd,
> NYC. CaT is a gathering of tech-side developers & brand creativity
> professionals. Meet the minds behind Google Creative Lab, Visual
> Complexity, Processing, & iPhoneDevCamp as they present alongside
> digital heavyweights like Barbarian Group, R/GA, & Big Spaceship.
> http://p.sf.net/sfu/creativitycat-com
> _______________________________________________ Cedet-devel mailing
> list Cedet-devel@...
> https://lists.sourceforge.net/lists/listinfo/cedet-devel
|