From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Ludlam Newsgroups: gmane.emacs.devel Subject: Re: Stange code in semantic/db-el.el Date: Thu, 12 Feb 2015 21:04:39 -0500 Message-ID: <54DD5BB7.1040006@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1423793100 4112 80.91.229.3 (13 Feb 2015 02:05:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Feb 2015 02:05:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier , "Eric M. Ludlam" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 13 03:04:53 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YM5ci-0007lQ-Dg for ged-emacs-devel@m.gmane.org; Fri, 13 Feb 2015 03:04:52 +0100 Original-Received: from localhost ([::1]:52939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM5ch-0000VV-Kc for ged-emacs-devel@m.gmane.org; Thu, 12 Feb 2015 21:04:51 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM5cc-0000VF-P5 for emacs-devel@gnu.org; Thu, 12 Feb 2015 21:04:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YM5cZ-0000Gm-J1 for emacs-devel@gnu.org; Thu, 12 Feb 2015 21:04:46 -0500 Original-Received: from mail-vc0-x22c.google.com ([2607:f8b0:400c:c03::22c]:59347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YM5cZ-0000Gi-DG; Thu, 12 Feb 2015 21:04:43 -0500 Original-Received: by mail-vc0-f172.google.com with SMTP id kv7so5099495vcb.3; Thu, 12 Feb 2015 18:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=JbfEWu2WbhHdujqsLtxBzGJ7AFeOHfFcEC9OLZ8QeD8=; b=Qep6ZgQlOsZY+t7vvZo5tjwr/bdLCliAAYk7vySbAARgJEN1uyNHat1bKZDH2QlNLg nGfSQgiwd7OKv1sNmbYMsviEx0Vq13av+2L+bL4G4PVE2Nb5CvBZIT0u5WVZFgghLLww LuyHTIy04wH2uhNXHhh4y09AMeHe4Dtj6jJnL4Ru33xZjt28Nl9tnqiBNIsDDyrOlv6V OiNaI6TRVpwfYszCZWVwzH4fliwpeViftZGopkwxmK/jkDlVOkmaY/GFT2Tj/Q33Srjm 5hKsOW8m+PYeBf80qIPJznen6Zmx+n6fFBjf9EuhweVSCgUfzbZAAopTxwN9ZM0gsraR 3wUQ== X-Received: by 10.52.3.74 with SMTP id a10mr4146449vda.95.1423793082260; Thu, 12 Feb 2015 18:04:42 -0800 (PST) Original-Received: from [192.168.1.202] (pool-108-20-224-24.bstnma.fios.verizon.net. [108.20.224.24]) by mx.google.com with ESMTPSA id vp20sm1685809vdb.22.2015.02.12.18.04.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 18:04:41 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c03::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182986 Archived-At: 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