Function: hyrolo--cache-major-mode
hyrolo--cache-major-mode is a byte-compiled function defined in
hyrolo.el.
Signature
(hyrolo--cache-major-mode SRC-BUF)
Documentation
Cache buffer major-mode for SRC-BUF with point in HyRolo display buffer.
SRC-BUF must be a live buffer, not a buffer name.
Push (point-max) of hyrolo-display-buffer onto
hyrolo--cache-loc-match-bounds. Push hash table's index key to
hyrolo--cache-major-mode-indexes. Ensure SRC-BUF's
major-mode is stored in the hash table.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hyrolo.el
(defun hyrolo--cache-major-mode (src-buf)
"Cache buffer `major-mode' for SRC-BUF with point in HyRolo display buffer.
SRC-BUF must be a live buffer, not a buffer name.
Push (point-max) of `hyrolo-display-buffer' onto
`hyrolo--cache-loc-match-bounds'. Push hash table's index key to
`hyrolo--cache-major-mode-indexes'. Ensure SRC-BUF's
`major-mode' is stored in the hash table."
(with-current-buffer hyrolo-display-buffer
(unless (hash-table-p hyrolo--cache-major-mode-to-index-hasht)
(hyrolo--cache-initialize))
(let* ((src-buf-file-name (buffer-local-value 'buffer-file-name src-buf))
(src-buf-major-mode (or (hyrolo-major-mode-from-file-name src-buf-file-name)
(buffer-local-value 'major-mode src-buf)))
(src-buf-major-mode-name (symbol-name src-buf-major-mode))
(src-buf-major-mode-index
(gethash src-buf-major-mode-name hyrolo--cache-major-mode-to-index-hasht)))
(push (point-max) hyrolo--cache-loc-match-bounds)
(push (or src-buf-major-mode-index hyrolo--cache-major-mode-index) hyrolo--cache-major-mode-indexes)
(unless src-buf-major-mode-index
(puthash src-buf-major-mode-name
hyrolo--cache-major-mode-index hyrolo--cache-major-mode-to-index-hasht)
(puthash hyrolo--cache-major-mode-index src-buf-major-mode hyrolo--cache-index-to-major-mode-hasht)
(setq-local hyrolo--cache-major-mode-index (1+ hyrolo--cache-major-mode-index))))))