Function: hs--set-variable

hs--set-variable is a byte-compiled function defined in hideshow.el.gz.

Signature

(hs--set-variable VAR NTH &optional DEFAULT)

Documentation

Set Hideshow VAR if already not set.

This function is meant to be used for backward compatibility with hs-special-modes-alist.

NTH must be a number indicating NTH element of hs-special-modes-alist or a function.

DEFAULT is a value to use as fallback.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideshow.el.gz
(defun hs--set-variable (var nth &optional default)
  "Set Hideshow VAR if already not set.
This function is meant to be used for backward compatibility with
`hs-special-modes-alist'.

NTH must be a number indicating NTH element of
`hs-special-modes-alist' or a function.

DEFAULT is a value to use as fallback."
  (unless (local-variable-p var) ; Already set, nothing to do.
    (if-let* ((old-lookup (assoc major-mode hs-special-modes-alist))
              (val (if (integerp nth)
                       (nth nth old-lookup)
                     (funcall nth old-lookup))))
        (set (make-local-variable var) val)
      (when default
        (set (make-local-variable var) default)))))