On Saturday, February 28, 2026, Ihor Radchenko wrote:
> Christian Barthel <[email protected]> writes:
>
>> Sorry for waiting this long.. I am struggling a bit with
>> git.savannah.gnu.org and the emacs repository. My repo is not
>> pulling newer changes. So, this all is using emacs 30.2. Is
>> there a document that describes how to use the newest org-mode
>> git repo? How am I supposed to set up my emacs and which version
>> should it be (30.2? head?) to follow org-mode head?
>
> org-mode head. See https://orgmode.org/worg/org-contribute.html
Ok, for what its worth, I’ve now configured my emacs with these
settings:
--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path "~/src/git.git.savannah.gnu.org/org-mode.git/lisp/")
(add-to-list 'load-path
"~/src/git.git.savannah.gnu.org/org-mode.git/contrib/lisp/")
(setq load-prefer-newer t)
(require 'org)
(org-version) ; 10-pre
(setq org-id-link-to-org-use-id t)
--8<---------------cut here---------------end--------------->8---
> What I meant is that
>
>>> ;; Store a link using the target at point
>>> ((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1)
>>> (setq link
>>> (concat "file:"
>>> (abbreviate-file-name
>>> (buffer-file-name (buffer-base-buffer)))
>>> "::" (match-string 1))
>>> ;; Target may be shortened when link is inserted.
>>> ;; Avoid [[target][file:~/org/test.org::target]]
>>> ;; links. Maybe the case of identical target and
>>> ;; description should be handled by `org-insert-link'.
>>> desc nil))
>
> is redundant because `org-link--file-link-to-here' calls
> `org-link-precise-link-target', which, after your changes, will be able
> to handle the targets.
Ok, I removed this section after testing a few things.
>
>>> And the final step will be testing. And adding tests to
>>> `test-org-link/precise-link-target' in the git repository.
>>>
>>
>> This is what I figured out so far:
>>
>> --8<---------------cut here---------------start------------->8---
>> (let ((org-id-link-to-org-use-id t))
>> (should
>> (equal '("id:b82baea1-4203-4f97-a52d-6a0534873c92::myanchor" "myanchor")
>> (test-ol-stored-link-with-text "* H1\n:PROPERTIES:\n:ID:
>> b82baea1-4203-4f97-a52d-6a0534873c92\n:END:\n<point><<myanchor>>\n"
>> (org-id-store-link))))
>> )
>> --8<---------------cut here---------------end--------------->8---
>
> Look right.
> Maybe you can test a couple of other edge cases like anchor
> before first heading.
I’ve added a few additional test cases.
Head: main Testing: Add more tests
Merge: origin/main Testing: Add more tests
Tag: release_9.8 (57)
Unstaged changes (2)
modified lisp/ol.el
@@ -1960,9 +1960,14 @@ matches."
((derived-mode-p 'org-mode)
(let* ((element (org-element-at-point))
(name (org-element-property :name element))
+ (context (org-element-context element))
(heading (org-element-lineage element '(headline inlinetask) t))
(custom-id (org-entry-get heading "CUSTOM_ID")))
(cond
+ ((org-element-type-p context 'target)
+ (list (org-element-property :value context)
+ (org-element-property :value context)
+ (org-element-begin context)))
(name
(list name
name
@@ -2653,24 +2658,10 @@ NAME."
;; buffers
((and (buffer-file-name (buffer-base-buffer)) (derived-mode-p 'org-mode))
(org-with-limited-levels
- (cond
- ;; Store a link using the target at point
- ((org-in-regexp "[^<]<<\\([^<>]+\\)>>[^>]" 1)
- (setq link
- (concat "file:"
- (abbreviate-file-name
- (buffer-file-name (buffer-base-buffer)))
- "::" (match-string 1))
- ;; Target may be shortened when link is inserted.
- ;; Avoid [[target][file:~/org/test.org::target]]
- ;; links. Maybe the case of identical target and
- ;; description should be handled by `org-insert-link'.
- desc nil))
- (t
;; Just link to current headline.
(let ((here (org-link--file-link-to-here)))
(setq link (car here))
- (setq desc (cdr here)))))))
+ (setq desc (cdr here)))))
;; Buffer linked to file, but not an org-mode buffer.
((buffer-file-name (buffer-base-buffer))
modified testing/lisp/test-ol.el
@@ -411,6 +411,30 @@ See https://github.com/yantar92/org/issues/4."
(ert-deftest test-org-link/id-store-link ()
"Test `org-id-store-link' specifications."
+ (let ((org-id-link-to-org-use-id t))
+ (should
+ (equal '("id:b82baea1-4203-4f97-a52d-6a0534873c92::myanchor" "myanchor")
+ (test-ol-stored-link-with-text "* H1\n:PROPERTIES:\n:ID: b82baea1-4203-4f97-a52d-6a0534873c92\n:END:\n<point><<myanchor>>\n"
+ (org-id-store-link))))
+ )
+ (let ((org-id-link-to-org-use-id t))
+ (should
+ (equal '("id:b82baea1-4203-4f97-a52d-6a0534873c92" "H1")
+ (test-ol-stored-link-with-text "<point>* H1\n:PROPERTIES:\n:ID: b82baea1-4203-4f97-a52d-6a0534873c92\n:END:\n<<myanchor>>\n"
+ (org-id-store-link))))
+ )
+ (let ((org-id-link-to-org-use-id t))
+ (should
+ (equal '("id:b82baea1-5555-4f97-a52d-6a0534873c92" "H1")
+ (test-ol-stored-link-with-text "* H1\n:PROPERTIES:\n:ID: b82baea1-5555-4f97-a52d-6a0534873c92\n:END:\n<<myanchor>>\n<point>"
+ (org-id-store-link))))
+ )
+ (let ((org-id-link-to-org-use-id nil))
+ (should
+ (equal '("id:b82baea1-4203-4f97-a52d-6a0534873caa::myanchor" "myanchor")
+ (test-ol-stored-link-with-text "* H1\n:PROPERTIES:\n:ID: b82baea1-4203-4f97-a52d-6a0534873caa\n:END:\n<point><<myanchor>>\n"
+ (org-id-store-link))))
+ )
(let ((org-id-link-to-org-use-id nil))
(should
(equal '(nil nil)
Recent commits
13b241855 main origin/main Testing: Add more tests
8b9c9962a Testing: Refactor some tests
2815dd543 ob-tangle.el: Support tangling a source block to multiple targets
e1ef98202 testing/README: Document that tests should encode expected behavior
1025e3b49 Merge branch 'bugfix'
cf141e8a0 origin/bugfix org-timer-set-timer: Fix when called from org-agenda on entry without EFFORT
1ca4804a8 Merge branch 'bugfix'
e2ef50603 org-assert-version: Add another suggestion how to fix version mismatch
90e8d8b04 org-export-async-start: Fix when Org file has local variable footer
e00259667 org-export-async-start: Fix when running from emacs -Q
Thanks for your help and your time. Is this going somewhere near
"commitable"?
--
Christian Barthel