8000 Updates required Org version notice from 9.6.7 to 9.7 by grettke · Pull Request #602 · karthink/gptel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Updates required Org version notice from 9.6.7 to 9.7 #602

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
Feb 1, 2025

Conversation

grettke
Copy link
Contributor
@grettke grettke commented Feb 1, 2025

This explains that gptel needs Org version 9.7+ so this patch updates the notice for the user.

@karthink
Copy link
Owner
karthink commented Feb 1, 2025

@grettke I think the exact Org commit we need is from before 9.7, but it has been a real pain to track down the nearest version. So let's just go with 9.7.

@karthink karthink merged commit 6dcccc6 into karthink:master Feb 1, 2025
@karthink
Copy link
Owner
karthink commented Feb 1, 2025

Thanks for the PR!

@grettke
Copy link
Contributor Author
grettke commented Feb 1, 2025

@karthink Here was my research and thought process behind this pull request:

In the org-mode main branch org-element-lineage-map gets added in this commit 6333a20aa5b3b69dd8c883ee51b28ff24a0f06cf on 2023-05-16.

git show 6333a20aa5b3b69dd8c883ee51b28ff24a0f06cf

commit 6333a20aa5b3b69dd8c883ee51b28ff24a0f06cf
Author: Ihor Radchenko <yantar92@posteo.net>
Date:   Tue May 16 13:32:40 2023 +0200

    org-element-ast: New function `org-element-lineage-map'

diff --git a/lisp/org-element-ast.el b/lisp/org-element-ast.el
index 6a3ae5e43..a98e879c1 100644
--- a/lisp/org-
8000
element-ast.el
+++ b/lisp/org-element-ast.el
@@ -1018,6 +1018,40 @@ when DATUM belongs to a full parse tree."
       (setq up (org-element-property :parent up)))
     (if types up (nreverse ancestors))))
 
+(defun org-element-lineage-map (datum fun &optional types with-self first-match)
+  "Map FUN across ancestors of DATUM, from closest to furthest.
+Return a list of results.  Nil values returned from FUN do not appear
+in the results.

Here is a list of the tags and the date ranges under our concern that I manually pruned:

git log --tags --simplify-by-decoration --pretty="format:%ai %d"

2024-06-01 10:59:57 +0200  (tag: release_9.7)
2024-05-10 10:30:48 +0300  (tag: release_9.6.30)
2023-12-31 12:58:57 +0100  (tag: release_9.6.15

Checking for the org-element-lineage-map function in 9.6.15 with rg (ripgrep)

cd ~/tmp
rm -rf org-mode
git clone https://git.savannah.gnu.org/git/emacs/org-mode.git
cd org-mode
git fetch && git fetch --tags
git checkout release_9.6.15 -b local_9.6.15
make autoloads
rg org-element-lineage-map

Produces no results: the function isn't in there.

Follow the same process for release_9.7 and it yields the results explaining, as you noted in the other ticket, that org-element-lineage-map is officially released.

etc/ORG-NEWS
416:**** New function ~org-element-lineage-map~

lisp/org-element-ast.el
964:(defun org-element-lineage-map (datum fun &optional types with-self first-match)

lisp/org.el
182:(declare-function org-element-lineage-map "org-element-ast"
13166:    (org-element-lineage-map
21307:          (org-element-lineage-map

lisp/ox-ascii.el
634:  (or (org-element-lineage-map

testing/lisp/test-org-element.el
4874:  "Test `org-element-lineage-map' specifications."
4879:	    (org-element-lineage-map (org-element-context) #'org-element-type))))
4885:	    (org-element-lineage-map (org-element-context) #'org-element-type nil t))))
4891:	    (org-element-lineage-map
4899:	    (org-element-lineage-map

Based on this I observed that

  • All stable release Emacs v29.4-1 users are on Org v9.6.15 from 2023-12-31 because they come with Emacs
  • org-element-lineage-map gets added on 2023-05-16 so stable Emacs v29 user will not have it
  • Org v9.7 definitely has the function
  • The next stable release of Emacs v30 will contain Org v9.7 and org-element-lineage-map
  • User running Org from source (via Git or MELPA for example) are already using Org v9.7 so they have the function.

Therefore it is justified to bump up the version notice because

  • Stable Emacs users, who run Org from the Emacs distribution, can never use this feature, so it is better to announce it
  • Unstable Emacs users, or Stable users who run Org via Git will never get this warning, because they are on Org current
  • We don't have to track down the release in which this feature was added because the two previous conclusions negate the need to do so

Consequently this pull request makes the version change required to gracefully handle users on Emacs stable and built in Org Stable, Emacs Stable and Org Current, Emacs Unstable with Org-Unstable built in, Emacs Unstable with Org Unstable.

It is graceful of course because you already handled it gracefully! :)

@grettke
Copy link
Contributor Author
grettke commented Feb 1, 2025

@karthink Here is how I found the commit.

Approach 1 searches the commit message which is helpful

git log --oneline --regexp-ignore-case --grep='org-element-lineage-map'

produces

69383dfc2 org-ascii--current-justification: Use `org-element-lineage-map'
6333a20aa org-element-ast: New function `org-element-lineage-map'

Approach 2 is guaranteed however

git log --pickaxe-all --pickaxe-regex -S'org-element-lineage-map'

It has a lot of results so some digging may be required.

@grettke
Copy link
Contributor Author
grettke commented Feb 1, 2025

@karthink Since you threw down the gauntlet 🤣 for me to check if it was in a release before v9.7, it looks like it was not.

grant@donutron:~/ghb/org-mode> git --no-pager diff release_9.6.16..release_9.6.30 | grep 'org-element-lineage-map'
OK...

grant@donutron:~/ghb/org-mode> git --no-pager diff release_9.6.16..release_9.7 | grep 'org-element-lineage-map'
OK...

+**** New function ~org-element-lineage-map~
+(defun org-element-lineage-map (datum fun &optional types with-self first-match)
+(declare-function org-element-lineage-map "org-element-ast"
+    (org-element-lineage-map
+          (org-element-lineage-map
+  (or (org-element-lineage-map
+  "Test `org-element-lineage-map' specifications."
+	    (org-element-lineage-map (org-element-context) #'org-element-type))))
+	    (org-element-lineage-map (org-element-context) #'org-element-type nil t))))
+	    (org-element-lineage-map
+	    (org-element-lineage-map

marcbowes pushed a commit to marcbowes/gptel that referenced this pull request Mar 19, 2025
gptel-org (gptel-org--create-prompt): Update message about
required Org version for branching context.

README: Update Org requirement for this feature (only).
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