Function: conf--guess-mode
conf--guess-mode is a byte-compiled function defined in
conf-mode.el.gz.
Signature
(conf--guess-mode)
Documentation
Try to guess sub-mode of conf-mode based on buffer content.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/conf-mode.el.gz
(defun conf--guess-mode ()
"Try to guess sub-mode of `conf-mode' based on buffer content."
(let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(skip-chars-forward " \t\f")
(cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
((eq (char-after) ?\;) (setq win (1+ win)))
((eq (char-after) ?\[)) ; nop
((eolp)) ; nop
((eq (char-after) ?})) ; nop
;; recognize at most double spaces within names
((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]")
(if (eq (char-before (match-end 0)) ?=)
(setq equal (1+ equal))
(setq colon (1+ colon))))
((looking-at "/[/*]") (setq jp (1+ jp)))
((looking-at ".*{")) ; nop
((setq space (1+ space))))
(forward-line)))
(cond
((> jp (max unix win 3)) #'conf-javaprop-mode)
((> colon (max equal space)) #'conf-colon-mode)
((> space (max equal colon)) #'conf-space-mode)
((or (> win unix) (and (= win unix) (eq system-type 'windows-nt)))
#'conf-windows-mode)
(t #'conf-unix-mode))))