From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'. Date: Fri, 11 Mar 2016 12:22:09 +0000 Message-ID: <20160311122209.GB2888@acm.fritz.box> References: <20160308132530.861.91488@vcs.savannah.gnu.org> <20160308183010.GB6269@acm.fritz.box> <0a6e6ab8-f396-4ded-2fed-55a3db3f055a@yandex.ru> <38e34bbb-9ccb-e44d-1ec0-03e630f25e9d@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1457698790 5639 80.91.229.3 (11 Mar 2016 12:19:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2016 12:19:50 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, monnier@iro.umontreal.ca To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 11 13:19:42 2016 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 1aeM2d-0005AD-Uj for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2016 13:19:40 +0100 Original-Received: from localhost ([::1]:54466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeM2d-00046J-2l for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2016 07:19:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeM2Z-00045I-JE for emacs-devel@gnu.org; Fri, 11 Mar 2016 07:19:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeM2W-0004A4-BI for emacs-devel@gnu.org; Fri, 11 Mar 2016 07:19:35 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:62816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeM2W-00049Z-2C for emacs-devel@gnu.org; Fri, 11 Mar 2016 07:19:32 -0500 Original-Received: (qmail 69086 invoked by uid 3782); 11 Mar 2016 12:19:30 -0000 Original-Received: from acm.muc.de (p579E8E6B.dip0.t-ipconnect.de [87.158.142.107]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 11 Mar 2016 13:19:29 +0100 Original-Received: (qmail 3002 invoked by uid 1000); 11 Mar 2016 12:22:09 -0000 Content-Disposition: inline In-Reply-To: <38e34bbb-9ccb-e44d-1ec0-03e630f25e9d@yandex.ru> User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:201458 Archived-At: Hello Dmitry. On Fri, Mar 11, 2016 at 02:26:25AM +0200, Dmitry Gutov wrote: > On 03/10/2016 11:20 PM, Richard Stallman wrote: > > If you make a concrete proposal for the new behavior, we can think about it. > There's nothing particularly hard about it--we have > beginning-of-defun-function's implemented for much more complex > functions than Elisp. > Here's a quick sketch: > (defun elisp-beginning-of-defun (&optional count) > (setq count (or count 1)) > (dotimes (i count) > (while (and (re-search-backward "(\\(?:cl-\\)?def" nil t) > (elisp--form-quoted-p (point)))))) > It fails on forms such as (define-key ...), but it's easy to also check > all positions in (nth 9 (syntax-ppss)), and only pick the outermost > defun-looking form. We can also make the regexp stricter, to only accept > [cl-]defun, defmacro, defvar and defconst. Please don't think of using (nth 9 (snytax-ppss)) in such a high level function. It's strictly internal stuff used for continuing a parse in the middle of something. If you do really want to use it, we should consider making that element fully defined at the user level (and possibly stating any further elements are "internal"). I think a better way to do this would be to search for "containing functions", such as `eval-when-compile' at the top level, and designate everything inside them as "top level". > Anyway, like Alan mentioned, this caching proposal is actually > orthogonal to the use of open-paren-in-column-0-is-defun-start in > beginning-of-defun in emacs-lisp-mode. We could still keep that > application, if we so preferred. Indeed. -- Alan Mackenzie (Nuremberg, Germany).