Files
libakstdlib/scripts/reindent.el

26 lines
1.1 KiB
EmacsLisp
Raw Normal View History

;; Canonical reindent: Emacs cc-mode "stroustrup", c-basic-offset 4,
;; indent-tabs-mode on, tab-width 8. A correct file is a fixed point of this.
;;
;; inextern-lang is set to 0 because akstdlib.h wraps its whole body in
;; extern "C" { }, and cc-mode otherwise indents every declaration in the file
;; one level for it. That is a real cc-mode behaviour rather than a bug, but it
;; is not the house style and not what the file looked like before.
;;
;; AGENTS.md forbids introducing clang-format, and this is why the tool that
;; decides what "correct" means has to be the same engine the author's editor
;; runs: this offset is not something clang-format could be made to agree with.
(require 'cc-mode)
(setq-default indent-tabs-mode t)
(setq-default tab-width 8)
(setq c-default-style "stroustrup")
(dolist (file command-line-args-left)
(find-file file)
(c-mode)
(setq indent-tabs-mode t
tab-width 8
c-basic-offset 4)
(c-set-offset 'inextern-lang 0)
(indent-region (point-min) (point-max))
(when (buffer-modified-p) (save-buffer))
(kill-buffer))