Function: hypb:file-major-mode

hypb:file-major-mode is a byte-compiled function defined in hypb.el.

Signature

(hypb:file-major-mode FILE)

Documentation

Return the major mode used by FILE.

FILE is temporarily read into a buffer to determine the major mode if necessary.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hypb.el
(defun hypb:file-major-mode (file)
  "Return the major mode used by FILE.
FILE is temporarily read into a buffer to determine the major mode if necessary."
  (let ((existing-flag (get-file-buffer file))
	(buf (find-file-noselect file)))
    (prog1 (when buf (save-excursion (with-current-buffer buf
				       major-mode)))
      (unless (or existing-flag (null buf))
	(kill-buffer buf)))))