Function: so-long--change-major-mode
so-long--change-major-mode is a byte-compiled function defined in
so-long.el.gz.
Signature
(so-long--change-major-mode)
Documentation
Ensure that so-long-mode knows the original major-mode.
This advice acts before so-long-mode, with the previous mode still active.
Source Code
;; Defined in /usr/src/emacs/lisp/so-long.el.gz
(defun so-long--change-major-mode ()
;; Advice, enabled with:
;; (advice-add 'so-long-mode :before #'so-long--change-major-mode)
;;
;; n.b. `major-mode-suspend' and `major-mode-restore' are new in Emacs 27, and
;; related to what we're doing here; but it's not worth going to the effort of
;; using those (conditionally, only for 27+) when we have our own framework
;; for remembering and restoring this buffer state (amongst other things).
"Ensure that `so-long-mode' knows the original `major-mode'.
This advice acts before `so-long-mode', with the previous mode still active."
(unless (derived-mode-p 'so-long-mode)
;; Housekeeping. `so-long-mode' might be invoked directly rather than
;; via `so-long', so replicate the necessary behaviors.
(unless so-long--calling
(so-long-remember-all :reset))
;; Remember the original major mode, regardless.
(so-long-remember 'major-mode)))