8000 gptel: Ensure restoring state does not flag the buffer modified by pabl0 · Pull Request #711 · karthink/gptel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gptel: Ensure restoring state does not flag the buffer modified #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

pabl0
Copy link
Contributor
@pabl0 pabl0 commented Mar 16, 2025
  • gptel.el (gptel--restore-props): Save buffer-modified-p before restoring properties and revert it to its original state. This prevents a visited file from being marked as modified until the user actually makes changes. This is particularly useful when multiple files are accessed automatically, such as from the org-agenda-files location (otherwise when exiting Emacs the user is asked about each file if it needs to be saved).

  • gptel-org.el (gptel-org--restore-state): Likewise for Org.

* gptel.el (gptel--restore-props): Save `buffer-modified-p' before
restoring properties and revert it to its original state.  This
prevents a visited file from being marked as modified until the user
actually makes changes.  This is particularly useful when multiple
files are accessed automatically, such as from the `org-agenda-files'
location (otherwise when exiting Emacs the user is asked about each
file if it needs to be saved).

* gptel-org.el (gptel-org--restore-state): Likewise for Org.
@karthink
Copy link
Owner

I can see this creating some edge case issues involving file-locking in the future, but we'll revisit that when it crops up.

Thanks for the PR @pabl0!

@karthink karthink merged commit 2e9adae into karthink:master Mar 17, 2025
@pabl0
Copy link
Contributor Author
pabl0 commented Mar 17, 2025

Of course I just learned about the macro `with-silent-modification' that is the correct way of doing this, I suppose.
It might help with potential locking issues, but have to look into it in more detail.

@karthink
Copy link
Owner
karthink commented Mar 17, 2025 via email

marcbowes pushed a commit to marcbowes/gptel that referenced this pull request Mar 19, 2025
)

* gptel.el (gptel--restore-props): Save `buffer-modified-p' before
restoring properties and revert it to its original state.  This
prevents a visited file from being marked as modified until the user
actually makes changes.  This is particularly useful when multiple
files are accessed automatically, such as from the `org-agenda-files'
location (otherwise when exiting Emacs the user is asked about each
file if it needs to be saved).

* gptel-org.el (gptel-org--restore-state): Likewise for Org.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0