Subject: bug#17948: 24.3; cperl: Needs an equivalent to `c-file-style'

From: Harald Jörg <[email-masked]>
Date: Wed, 03 Jan 2024 19:02:57 +0000

I suggest the following solution:

 - A new command (proposed name: `cperl-file-style' in sync with the
   option) sets the same set of variables as `cperl-set-style', but at
   the same time makes them buffer-local.

 - The `cperl-mode' command will call this new function if
   the option `cperl-file-style' is set to a non-nil value.

 - The command cperl-set-style is modified to set the
   default-toplevel-value for each option.  This command will also be
   used by the :set function of customize.

So, if `cperl-file-style' is at its default value of nil, all variables
stay global but can of course still individually appear in file or
directory variables.  If `cperl-file-style' is set, it defines new
defaults for all options.

This does not allow to have "PBP-style, but with an indent level of 3"
as a *customizable* default because cperl-file-style will override it,
but I'd expect it to work if both options are set in the correct order
in .dir-locals.el or file variables.

Does that sound ok?  I can prepare a patch ~ this weekend.

-- 
Cheers,
haj