diff --git a/README.org b/README.org index b54ca7b..09d23f1 100644 --- a/README.org +++ b/README.org @@ -296,9 +296,9 @@ Disabled for now, as it's causing some issues. Opens a file into an inactive (background) buffer for processing. #+begin_src elisp (defun gptel-org-tools--open-file-inactive (file) - "Open FILE in a buffer." - (with-current-buffer (get-buffer-create file) - (current-buffer))) + "Open FILE in a background buffer without modifying its contents." + (find-file-noselect file) + (set-buffer-modified-p nil)) (add-to-list 'gptel-org-tools (gptel-make-tool diff --git a/gptel-org-tools.el b/gptel-org-tools.el index eb4bc01..7b69f4e 100644 --- a/gptel-org-tools.el +++ b/gptel-org-tools.el @@ -106,9 +106,9 @@ :category "filesystem")) (defun gptel-org-tools--open-file-inactive (file) - "Open FILE in a buffer." - (with-current-buffer (get-buffer-create file) - (current-buffer))) + "Open FILE in a background buffer without modifying its contents." + (find-file-noselect file) + (set-buffer-modified-p nil)) (add-to-list 'gptel-org-tools (gptel-make-tool