Function: editorconfig-conf-mode

editorconfig-conf-mode is an autoloaded, interactive and byte-compiled function defined in editorconfig-conf-mode.el.gz.

Signature

(editorconfig-conf-mode)

Documentation

Major mode for editing .editorconfig files.

In addition to any hooks its parent mode conf-unix-mode might have run, this mode runs the hook editorconfig-conf-mode-hook, as the final or penultimate step during initialization.

Probably introduced at or before Emacs version 30.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/editorconfig-conf-mode.el.gz
;;;###autoload
(define-derived-mode editorconfig-conf-mode conf-unix-mode "Conf[EditorConfig]"
  "Major mode for editing .editorconfig files."
  (set-variable 'indent-line-function 'indent-relative)
  (let ((key-property-list
         '("charset"
           "end_of_line"
           "file_type_emacs"
           "file_type_ext"
           "indent_size"
           "indent_style"
           "insert_final_newline"
           "max_line_length"
           "root"
           "tab_width"
           "trim_trailing_whitespace"))
        (key-value-list
         '("unset"
           "true"
           "false"
           "lf"
           "cr"
           "crlf"
           "space"
           "tab"
           "latin1"
           "utf-8"
           "utf-8-bom"
           "utf-16be"
           "utf-16le"))
        (font-lock-value
         '(("^[ \t]*\\[\\(.+?\\)\\]" 1 font-lock-type-face)
           ("^[ \t]*\\(.+?\\)[ \t]*[=:]" 1 font-lock-variable-name-face))))

    ;; Highlight all key values
    (dolist (key-value key-value-list)
      (push `(,(format "[=:][ \t]*\\(%s\\)\\([ \t]\\|$\\)" key-value)
              1 font-lock-constant-face)
            font-lock-value))
    ;; Highlight all key properties
    (dolist (key-property key-property-list)
      (push `(,(format "^[ \t]*\\(%s\\)[ \t]*[=:]" key-property)
              1 font-lock-builtin-face)
            font-lock-value))

    (conf-mode-initialize "#" font-lock-value)))