gptel: Fix header-line-format update
* gptel.el (gptel--update-header-line): Only fix the `header-line-format' when in gptel-mode.
This commit is contained in:
parent
d77c8f37c5
commit
936c27e28b
1 changed files with 7 additions and 7 deletions
14
gptel.el
14
gptel.el
|
@ -215,13 +215,6 @@ By default, \"openai.com\" is used as HOST and \"apikey\" as USER."
|
||||||
((pred functionp) (funcall gptel-api-key))
|
((pred functionp) (funcall gptel-api-key))
|
||||||
(_ (error "`gptel-api-key' is not set"))))
|
(_ (error "`gptel-api-key' is not set"))))
|
||||||
|
|
||||||
(defun gptel--update-header-line (msg face)
|
|
||||||
"Update header line with status MSG in FACE."
|
|
||||||
(and header-line-format
|
|
||||||
(setf (nth 1 header-line-format)
|
|
||||||
(propertize msg 'face face))
|
|
||||||
(force-mode-line-update)))
|
|
||||||
|
|
||||||
(defsubst gptel--numberize (val)
|
(defsubst gptel--numberize (val)
|
||||||
"Ensure VAL is a number."
|
"Ensure VAL is a number."
|
||||||
(if (stringp val) (string-to-number val) val))
|
(if (stringp val) (string-to-number val) val))
|
||||||
|
@ -268,6 +261,13 @@ By default, \"openai.com\" is used as HOST and \"apikey\" as USER."
|
||||||
'help-echo "OpenAI GPT model in use"))))))
|
'help-echo "OpenAI GPT model in use"))))))
|
||||||
(setq header-line-format gptel--old-header-line)))
|
(setq header-line-format gptel--old-header-line)))
|
||||||
|
|
||||||
|
(defun gptel--update-header-line (msg face)
|
||||||
|
"Update header line with status MSG in FACE."
|
||||||
|
(and gptel-mode (consp header-line-format)
|
||||||
|
(setf (nth 1 header-line-format)
|
||||||
|
(propertize msg 'face face))
|
||||||
|
(force-mode-line-update)))
|
||||||
|
|
||||||
;; TODO: Handle read-only buffers. Should we spawn a new buffer automatically?
|
;; TODO: Handle read-only buffers. Should we spawn a new buffer automatically?
|
||||||
;; TODO: Handle multiple requests(#15). (Only one request from one buffer at a time?)
|
;; TODO: Handle multiple requests(#15). (Only one request from one buffer at a time?)
|
||||||
;; TODO: Since we capture a marker for the insertion location, `gptel-buffer' no
|
;; TODO: Since we capture a marker for the insertion location, `gptel-buffer' no
|
||||||
|
|
Loading…
Add table
Reference in a new issue