From: Eric Ludlam <ericludlam@gmail.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>,
"Eric M. Ludlam" <zappo@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Stange code in semantic/db-el.el
Date: Thu, 12 Feb 2015 21:04:39 -0500 [thread overview]
Message-ID: <54DD5BB7.1040006@gmail.com> (raw)
In-Reply-To: <jwvbnkzjih1.fsf-monnier+emacs@gnu.org>
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
next prev parent reply other threads:[~2015-02-13 2:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 14:49 Stange code in semantic/db-el.el Stefan Monnier
2015-02-13 2:04 ` Eric Ludlam [this message]
2015-02-16 7:41 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DD5BB7.1040006@gmail.com \
--to=ericludlam@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
--cc=zappo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.