Function: cperl-set-style

cperl-set-style is an interactive and byte-compiled function defined in cperl-mode.el.gz.

Signature

(cperl-set-style STYLE)

Documentation

Set CPerl mode variables to use one of several different indentation styles.

The arguments are a string representing the desired style. The list of styles is in cperl-style-alist, available styles are "CPerl", "PBP", "PerlStyle", "GNU", "K&R", "BSD", "C++" and "Whitesmith".

The current value of style is memorized (unless there is a memorized data already), may be restored by cperl-set-style-back.

Choosing "Current" style will not change style, so this may be used for side-effect of memorizing only. Examples in cperl-style-examples.

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-set-style (style)
  "Set CPerl mode variables to use one of several different indentation styles.
The arguments are a string representing the desired style.
The list of styles is in `cperl-style-alist', available styles
are \"CPerl\", \"PBP\", \"PerlStyle\", \"GNU\", \"K&R\", \"BSD\", \"C++\"
and \"Whitesmith\".

The current value of style is memorized (unless there is a memorized
data already), may be restored by `cperl-set-style-back'.

Choosing \"Current\" style will not change style, so this may be used for
side-effect of memorizing only.  Examples in `cperl-style-examples'."
  (interactive
   (list (completing-read "Enter style: " cperl-style-alist nil 'insist)))
  (or cperl-old-style
      (setq cperl-old-style
            (mapcar (lambda (name)
                      (cons name (eval name)))
		    cperl-styles-entries)))
  (let ((style (cdr (assoc style cperl-style-alist))) setting)
    (while style
      (setq setting (car style) style (cdr style))
      (set (car setting) (cdr setting)))))