From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: parse-partial-sexp to stop at any depth change (and Re: Fontifying outside of region passed to registered JIT lock function) Date: Fri, 22 Nov 2013 21:01:07 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1385172087 14886 80.91.229.3 (23 Nov 2013 02:01:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Nov 2013 02:01:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: Barry OReilly Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 23 03:01:31 2013 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 1Vk2XK-00034T-Qv for ged-emacs-devel@m.gmane.org; Sat, 23 Nov 2013 03:01:30 +0100 Original-Received: from localhost ([::1]:41904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vk2XK-0005IH-CK for ged-emacs-devel@m.gmane.org; Fri, 22 Nov 2013 21:01:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vk2XA-0005HF-Mm for emacs-devel@gnu.org; Fri, 22 Nov 2013 21:01:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vk2Wy-0001Ca-D3 for emacs-devel@gnu.org; Fri, 22 Nov 2013 21:01:20 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:6569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vk2Wy-0001CV-98 for emacs-devel@gnu.org; Fri, 22 Nov 2013 21:01:08 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFHO+KWN/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNAcLFBgNJC6HcAbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av4EABK/CFHO+KWN/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNAcLFBgNJC6HcAbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="40200389" Original-Received: from 206-248-165-141.dsl.teksavvy.com (HELO pastel.home) ([206.248.165.141]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Nov 2013 21:01:07 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 7060960691; Fri, 22 Nov 2013 21:01:07 -0500 (EST) In-Reply-To: (Barry OReilly's message of "Fri, 22 Nov 2013 17:14:52 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:165592 Archived-At: >> insert a "display only" close-paren (with suitable coloring). > There's probably less potential to cause user confusion if it colors > existing parens rather than color parens that are not really a part of > the file content. But if that existing paren is before window-start, the user won't see it. Using fake close-parens might not be the best choice, but I think the idea of having some visual indicator saying "not enough whitespace here or missing close parens on previous lines" between BOL and the first non-whitespace char can be workable. This visual indicator can be to just highlight the indentation space, but as you say there might not be any indentation space, so inserting a display-only char can be a good solution. Now which char to use is up to you. > One issue is my usage of parse-partial-sexp. This function's interface > doesn't make it easy to stop if there's a change of depth either up or > down, so for code simplicity I went one char at a time: > (parse-partial-sexp (point) > (1+ (point)) > nil > nil > parse-state > nil) Yuck! Look at (nth 9 (syntax-ppss)): it's a list of the positions of the open-parens that aren't closed yet. Stefan