From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <87woart5ih.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52615) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiJeV-0005XI-Lc for emacs-orgmode@gnu.org; Fri, 20 Dec 2019 09:53:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiJeT-0000wP-UX for emacs-orgmode@gnu.org; Fri, 20 Dec 2019 09:53:15 -0500 Received: from mail-eopbgr1300138.outbound.protection.outlook.com ([40.107.130.138]:46143 helo=APC01-HK2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iiJeS-0000MP-M7 for emacs-orgmode@gnu.org; Fri, 20 Dec 2019 09:53:13 -0500 Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "emacs-orgmode@gnu.org" 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/straig= ht/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 re= cipient, you are notified that any use, dissemination, distribution, or cop= ying of this email, or any attachment, is strictly prohibited. Please delet= e the email immediately and inform the sender. Thank You