Subject: bug#12236: 24.2.50; hideshow.el: missing a `make-variable-buffer-local'

From: Dan Nicolaescu <[email-masked]>
Date: Mon, 20 Aug 2012 11:27:28 -0400

Michael Heerdegen <[email-masked]> writes:

> Hi,
>
> please look at these lines in hideshow.el:
>
>   (defvar hs-c-start-regexp nil
>     "Regexp for beginning of comments.
>   Differs from mode-specific comment regexps in that
>   surrounding whitespace is stripped.")
>   (make-variable-buffer-local 'hs-c-start-regexp)
>   
>   (defvar hs-block-start-regexp nil
>     "Regexp for beginning of block.")
>   (make-variable-buffer-local 'hs-block-start-regexp)
>   
>   (defvar hs-block-start-mdata-select nil
>     "Element in `hs-block-start-regexp' match data to consider as block start.
>   The internal function `hs-forward-sexp' moves point to the beginning of this
>   element (using `match-beginning') before calling `hs-forward-sexp-func'.")
>   (make-variable-buffer-local 'hs-block-start-mdata-select)
>   
>   (defvar hs-block-end-regexp nil
>     "Regexp for end of block.")
>   
>   (defvar hs-forward-sexp-func 'forward-sexp
>     "Function used to do a `forward-sexp'.
>   Should change for Algol-ish modes.  For single-character block
>   delimiters -- ie, the syntax table regexp for the character is
>   either `(' or `)' -- `hs-forward-sexp-func' would just be
>   `forward-sexp'.  For other modes such as simula, a more specialized
>   function is necessary.")
>   (make-variable-buffer-local 'hs-forward-sexp-func)
>
> I think it is obvious that `hs-block-end-regexp' must be declared as
> buffer local as well.

Yes, that existed, but it got lost at some point.
I fixed this in the emacs-24 branch which will get propagated to the
trunk at some point.

> Currently, if you invoke hs-minor-mode in two different buffers with
> different major-modes, the setting of the second buffer overwrites the
> value of `hs-block-end-regexp' in the first one, making hideshow
> malfunctioning there.
>
>
> Thanks,
>
> Michael.
>
>
> In GNU Emacs 24.2.50.1 (i486-pc-linux-gnu, GTK+ Version 3.4.2)
>  of 2012-08-15 on dex, modified by Debian
>  (emacs-snapshot package, version 2:20120815-1)
> Windowing system distributor `The X.Org Foundation', version 11.0.11203000
> Configured using:
>  `configure '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu'
>  '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
>  '--localstatedir=/var' '--infodir=/usr/share/info'
>  '--mandir=/usr/share/man' '--with-pop=yes'
>  '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.2.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2.50/site-lisp:/usr/share/emacs/site-lisp'
>  '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/'
>  '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes'
>  'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu'
>  'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g
>  -Wl,--as-needed -znocombreloc' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''