From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#18643: 25.0.50; elisp--expect-function-p Date: Sat, 11 Oct 2014 21:07:57 +0400 Message-ID: <543963ED.2030107@yandex.ru> References: <86oatmq7lc.fsf@yandex.ru> <543753AC.3090604@yandex.ru> 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 1413047368 24450 80.91.229.3 (11 Oct 2014 17:09:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Oct 2014 17:09:28 +0000 (UTC) Cc: Leo Liu , 18643@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 11 19:09:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Xd0AS-00039p-0f for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Oct 2014 19:09:20 +0200 Original-Received: from localhost ([::1]:54758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd0AR-0007Cy-HU for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Oct 2014 13:09:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd0AI-0007Cm-2M for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 13:09:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xd0AA-0004UZ-Hs for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 13:09:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd0AA-0004UV-Eu for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 13:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xd0AA-0001KN-2E for bug-gnu-emacs@gnu.org; Sat, 11 Oct 2014 13:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Oct 2014 17:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18643 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18643-submit@debbugs.gnu.org id=B18643.14130472845029 (code B ref 18643); Sat, 11 Oct 2014 17:09:01 +0000 Original-Received: (at 18643) by debbugs.gnu.org; 11 Oct 2014 17:08:04 +0000 Original-Received: from localhost ([127.0.0.1]:41256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xd09D-0001J2-VQ for submit@debbugs.gnu.org; Sat, 11 Oct 2014 13:08:04 -0400 Original-Received: from mail-lb0-f174.google.com ([209.85.217.174]:43942) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xd09A-0001Ic-Pp for 18643@debbugs.gnu.org; Sat, 11 Oct 2014 13:08:01 -0400 Original-Received: by mail-lb0-f174.google.com with SMTP id p9so4596805lbv.5 for <18643@debbugs.gnu.org>; Sat, 11 Oct 2014 10:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=IEkbXuEJ0+RS014ck1G3TJB0xOmAmLMHS3AlAF+ckKw=; b=LWagoJLAbPwTT8zS5QC+LnADLCCmC2HO0aR/iYngM4UEJ1U4sSXLSA60Areeog2xqZ YMG0GLo3RsGVxMYuaUtE2IaPIYYxQ8Gq+GIMEKawEGwx+1sRcdsObJG4K6ll/sDji3yR 0BGAxJ8n6S6ckNiqouykdHl7SGd/KNpsr75CnJZ9dg5rmKqfIOIKjcnWtmVB+vhkpGTj IuVZSY87uIwUMlFDyCaeATBqXKIbrbN1uMtWhndyVoeMEBGIKM1gjyYs3EipojeOVJf8 NGNkCBRNuhryuqri5gpUzWcbWlJhyU4zydy1ivS5Zl39NpMi+R/FKj+HiFwjwYag8IOJ 6a+g== X-Received: by 10.152.9.37 with SMTP id w5mr12598951laa.28.1413047279919; Sat, 11 Oct 2014 10:07:59 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id 2sm2865190lai.36.2014.10.11.10.07.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Oct 2014 10:07:58 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:94420 On 10/10/2014 05:20 PM, Stefan Monnier wrote: >> Now I just have to wrap my head around `elisp--local-variables'. :) > > It's very simple: :) > It takes the string between the first opening paren and point, appends > a special symbol (the witness) followed by the number of missing closing > parens to make the whole string a valid sexp, than reads¯oexpands > that. And then we traverse the expanded code (a tree) straight from the > root to the leaf corresponding to point (which is done in > elisp--local-variables-1), collecting various info along the way. Thanks! I guess it might fail if some macros along the way require more arguments than we actually give them. But that can be worked around on case-by-case basis. > Of course, traversing the tree efficiently is hard/impossible because > we don't know for sure where is the witness (which represents point) in > the tree, so we'd have to go through all the nodes of the tree, whereas > we want to limit ourselves to going down from the root straight to the > right leaf without backtracking. I can see how performance could be a problem, but so far it's never been the bottleneck for me. In the cases I measured, (lisp--local-variables) takes around 1-2 ms (and up to 10ms near the end of the huge `cl--parse-loop-clause'). So even the caching mechanism you have in `lisp--local-variables-completion-table' could be unnecessary. On the other hand, I've managed to find a specific case when it fails (will file the bug shortly).