Function: c-set-offset
c-set-offset is an autoloaded, interactive and byte-compiled function
defined in cc-styles.el.gz.
Signature
(c-set-offset SYMBOL OFFSET &optional IGNORED)
Documentation
Change the value of a syntactic element symbol in c-offsets-alist.
SYMBOL is the syntactic element symbol to change and OFFSET is the new offset for that syntactic element. The optional argument is not used and exists only for compatibility reasons.
Probably introduced at or before Emacs version 19.23.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-styles.el.gz
;;;###autoload
(defun c-set-offset (symbol offset &optional _ignored)
"Change the value of a syntactic element symbol in `c-offsets-alist'.
SYMBOL is the syntactic element symbol to change and OFFSET is the new
offset for that syntactic element. The optional argument is not used
and exists only for compatibility reasons."
(interactive
(let* ((langelem
(intern (completing-read
(concat "Syntactic symbol to change"
(if current-prefix-arg " or add" "")
": ")
(mapcar
(lambda (langelem)
(cons (format "%s" (car langelem)) nil))
(get 'c-offsets-alist 'c-stylevar-fallback))
nil (not current-prefix-arg)
;; initial contents tries to be the last element
;; on the syntactic analysis list for the current
;; line
(and c-buffer-is-cc-mode
(c-save-buffer-state
((syntax (c-guess-basic-syntax))
(len (length syntax))
(ic (format "%s" (car (nth (1- len) syntax)))))
(cons ic 0)))
)))
(offset (c-read-offset langelem)))
(list langelem offset current-prefix-arg)))
;; sanity check offset
(if (c-valid-offset offset)
(let ((entry (assq symbol c-offsets-alist)))
(if entry
(setcdr entry offset)
(if (assq symbol (get 'c-offsets-alist 'c-stylevar-fallback))
(setq c-offsets-alist (cons (cons symbol offset)
c-offsets-alist))
(c-benign-error "%s is not a valid syntactic symbol" symbol))))
(c-benign-error "Invalid indentation setting for symbol %s: %S"
symbol offset))
(c-keep-region-active))