Variable: c-require-final-newline
c-require-final-newline is a customizable variable defined in
cc-vars.el.gz.
Value
((c-mode . t) (c++-mode . t) (objc-mode . t))
Documentation
Controls whether a final newline is ensured when the file is saved.
The value is an association list that for each language mode specifies
the value to give to require-final-newline at mode initialization;
see that variable for details about the value. If a language isn't
present on the association list, CC Mode won't touch
require-final-newline in buffers for that language.
Probably introduced at or before Emacs version 22.1.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-vars.el.gz
(defcustom c-require-final-newline
;; C and C++ mandate that all nonempty files should end with a
;; newline. Objective-C refers to C for all things it doesn't
;; specify, so the same holds there. The other languages do not
;; require it (at least not explicitly in a normative text).
'((c-mode . t)
(c++-mode . t)
(objc-mode . t))
"Controls whether a final newline is ensured when the file is saved.
The value is an association list that for each language mode specifies
the value to give to `require-final-newline' at mode initialization;
see that variable for details about the value. If a language isn't
present on the association list, CC Mode won't touch
`require-final-newline' in buffers for that language."
:type `(set (cons :format "%v"
(const :format "C " c-mode)
(symbol :format "%v" :value ,require-final-newline))
(cons :format "%v"
(const :format "C++ " c++-mode)
(symbol :format "%v" :value ,require-final-newline))
(cons :format "%v"
(const :format "ObjC " objc-mode)
(symbol :format "%v" :value ,require-final-newline))
(cons :format "%v"
(const :format "Java " java-mode)
(symbol :format "%v" :value ,require-final-newline))
(cons :format "%v"
(const :format "IDL " idl-mode)
(symbol :format "%v" :value ,require-final-newline))
(cons :format "%v"
(const :format "Pike " pike-mode)
(symbol :format "%v" :value ,require-final-newline))
(cons :format "%v"
(const :format "AWK " awk-mode)
(symbol :format "%v" :value ,require-final-newline)))
:group 'c)