unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#700: hideshow.el micro improvements
@ 2008-08-12 11:52 Dmitry Bolshakov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Bolshakov @ 2008-08-12 11:52 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

hideshow.el micro improvements

1. show

xxx {...} yyy {...}

instead of

xxx {...
}

2. in the hs-hide-level-recursive skip parenthesis inside comments 
because of they can be unbalanced

-- 
With best regards
Dmitry Bolshakov

[-- Attachment #2: hideshow_my.zip --]
[-- Type: application/x-zip-compressed, Size: 25041 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#700: hideshow.el micro improvements
@ 2009-07-06 14:18 Chong Yidong
  2009-08-06 10:52 ` Dmitry Bolshakov
  0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2009-07-06 14:18 UTC (permalink / raw)
  To: Dmitry Bolshakov; +Cc: 700

> 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?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#700: hideshow.el micro improvements
  2009-07-06 14:18 bug#700: hideshow.el micro improvements Chong Yidong
@ 2009-08-06 10:52 ` Dmitry Bolshakov
  2009-08-07  5:49   ` Dan Nicolaescu
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Bolshakov @ 2009-08-06 10:52 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 700

[-- Attachment #1: Type: text/plain, Size: 3410 bytes --]

-------- 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 {...
>> }
> 
> 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

[-- Attachment #2: unbalanced-braces-test.pl --]
[-- Type: text/plain, Size: 155 bytes --]

#!/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);
	}
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#700: hideshow.el micro improvements
  2009-08-06 10:52 ` Dmitry Bolshakov
@ 2009-08-07  5:49   ` Dan Nicolaescu
  2009-08-07 14:24     ` Chong Yidong
  2009-08-07 16:13     ` Dmitry Bolshakov
  0 siblings, 2 replies; 6+ messages in thread
From: Dan Nicolaescu @ 2009-08-07  5:49 UTC (permalink / raw)
  To: Dmitry Bolshakov; +Cc: 700, Chong Yidong

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);
  > 	}
  > }





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#700: hideshow.el micro improvements
  2009-08-07  5:49   ` Dan Nicolaescu
@ 2009-08-07 14:24     ` Chong Yidong
  2009-08-07 16:13     ` Dmitry Bolshakov
  1 sibling, 0 replies; 6+ messages in thread
From: Chong Yidong @ 2009-08-07 14:24 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: Dmitry Bolshakov, 700

Dan Nicolaescu <dann@ics.uci.edu> writes:

> 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

I'm busy this week, but I'll see if I can do it this weekend.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#700: hideshow.el micro improvements
  2009-08-07  5:49   ` Dan Nicolaescu
  2009-08-07 14:24     ` Chong Yidong
@ 2009-08-07 16:13     ` Dmitry Bolshakov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Bolshakov @ 2009-08-07 16:13 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: 700, Chong Yidong

[-- Attachment #1: Type: text/plain, Size: 4682 bytes --]

hi

i have done a test case

-------- Original Message  --------
Subject: Re: bug#700: hideshow.el micro improvements
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Dmitry Bolshakov <dmitry.bolshakov@bridge-quest.com>
Cc: 700@emacsbugs.donarmstrong.com, Chong Yidong <cyd@stupidchicken.com>
Date: 07.08.2009 9:49

> 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);
>   > 	}
>   > }
> 
> 


-- 
With best regards
Dmitry Bolshakov

[-- Attachment #2: bug-700 (hideshow).zip --]
[-- Type: application/x-zip-compressed, Size: 158236 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-07 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-06 14:18 bug#700: hideshow.el micro improvements Chong Yidong
2009-08-06 10:52 ` Dmitry Bolshakov
2009-08-07  5:49   ` Dan Nicolaescu
2009-08-07 14:24     ` Chong Yidong
2009-08-07 16:13     ` Dmitry Bolshakov
  -- strict thread matches above, loose matches on Subject: below --
2008-08-12 11:52 Dmitry Bolshakov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).