karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.04k stars 113 forks source link

gptel-default-mode does not detect markdown-mode availability #109

Closed PerMildner closed 8 months ago

PerMildner commented 9 months ago

gptel-default-mode gets set to text-mode for me.

I think what happens is:

(defcustom gptel-default-mode (if (featurep 'markdown-mode)
                               'markdown-mode
                             'text-mode)
...
)

But, since markdown-mode is autoloaded, it is not until you call markdown-mode that its file will be loaded, and not until then is the last line of markdown-mode.el executed:

(provide 'markdown-mode)

so (featurep 'markdown-mode) will be false until markdown-mode is called (and thus markdown-mode.el is loaded).

Possible fix: change (featurep 'markdown-mode) to (fboundp 'markdown-mode).

karthink commented 9 months ago

Fixed in 648fa228, thanks for catching this!

fboundp should work as intended.