From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: trunk r116285: * lisp/emacs-lisp/lisp.el (lisp-completion-at-point): Symbols don't start Date: Tue, 11 Feb 2014 05:43:33 +0200 Message-ID: <52F99C65.5010007@yandex.ru> References: <87zjm4tl2b.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1392090231 11913 80.91.229.3 (11 Feb 2014 03:43:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Feb 2014 03:43:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 11 04:43:59 2014 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 1WD4GM-0004BE-22 for ged-emacs-devel@m.gmane.org; Tue, 11 Feb 2014 04:43:58 +0100 Original-Received: from localhost ([::1]:59298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD4GL-0004PP-MK for ged-emacs-devel@m.gmane.org; Mon, 10 Feb 2014 22:43:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD4GB-0004PB-Fs for emacs-devel@gnu.org; Mon, 10 Feb 2014 22:43:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WD4G3-0006Wn-2G for emacs-devel@gnu.org; Mon, 10 Feb 2014 22:43:47 -0500 Original-Received: from mail-ee0-x235.google.com ([2a00:1450:4013:c00::235]:63936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD4G2-0006Wa-QX for emacs-devel@gnu.org; Mon, 10 Feb 2014 22:43:38 -0500 Original-Received: by mail-ee0-f53.google.com with SMTP id t10so3277815eei.26 for ; Mon, 10 Feb 2014 19:43:37 -0800 (PST) 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=a4j0xD08rF8zoQMwGagQBP5kVbXr6IjmmCbWCqDKZto=; b=HahRdnz5XVer9+8k2IxuLCcZsXkwS9Prafo2H/eRaOkCnvLVsrjucr9A86tFFigC+Z pcQEmPcsC369wUOA3p7JoOccJzmNQYpm+6SOQjBCg942kQ0wivsv/xIrw7MySWOJ9Gm/ S1JLyKdo6GqUUWRYd2EuMYf3ZJUOeymJEjDZbwkc9VKClkE1tsmTq5dbktdo444GuC6r bP8IgtNBD4/1bJNopQdRYUpI/GZnCJNUlBKc+p8bB7WlGuvfdYuIecxw1vK6OdQdj2HT htOTOuGQ4bPKgKIzoZ86KHaU2Vw5iMhgzhSP3Y5GoMGpu9RPcWK0UY9mFZeaTg+qkz1S IRag== X-Received: by 10.14.104.6 with SMTP id h6mr40894080eeg.29.1392090217899; Mon, 10 Feb 2014 19:43:37 -0800 (PST) Original-Received: from [192.168.10.2] (62-36-157.netrun.cytanet.com.cy. [62.228.36.157]) by mx.google.com with ESMTPSA id s46sm61853555eeb.0.2014.02.10.19.43.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 19:43:36 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::235 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:169521 Archived-At: On 07.02.2014 00:00, Stefan Monnier wrote: > Yes, except that "a quote before BEG" is not sufficient. > We could/should also check if one of the parent open-parens is prefixed > with a quote or a backquote, and only allow boundp if not. Ok to install? This doesn't handle macros, but most of them don't try to obfuscate whether a given form is evaluated or not, at least well-behaving ones. `defadvice', ideally, would have to be handled specially anyway, to limit completions to functions. === modified file 'lisp/emacs-lisp/lisp.el' --- lisp/emacs-lisp/lisp.el 2014-02-10 01:34:22 +0000 +++ lisp/emacs-lisp/lisp.el 2014-02-11 03:36:20 +0000 @@ -752,6 +752,20 @@ (mapcar #'symbol-name (lisp--local-variables)))))) lastvars))))) +(defun lisp--form-quoted-p () + "Return non-nil if the form after point is not evaluated. +It can be quoted, or be inside a quoted form. +This function moves point." + ;; FIXME: Do some macro expansion maybe. + (or (eq (char-after) ?\[) + (progn + (skip-chars-backward " ") + (memq (char-before) '(?' ?`))) + (and (not (eq (char-before) ?,)) + (ignore-errors + (up-list -1) + (lisp--form-quoted-p))))) + ;; FIXME: Support for Company brings in features which straddle eldoc. ;; We should consolidate this, so that major modes can provide all that ;; data all at once: @@ -835,12 +849,16 @@ lisp--local-variables-completion-table (apply-partially #'completion-table-with-predicate obarray - ;; Don't include all symbols - ;; (bug#16646). - (lambda (sym) - (or (boundp sym) - (fboundp sym) - (symbol-plist sym))) + (if (save-excursion + (goto-char beg) + (lisp--form-quoted-p)) + ;; Don't include all symbols + ;; (bug#16646). + (lambda (sym) + (or (boundp sym) + (fboundp sym) + (symbol-plist sym))) + #'boundp) 'strict)) :annotation-function (lambda (str) (if (fboundp (intern-soft str)) " "))