[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master cf1e1584d9 1/2: Add new user option 'cperl-file-style'
From: |
Lars Ingebrigtsen |
Subject: |
master cf1e1584d9 1/2: Add new user option 'cperl-file-style' |
Date: |
Wed, 11 May 2022 10:29:30 -0400 (EDT) |
branch: master
commit cf1e1584d99dc249f194c023f64f1129ebc528f2
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
etc/NEWS | 5 +++++
lisp/progmodes/cperl-mode.el | 25 +++++++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 926f5d6464..991088a067 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 3742286e5d..7678456208 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'.")