emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug: org-agenda-open-link disallow permanenly changing point position wh


From: Ihor Radchenko
Subject: Bug: org-agenda-open-link disallow permanenly changing point position while opening some links (e.g. elisp:) [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]
Date: Fri, 20 Dec 2019 14:53:03 +0000


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Recipe:

1. emacs -Q
2. Open the following org file


* TODO 1
elisp:end-of-buffer
** TODO 2
blah

3. M-x org-agenda < t
4. Move point to "TODO 1" in agenda
5. C-c C-o yes

Expected behaviour:

The point in the org file moves to the end of the file

Observed behaviour:

The point does not move

The cause of the observed behaviour is the following code in
org-agenda-open-link:

(with-current-buffer buffer
  (setq trg (and (string-match org-link-bracket-re l)
 (match-string 1 l)))
  (if (or (not trg) (string-match org-link-any-re trg))
      (org-with-wide-buffer
       (goto-char marker)
       (when (search-forward l nil lkend)
 (goto-char (match-beginning 0))
 (org-open-at-point)))
    ;; This is an internal link, widen the buffer
    (switch-to-buffer-other-window buffer)
    (widen)
    (goto-char marker)
    (when (search-forward l nil lkend)
      (goto-char (match-beginning 0))
      (org-open-at-point))))

The code opens the link in two ways depending whether the link is
"internal link" or not. If it is not "internal", following the link is
enclosed into save-excursion (from org-with-wide-buffer). Thus, the
moving point does not have any effect when following some links

In my real life scenario, I have a custom link, which executes some
elisp to add a new row in a table from the current item and move the
point to that table. However, there is no way to keep the point position
with the current org-agenda-open-link implementation, unless the
condition for "internal link" is broadened.

Best regards,
Ihor



Emacs  : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.16.0)
 of 2019-12-17
Package: Org mode version 9.3 (release_9.3 @ 
/home/yantar92/.emacs.d/straight/build/org/)
This email may contain confidential and/or proprietary information that is 
exempt from disclosure under applicable law and is intended for receipt and use 
solely by the addressee(s) named above. If you are not the intended recipient, 
you are notified that any use, dissemination, distribution, or copying of this 
email, or any attachment, is strictly prohibited. Please delete the email 
immediately and inform the sender. Thank You



reply via email to

[Prev in Thread] Current Thread [Next in Thread]