emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gptel ed0bfc9ed1 116/273: gptel: Offer suggestion when set


From: ELPA Syncer
Subject: [nongnu] elpa/gptel ed0bfc9ed1 116/273: gptel: Offer suggestion when setting gptel-topic
Date: Wed, 1 May 2024 10:02:10 -0400 (EDT)

branch: elpa/gptel
commit ed0bfc9ed122b2b64ed8d311a391749ac1926df5
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>

    gptel: Offer suggestion when setting gptel-topic
    
    gptel.el (gptel-set-topic): Offer a suggestion when setting a GPTEL_TOPIC
    property for an Org heading.
    
    Fix linting in docstring.
---
 gptel.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gptel.el b/gptel.el
index 3285ebd5e2..287e64ecb0 100644
--- a/gptel.el
+++ b/gptel.el
@@ -66,6 +66,7 @@
 (declare-function org-property-values "org")
 (declare-function org-open-line "org")
 (declare-function org-at-heading-p "org")
+(declare-function org-get-heading "org")
 
 (eval-when-compile
   (require 'subr-x)
@@ -110,7 +111,7 @@ This option is ignored unless Curl is in use (see 
`gptel-use-curl').
 When set to nil, Emacs waits for the full response and inserts it
 all at once. This wait is asynchronous.
 
-'tis a bit silly."
+\='tis a bit silly."
   :group 'gptel
   :type 'boolean)
 (make-obsolete-variable 'gptel-playback 'gptel-stream "0.3.0")
@@ -648,7 +649,14 @@ current heading and the cursor position."
      (org-set-property
       "GPTEL_TOPIC"
       (completing-read "Set topic as: "
-                       (org-property-values "GPTEL_TOPIC"))))
+                       (org-property-values "GPTEL_TOPIC")
+                       nil nil (downcase
+                                (truncate-string-to-width
+                                 (substring-no-properties
+                                  (replace-regexp-in-string
+                                   "\\s-+" "-"
+                                   (org-get-heading)))
+                                 50)))))
     ('markdown-mode
      (message
       "Support for multiple topics per buffer is not implemented for 
`markdown-mode'."))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]