Open JosephFerano opened 5 months ago
@JosephFerano there is already a save-excursion around this process in the code. org-with-wide-buffer
expands to save-excursion
+ save-restriction
.
I'm not able to reproduce this in my regular Emacs, but can reproduce it with emacs -Q
, which is really strange.
save-excursion
is not being respected.emacs -Q
is using Org 9.6, perhaps Org changed something in the meantime.I'll try to find the issue. If you have any ideas please let me know.
Shortly after I typed out the previous comment, I tested it some more, and I can no longer reproduce the bug with emacs -Q
. I haven't changed the code at all.
Very strange.
EDIT: I was only able to reproduce it once in 10+ tries with emacs -Q
(starting a new session each time), and not reproduce it at all with my Emacs config.
@karthink Thank you for taking a look at this, if there's anything I can do on my end to help with the repro let me know. Here are my emacs and org versions if it helps (I compiled emacs myself)
GNU Emacs 29.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-11-05
Org mode version 9.6.10 (release_9.6.10 @ /usr/local/share/emacs/29.1.90/lisp/org/)
P.S. I also have a small issue with org src blocks where the highlighting isn't being activated when I get an answer back. I have to manipulate the text for the src block in order for org-mode to highlight it. Is this something I should open a separate issue for?
P.S. I also have a small issue with org src blocks where the highlighting isn't being activated when I get an answer back. I have to manipulate the text for the src block in order for org-mode to highlight it. Is this something I should open a separate issue for?
I can't reproduce this either (with my config or emacs -Q
). Could be something specific to your jit-lock , font-lock or Org settings. You should be able to force fontification with
(add-hook 'gptel-post-response-functions #'font-lock-ensure)
If that doesn't work, please create a separate issue.
I am also experiencing the exact same thing happening on a Doom Emacs install with a clean config that only sets up gpt.el. Issue occurs each time I open an org file with gptel-mode, and it doesn't happen at all when a Markdown file is used instead.
GNU Emacs 29.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-08-06
Org mode version 9.6.9 (9.6.9-??-806abc5 @ /home/james/.emacs.d/.local/straight/build-29.1.50/org/)
I'm still trying to figure out what's causing this, as I can't seem to reproduce it.
If it's happening in your Org buffer(s) right now, could you do the following?
M-x find-function
gptel--save-state
, and manually evaluate this function with C-M-x
or equivalent.I'm interested to know if that changes anything. I suspect a byte-compilation issue.
Going through those exact steps fixes the issue. I am able to save the buffer and it doesn't jump. It is odd indeed. What do you suggest as a temporary workaround?
@JosephFerano I've made some changes to the save-state feature in the feature-org
branch. (It also has some new org-specific gptel features that you may find useful.)
if you have the time, could you try switching to this branch and testing if the problem still persists?
Hello, thank you for the great package.
I think this has to do with the fact that gptel is writing to the properties section at the top
It's noticeable for me because I'm using evil-mode and I have it bound such that when leaving insert mode, I autosave. So while I'm writing my prompts and going back and forth between normal/insert, I keep jumping back to the top. I tried this with
emacs -Q
and I get the same behavior. Could awith-excursion
fix this?