Function: treemacs--mode-check-advice
treemacs--mode-check-advice is a byte-compiled function defined in
treemacs-mode.el.
Signature
(treemacs--mode-check-advice MODE-ACTIVATION &rest ARGS)
Documentation
Verify that treemacs-mode is called in the right place.
Must be run as advice to prevent changing of the major mode.
Will run original MODE-ACTIVATION and its ARGS only when
treemacs--in-this-buffer is non-nil.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-mode.el
(defun treemacs--mode-check-advice (mode-activation &rest args)
"Verify that `treemacs-mode' is called in the right place.
Must be run as advice to prevent changing of the major mode.
Will run original MODE-ACTIVATION and its ARGS only when
`treemacs--in-this-buffer' is non-nil."
(cond
(treemacs--in-this-buffer
(apply mode-activation args))
((eq major-mode 'treemacs-mode)
(ignore "Reactivating the major-mode resets buffer-local variables."))
(t
(switch-to-buffer (get-buffer-create "*Clippy*"))
(erase-buffer)
(insert
(format
"
--------------------------------------------------------------------------------------
| It looks like you are trying to run treemacs. Would you like some help with that? |
| You have called %s, but that is just the major mode for treemacs' |
| buffers, it is not meant to be used manually. |
| |
| Instead you should call a function like |
| * %s, |
| * %s, or |
| * %s |
| |
| You can safely delete this buffer. |
--------------------------------------------------------------------------------------
%s
"
(propertize "treemacs-mode" 'face 'font-lock-function-name-face)
(propertize "treemacs" 'face 'font-lock-function-name-face)
(propertize "treemacs-select-window" 'face 'font-lock-function-name-face)
(propertize "treemacs-add-and-display-current-project" 'face 'font-lock-function-name-face)
(propertize
"\
\\
\\
____
/ \\
| |
@ @
| |
|| |/
|| ||
|\\_/|
\\___/" 'face 'font-lock-keyword-face))))))