From 1241224f30e09135c979e687efc5a8b01f6f6dd0 Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Fri, 15 Mar 2024 15:12:07 -0700 Subject: [PATCH] gptel-transient: Rename additional-directive functions * gptel-transient.el (gptel--get-directive, gptel--infix-add-directive, gptel-menu): Rename the directive-related functions to be shorter/more consistent with the rest of the code. gptel--additional-directive -> gptel--infix-add-directive gptel--additional-directive-get -> gptel--get-directive --- gptel-transient.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gptel-transient.el b/gptel-transient.el index 613b122..379f00a 100644 --- a/gptel-transient.el +++ b/gptel-transient.el @@ -124,7 +124,7 @@ which see." ["" "Instructions" ("s" "Set system message" gptel-system-prompt :transient t) - (gptel--additional-directive :if (lambda () gptel-expert-commands))]] + (gptel--infix-add-directive :if (lambda () gptel-expert-commands))]] [["Model Parameters" (gptel--infix-provider) ;; (gptel--infix-model) @@ -185,7 +185,7 @@ which see." (lambda () "Inspect the query that will be sent as a lisp object." (interactive) - (let* ((extra (gptel--additional-directive-get + (let* ((extra (gptel--get-directive (transient-args transient-current-command))) (gptel--system-message @@ -196,7 +196,7 @@ which see." (lambda () "Inspect the query that will be sent as a JSON object." (interactive) - (let* ((extra (gptel--additional-directive-get + (let* ((extra (gptel--get-directive (transient-args transient-current-command))) (gptel--system-message @@ -476,7 +476,7 @@ Also format its value in the Transient menu." (concat "(" (symbol-name (oref obj display-nil)) ")") 'face 'transient-inactive-value)))) -(transient-define-infix gptel--additional-directive () +(transient-define-infix gptel--infix-add-directive () "Additional directive intended for the next query only. This is useful to define a quick task on top of a more extensive @@ -506,7 +506,7 @@ Or in an extended conversation: :description "Add directive" :transient t) -(defun gptel--additional-directive-get (args) +(defun gptel--get-directive (args) "Find the additional directive in the transient ARGS of this command." (cl-some (lambda (s) (and (string-prefix-p ":" s) (concat "\n\n" (substring s 1)))) @@ -545,7 +545,7 @@ Or in an extended conversation: (backend-name (gptel-backend-name gptel-backend)) (buffer) (position) (callback) (gptel-buffer-name) - (system-extra (gptel--additional-directive-get args)) + (system-extra (gptel--get-directive args)) ;; Input redirection: grab prompt from elsewhere? (prompt (cond