Dmitry Bolshakov <dmitry.bolshakov@bridge-quest.com> writes:
> -------- Original Message --------
> Subject: Re: hideshow.el micro improvements
> From: Chong Yidong <cyd@stupidchicken.com>
> To: Dmitry Bolshakov <dmitry.bolshakov@bridge-quest.com>
> Cc: 700@emacsbugs.donarmstrong.com
> Date: 06.07.2009 18:18
>
> >> 1. show
> >>
> >> xxx {...} yyy {...}
> >>
> >> instead of
> >>
> >> xxx {...
> >> }
Can you please debug your change, as it has caused problems for lisp
files, see:
http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3896
and
http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg00874.html
Thanks!
> > 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 #<buffer unbalanced-braces-test.pl>) 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
> #!/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);
> }
> }