From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Bolshakov Newsgroups: gmane.emacs.bugs Subject: bug#700: hideshow.el micro improvements Date: Thu, 06 Aug 2009 14:52:31 +0400 Message-ID: <4A7AB5EF.70501@bridge-quest.com> References: <87vdm5vqs9.fsf@stupidchicken.com> Reply-To: Dmitry Bolshakov , 700@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000104080402080507040704" X-Trace: ger.gmane.org 1249556881 3045 80.91.229.12 (6 Aug 2009 11:08:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Aug 2009 11:08:01 +0000 (UTC) Cc: 700@emacsbugs.donarmstrong.com To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 06 13:07:54 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MZ0p7-00026j-2s for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Aug 2009 13:07:54 +0200 Original-Received: from localhost ([127.0.0.1]:60202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZ0p6-0008Kj-Bj for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Aug 2009 07:07:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZ0oH-0007yF-1r for bug-gnu-emacs@gnu.org; Thu, 06 Aug 2009 07:07:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZ0oA-0007sj-JW for bug-gnu-emacs@gnu.org; Thu, 06 Aug 2009 07:07:00 -0400 Original-Received: from [199.232.76.173] (port=52569 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZ0oA-0007sR-4c for bug-gnu-emacs@gnu.org; Thu, 06 Aug 2009 07:06:54 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:42529) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MZ0o9-0001UA-Hw for bug-gnu-emacs@gnu.org; Thu, 06 Aug 2009 07:06:53 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n76B6ls6006329; Thu, 6 Aug 2009 04:06:50 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n76B04aG004867; Thu, 6 Aug 2009 04:00:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Dmitry Bolshakov Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 06 Aug 2009 11:00:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 700 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Original-Received: via spool by 700-submit@emacsbugs.donarmstrong.com id=B700.12495559774335 (code B ref 700); Thu, 06 Aug 2009 11:00:04 +0000 Original-Received: (at 700) by emacsbugs.donarmstrong.com; 6 Aug 2009 10:52:57 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail44.opentransfer.com (mail44.opentransfer.com [76.162.254.44]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with SMTP id n76AqtR7004332 for <700@emacsbugs.donarmstrong.com>; Thu, 6 Aug 2009 03:52:57 -0700 Original-Received: (qmail 17489 invoked by uid 399); 6 Aug 2009 10:52:50 -0000 Original-Received: from unknown (HELO ?192.168.14.15?) (dmitry.bolshakov@bridge-quest.com@80.249.179.82) by mail44.opentransfer.com with SMTP; 6 Aug 2009 10:52:50 -0000 User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) In-Reply-To: <87vdm5vqs9.fsf@stupidchicken.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Thu, 06 Aug 2009 07:07:00 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29931 Archived-At: This is a multi-part message in MIME format. --------------000104080402080507040704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -------- Original Message -------- Subject: Re: hideshow.el micro improvements From: Chong Yidong To: Dmitry Bolshakov Cc: 700@emacsbugs.donarmstrong.com Date: 06.07.2009 18:18 >> 1. show >> >> xxx {...} yyy {...} >> >> instead of >> >> xxx {... >> } > > You patch did not work properly for GNU-style braces. I've checked in a > fix that works a little better for both cases. > >> 2. in the hs-hide-level-recursive skip parenthesis inside comments >> because of they can be unbalanced > > Could you give a test recipe that shows this bug? > > hi, see attachment open file M-x hs-minor-mode M-x eval-expression (hs-hide-level 1) and i get: Debugger entered--Lisp error: (scan-error "Unbalanced parentheses" 60 156) scan-sexps(60 1) forward-sexp(1) funcall(forward-sexp 1) (progn (set-match-data match-data) (goto-char (match-beginning hs-block-start-mdata-select)) (funcall hs-forward-sexp-func arg)) (unwind-protect (progn (set-match-data match-data) (goto-char ...) (funcall hs-forward-sexp-func arg)) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal ...)) (unwind-protect (progn ... ... ...) (set-match-data save-match-data-internal ...))) (save-match-data (set-match-data match-data) (goto-char (match-beginning hs-block-start-mdata-select)) (funcall hs-forward-sexp-func arg)) hs-forward-sexp((60 61 #) 1) (progn (hs-forward-sexp mdata 1) (end-of-line) (point)) (let* ((mdata ...) (pure-p ...) (p ...) (q ...) ov) (when (and ... ...) (cond ... ...) (hs-make-overlay p q ... ...)) (goto-char (if end q ...))) (progn (let* (... ... ... ... ov) (when ... ... ...) (goto-char ...))) (if (looking-at hs-block-start-regexp) (progn (let* ... ... ...))) (when (looking-at hs-block-start-regexp) (let* (... ... ... ... ov) (when ... ... ...) (goto-char ...))) (if comment-reg (hs-hide-comment-region (car comment-reg) (cadr comment-reg) end) (when (looking-at hs-block-start-regexp) (let* ... ... ...))) hs-hide-block-at-point(t) (if (> arg 1) (hs-hide-level-recursive (1- arg) minp maxp) (goto-char (match-beginning hs-block-start-mdata-select)) (hs-hide-block-at-point t)) (while (progn (forward-comment ...) (and ... ...)) (if (> arg 1) (hs-hide-level-recursive ... minp maxp) (goto-char ...) (hs-hide-block-at-point t))) hs-hide-level-recursive(1 1 156) (save-excursion (message "Hiding blocks ...") (hs-hide-level-recursive arg (point-min) (point-max)) (message "Hiding blocks ... done")) (let ((inhibit-point-motion-hooks t) (case-fold-search t)) (save-excursion (message "Hiding blocks ...") (hs-hide-level-recursive arg ... ...) (message "Hiding blocks ... done")) (run-hooks (quote hs-hide-hook))) (progn (let (... ...) (save-excursion ... ... ...) (run-hooks ...))) (if hs-minor-mode (progn (let ... ... ...))) (when hs-minor-mode (let (... ...) (save-excursion ... ... ...) (run-hooks ...))) (hs-life-goes-on (save-excursion (message "Hiding blocks ...") (hs-hide-level-recursive arg ... ...) (message "Hiding blocks ... done")) (run-hooks (quote hs-hide-hook))) hs-hide-level(1) eval((hs-hide-level 1)) eval-expression((hs-hide-level 1) nil) call-interactively(eval-expression) execute-extended-command(nil) call-interactively(execute-extended-command) -- With best regards Dmitry Bolshakov --------------000104080402080507040704 Content-Type: text/plain; name="unbalanced-braces-test.pl" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="unbalanced-braces-test.pl" #!/usr/bin/perl use strict; # left brace inside comments { cause error sub blabla { for (my $i = 0; $i < 10; $i++) { printf("\$i is %d\n", $i); } } --------------000104080402080507040704--