emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <ihor_radchenko@alumni.sutd.edu.sg>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <87woart5ih.fsf@gmail.com> (raw)



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	other threads:[~2019-12-20 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 14:53 Ihor Radchenko [this message]
2020-02-05  6:52 ` 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/)] Bastien
2020-04-08  5:30   ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87woart5ih.fsf@gmail.com \
    --to=ihor_radchenko@alumni.sutd.edu.sg \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).