emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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/)]
@ 2019-12-20 14:53 Ihor Radchenko
  2020-02-05  6:52 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2019-12-20 14:53 UTC (permalink / raw)
  To: emacs-orgmode



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-08  5:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 14:53 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/)] Ihor Radchenko
2020-02-05  6:52 ` Bastien
2020-04-08  5:30   ` Ihor Radchenko

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).