* Stange code in semantic/db-el.el
@ 2015-02-12 14:49 Stefan Monnier
2015-02-13 2:04 ` Eric Ludlam
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2015-02-12 14:49 UTC (permalink / raw)
To: Eric M. Ludlam; +Cc: emacs-devel
In semanticdb-elisp-sym->tag (cedet/semantic/db-el.el) I see the code below:
[ This is the code in the emacs-24 branch. ]
((and (eq toktype 'type) (class-p sym))
(semantic-tag-new-type
(symbol-name sym)
"class"
(semantic-elisp-desymbolify
(eieio--class-public-a (class-v semanticdb-project-database))) ;; slots
(semantic-elisp-desymbolify (eieio-class-parents sym)) ;; parents
))
I'm not exactly sure what this code is supposed to do, but I have the
impression that `semanticdb-project-database' above makes no sense:
I would expect to see `sym' there instead.
Is my intuition correct, or else what is this
`semanticdb-project-database' doing there?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Stange code in semantic/db-el.el
2015-02-12 14:49 Stange code in semantic/db-el.el Stefan Monnier
@ 2015-02-13 2:04 ` Eric Ludlam
2015-02-16 7:41 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Eric Ludlam @ 2015-02-13 2:04 UTC (permalink / raw)
To: Stefan Monnier, Eric M. Ludlam; +Cc: emacs-devel
On 02/12/2015 09:49 AM, Stefan Monnier wrote:
> In semanticdb-elisp-sym->tag (cedet/semantic/db-el.el) I see the code below:
> [ This is the code in the emacs-24 branch. ]
>
> ((and (eq toktype 'type) (class-p sym))
> (semantic-tag-new-type
> (symbol-name sym)
> "class"
> (semantic-elisp-desymbolify
> (eieio--class-public-a (class-v semanticdb-project-database))) ;; slots
> (semantic-elisp-desymbolify (eieio-class-parents sym)) ;; parents
> ))
>
> I'm not exactly sure what this code is supposed to do, but I have the
> impression that `semanticdb-project-database' above makes no sense:
> I would expect to see `sym' there instead.
>
> Is my intuition correct, or else what is this
> `semanticdb-project-database' doing there?
>
Wow, it is surprising this never came up as a bug.
The entire file (db-el.el) is a custom semantic database back end for
Emacs Lisp. Typically tags parsed by the parser are stashed in a
database saved to disk. You can create databases that specialize in
extracting symbol information from other sources. ie - you can pull
java symbols from a jar file using a javap command. In this case, the
Emacs Lisp database extracts symbols directly from Emacs for performing
searches.
This specific chunk of code is getting the slots from an eieio class so
it can fabricate a tag to return. The emacs lisp semantic database
search methods uses this technique as a way to return the search results.
I agree with your assessment and I was able to validate incorrect
behavior, and that putting in sym as you suggest is correct.
If you use semantic and have EDE loaded, you can do this in an Emacs
Lisp buffer:
M-: (semanticdb-find-tags-by-name "ede-project-autoload") RET
and see the semanticdb project database's members in the results, and
when you put in 'sym' instead, the correct list of 12 entries should be
in the results. This is easier to check if you use the
`data-debug-eval-expression'. ielm doesn't work since the right
overloads aren't active.
If you have multiple hits, then you need to pick the one that lines up
with the emacs lisp semantic database, not the hit from the file.
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-16 7:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 14:49 Stange code in semantic/db-el.el Stefan Monnier
2015-02-13 2:04 ` Eric Ludlam
2015-02-16 7:41 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.