Function: gptel--strip-mode-suffix
gptel--strip-mode-suffix is a natively compiled function defined in
gptel-request.el.
Signature
(gptel--strip-mode-suffix MODE-SYM)
Documentation
Remove the -mode suffix from MODE-SYM.
MODE-SYM is typically a major-mode symbol.
Source Code
;; Defined in /nix/store/q3r7g81pvghw7a523kjk2k2zih3pfk8z-emacs-packages-deps/share/emacs/site-lisp/elpa/gptel-20261002.545/gptel-request.el
(defun gptel--strip-mode-suffix (mode-sym)
"Remove the -mode suffix from MODE-SYM.
MODE-SYM is typically a major-mode symbol."
(or (alist-get mode-sym gptel--mode-description-alist)
(let ((mode-name (thread-last
(symbol-name mode-sym)
(string-remove-suffix "-mode")
(string-remove-suffix "-ts"))))
;; NOTE: The advertised calling convention of provided-mode-derived-p
;; has changed in Emacs 30, this needs to be updated eventually
(if (provided-mode-derived-p
mode-sym 'prog-mode 'text-mode 'tex-mode)
mode-name ""))))