From: Lars Ingebrigtsen Date: Wed, 11 May 2022 14:29:01 +0000 (+0200) Subject: Add new user option 'cperl-file-style' X-Git-Tag: emacs-29.0.90~1910^2~794 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cf1e1584d99dc249f194c023f64f1129ebc528f2;p=emacs.git Add new user option 'cperl-file-style' * lisp/progmodes/cperl-mode.el (cperl-file-style): New user option (bug#17948). (cperl-mode): Mention it. (cperl-style-alist): Mention it. --- diff --git a/etc/NEWS b/etc/NEWS index 926f5d64645..991088a067f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -786,6 +786,11 @@ so automatically. * Changes in Specialized Modes and Packages in Emacs 29.1 +--- +*** New user option 'cperl-file-style'. +The determines the indentation style to be used. This can also be +used as a file-local variable. + --- *** 'gud-go' is now bound to 'C-c C-v'. If given a prefix, it will query the user for an argument to use for diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 3742286e5d3..76784562085 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -558,6 +558,19 @@ This way enabling/disabling of menu items is more correct." :type 'boolean :group 'cperl-speed) +(defcustom cperl-file-style nil + "Indentation style to use in cperl-mode." + :type '(choice (const "CPerl") + (const "PBP") + (const "PerlStyle") + (const "GNU") + (const "C++") + (const "K&R") + (const "BSD") + (const "Whitesmith")) + :version "29.1") +;;;###autoload(put 'cperl-file-style 'safe-local-variable 'stringp) + (defcustom cperl-ps-print-face-properties '((font-lock-keyword-face nil nil bold shadow) (font-lock-variable-name-face nil nil bold) @@ -1660,9 +1673,11 @@ Settings for classic indent-styles: K&R BSD=C++ GNU PBP PerlStyle=Whitesmith `cperl-continued-statement-offset' 5 4 2 4 4 CPerl knows several indentation styles, and may bulk set the -corresponding variables. Use \\[cperl-set-style] to do this. Use -\\[cperl-set-style-back] to restore the memorized preexisting values -\(both available from menu). See examples in `cperl-style-examples'. +corresponding variables. Use \\[cperl-set-style] to do this or +set the `cperl-file-style' user option. Use +\\[cperl-set-style-back] to restore the memorized preexisting +values \(both available from menu). See examples in +`cperl-style-examples'. Part of the indentation style is how different parts of if/elsif/else statements are broken into lines; in CPerl, this is reflected on how @@ -1795,6 +1810,8 @@ or as help on variables `cperl-tips', `cperl-problems', (when (and cperl-pod-here-scan (not cperl-syntaxify-by-font-lock)) (cperl-find-pods-heres)) + (when cperl-file-style + (cperl-set-style cperl-file-style)) ;; Setup Flymake (add-hook 'flymake-diagnostic-functions #'perl-flymake nil t)) @@ -6313,7 +6330,7 @@ else ) ("Current")) "List of variables to set to get a particular indentation style. -Should be used via `cperl-set-style' or via Perl menu. +Should be used via `cperl-set-style', `cperl-file-style' or via Perl menu. See examples in `cperl-style-examples'.")