emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]
@ 2024-01-20 19:44 Omar Antolín Camarena
  2024-01-21 12:18 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Omar Antolín Camarena @ 2024-01-20 19:44 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.
------------------------------------------------------------------------

If you have an org link with a newline embedded in the description in an org-mode buffer and put point on it, org-open-at-point correctly follows the link but org-open-at-point-global does not, it instead reports "No link found". (I have plenty of org links with newlines in the description, because org-fill-paragraph tends to reformat links that way.)

I understand that it is reasonable for org-open-at-point-global's regexp-based approach to only look for single-line links and am not suggesting this be changed for non-org-mode buffers, but I would like to suggest that org-open-at-point-global check to see if it is being run in an Org mode buffer and if so just call org-open-at-point. That way users can bind org-open-at-point-global and use that key binding everywhere including org-mode buffers without loss of functionality compared to org-open-at-point.


Emacs  : GNU Emacs 29.1 (build 1, arm-unknown-linux-gnueabihf, GTK+ Version 3.24.37, cairo version 1.16.0)
 of 2023-10-02, modified by Debian
Package: Org mode version 9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)

current state:
==============
(setq
 org-agenda-start-on-weekday nil
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-directory "~/Notes"
 org-refile-allow-creating-parent-nodes 'confirm
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
                  org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-modern-mode-hook '(org-modern-mode-set-explicitly)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-special-ctrl-a/e t
 org-pretty-entities t
 org-agenda-loop-over-headlines-in-active-region nil
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link)
                       ("eww" :follow org-eww-open :store org-eww-store-link)
                       ("rmail" :follow org-rmail-open :store org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export)
                       ("info" :follow org-info-open :export org-info-export :store org-info-store-link :insert-description
                        org-info-description-as-command)
                       ("gnus" :follow org-gnus-open :store org-gnus-store-link)
                       ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store
                        org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export)
                       ("arXiv" :face org-link :follow
                        (closure
                         ((arxiv-url-format . "https://arxiv.org/abs/%s") (arxiv-regexp . "^\\(.*?\\)\\(?:/\\(.*\\)\\)?$"))
                         (path)
                         (if (string-match arxiv-regexp path)
                          (progn (browse-url (format arxiv-url-format (match-string 1 path)))))
                         )
                        :export
                        (closure
                         ((title-format-2 . "arXiv:%s [%s]") (title-format-1 . "arXiv:%s")
                          (url-format . "https://arxiv.org/abs/%s") (path-regexp . "^\\(.*?\\)\\(?:/\\(.*\\)\\)?$"))
                         (path description backend)
                         (if (and (memq backend '(latex html)) (string-match path-regexp path))
                          (progn
                           (format
                            (cond ((memq backend '(beamer latex)) (let nil "\\href{%s}{%s}"))
                             ((eq backend 'html) (let nil "<a href=\"%s\">%s</a>")))
                            (format url-format (match-string 1 path))
                            (or description
                             (format
                              (cond ((memq backend '(beamer latex)) (let nil "\\texttt{%s}"))
                               ((eq backend 'html) (let nil "<code>%s</code>")))
                              (format (if (match-string 2 path) title-format-2 title-format-1) (match-string 1 path)
                               (match-string 2 path))
                              )
                             )
                            )
                           )
                          )
                         )
                        )
                       ("id" :follow org-id-open) ("org-title" :store store-org-title-link) ("file+sys") ("file+emacs")
                       ("geo" :follow (closure (t) (link _) (osm (concat "geo:" link))) :store
                        (closure (t) nil
                         (if (eq major-mode 'osm-mode) (progn (apply 'org-link-store-props (osm--org-link-props)))))
                        )
                       ("shell" :follow org-link--open-shell)
                       ("news" :follow #[514 "\301\300\302Q\"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"])
                       ("mailto" :follow #[514 "\301\300\302Q\"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"])
                       ("https" :follow #[514 "\301\300\302Q\"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"])
                       ("http" :follow #[514 "\301\300\302Q\"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"])
                       ("ftp" :follow #[514 "\301\300\302Q\"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"])
                       ("help" :follow org-link--open-help :store org-link--store-help)
                       ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp))
 org-outline-path-complete-in-steps nil
 org-agenda-skip-timestamp-if-done t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-cycle-emulate-tab 'whitestart
 org-confirm-babel-evaluate nil
 org-export-async-init-file "~/.emacs.d/my-lisp/org-async-init.el"
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-publish-project-alist nil ; REDACTED
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 outline-mode-hook '(beginend-outline-mode)
 org-confirm-shell-link-function 'yes-or-no-p
 org-capture-templates '(("d" "Daily" entry (file+olp+datetree "Daily.org") "* TODO %?\n")
                         ("r" "Reply" entry (file+olp+datetree "Daily.org")
                          "* TODO Contestarle a %:fromname: [[%L][%:subject]]\n" :immediate-finish t)
                         ("n" "Note" entry (file+olp "Notes.org" "Miscellaneous") "* %?\n")
                         ("t" "Math talk" entry (file+olp "Math.org" "Talks")
                          "* [[%c][💻]] %^{Speaker}, /%^{Title}/ \n%^T\n%?")
                         ("v" "Talk" entry (file+olp "Notes.org" "Talks") "* [[%c][💻]] %?\n")
                         ("j" "Journal entry" plain (file+olp+datetree "Journal.org"))
                         ("a" "arXiv paper" entry (file+olp "Math.org" "Reading" "arXiv") "* %c\n" :immediate-finish t)
                         ("l" "Link" entry (file+olp "Notes.org" "Miscellaneous") "* %?%a\n")
                         ("c" "Clipboard link" entry (file+olp "Notes.org" "Miscellaneous") "* %?[[%c][%^{Title}]]")
                         ("p" "Blood Pressure" table-line (file+olp "Health.org" "Blood Pressure")
                          "| %U | %^{LSys} | %^{LDia} | %^{LPul} | %^{RSys} | %^{RDia} | %^{RPul} |" :immediate-finish t)
                         ("e" "Emacs templates") ("s" "Someday" entry (file "Someday.org") "* %?\n")
                         ("ei" "Idea" entry (file+olp "Emacs.org" "Ideas") "* %?\n")
                         ("et" "Tip" entry (file+olp "Emacs.org" "Tips") "* %?\n")
                         ("eq" "Question" entry (file+olp "Emacs.org" "Questions") "* %?\n")
                         ("ep" "Package" entry (file+olp "Emacs.org" "Packages") "* %?\n"))
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-agenda-skip-deadline-if-done t
 org-export-with-smart-quotes t
 org-hide-emphasis-markers t
 org-confirm-elisp-link-function 'yes-or-no-p
 org-entities-user '(("newline" "\\newline" nil "<br>" "\n" "\n" "⏎"))
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-hide-leading-stars t
 org-use-speed-commands t
 org-occur-hook '(org-first-headline-recenter)
 org-todo-keywords '((sequence "TODO" "|" "DONE" "NOPE") (sequence "WAIT(@)"))
 org-agenda-files '("~/Notes/Daily.org" "~/Notes/Work.org" "~/Notes/Math.org" "~/Notes/Home.org" "~/Notes/Health.org")
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-link-shell-confirm-function 'yes-or-no-p
 org-agenda-mode-hook '(beginend-org-agenda-mode)
 org-startup-indented t
 org-ql-completing-read-snippet-function 'org-ql-completing-read--snippet-simple
 org-src-lang-modes '(("latex-macros" . latex) ("inline-js" . javascript) ("C" . c) ("C++" . c++) ("asymptote" . asy)
                      ("bash" . sh) ("beamer" . latex) ("calc" . fundamental) ("cpp" . c++) ("ditaa" . artist)
                      ("desktop" . conf-desktop) ("dot" . fundamental) ("elisp" . emacs-lisp) ("ocaml" . tuareg)
                      ("screen" . shell-script) ("shell" . sh) ("sqlite" . sql) ("toml" . conf-toml))
 org-agenda-skip-scheduled-if-done t
 org-auto-align-tags nil
 org-preview-latex-image-directory "~/.cache/ltximg/"
 org-latex-classes nil; REDACTED
 org-structure-template-alist '(("a" . "export ascii") ("c" . "center") ("C" . "comment") ("e" . "example") ("E" . "export")
                                ("h" . "export html") ("l" . "export latex") ("q" . "quote") ("s" . "src") ("v" . "verse")
                                ("thm" . "theorem") ("pf" . "proof") ("lem" . "lemma") ("cor" . "corollary")
                                ("def" . "definition") ("rem" . "remark") ("exer" . "exercise") ("prop" . "proposition")
                                ("el" . "src emacs-lisp"))
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-ellipsis "…"
 org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2]
                 #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-fold-show-all append local] 5]
                 #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes add-pretty-entities-hook org-tweak-syntax-table
                 turn-off-visual-line-mode turn-on-auto-fill ediff-with-org-show-all turn-on-org-cdlatex beginend-org-mode)
 org-babel-pre-tangle-hook '(save-buffer)
 org-tags-column 0
 org-refile-use-outline-path 'file
 org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
 org-capture-templates-contexts '(("r" ((in-mode . "gnus-article-mode") (in-mode . "gnus-summary-mode"))))
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
 org-link-from-user-regexp "REDACTED"
 org-log-into-drawer t
 org-latex-packages-alist '(("AUTO" "babel" t ("pdflatex")))
 org-highlight-latex-and-related '(latex script entities)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate)
 org-refile-targets '((nil :maxlevel . 2) ("~/Notes/Notes.org" :maxlevel . 2) ("~/Notes/Someday.org" :level . 0)
                      ("~/Notes/Health.org" :maxlevel . 1) ("~/Notes/Home.org" :maxlevel . 1)
                      ("~/Notes/Work.org" :maxlevel . 2) ("~/Notes/Math.org" :maxlevel . 2))
 org-agenda-finalize-hook '(org-modern-agenda)
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-link-elisp-confirm-function 'yes-or-no-p
 )


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

* Re: [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]
  2024-01-20 19:44 [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)] Omar Antolín Camarena
@ 2024-01-21 12:18 ` Ihor Radchenko
  2024-01-21 13:09   ` Gregor Zattler
  2024-01-21 17:50   ` Omar Antolín Camarena
  0 siblings, 2 replies; 5+ messages in thread
From: Ihor Radchenko @ 2024-01-21 12:18 UTC (permalink / raw)
  To: Omar Antolín Camarena; +Cc: emacs-orgmode

Omar Antolín Camarena <omar@matem.unam.mx> writes:

> If you have an org link with a newline embedded in the description in an org-mode buffer and put point on it, org-open-at-point correctly follows the link but org-open-at-point-global does not, it instead reports "No link found". (I have plenty of org links with newlines in the description, because org-fill-paragraph tends to reformat links that way.)

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ac1c72376

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]
  2024-01-21 12:18 ` Ihor Radchenko
@ 2024-01-21 13:09   ` Gregor Zattler
  2024-01-21 13:27     ` Ihor Radchenko
  2024-01-21 17:50   ` Omar Antolín Camarena
  1 sibling, 1 reply; 5+ messages in thread
From: Gregor Zattler @ 2024-01-21 13:09 UTC (permalink / raw)
  To: emacs-orgmode

Hi Ihor, Omar, 
* Ihor Radchenko <yantar92@posteo.net> [2024-01-21; 12:18 GMT]:
> Omar Antolín Camarena <omar@matem.unam.mx> writes:
>
>> If you have an org link with a newline embedded in the description in an org-mode buffer and put point on it, org-open-at-point correctly follows the link but org-open-at-point-global does not, it instead reports "No link found". (I have plenty of org links with newlines in the description, because org-fill-paragraph tends to reformat links that way.)
>
> Thanks for reporting!
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ac1c72376

that works for me now with both, org-open-at-point in
org-mode buffers and org-open-at-point-global somewhere
else.

But how about this idea of Omar: 

"I would like to suggest that org-open-at-point-global
check to see if it is being run in an Org mode buffer
and if so just call org-open-at-point.  That way users
can bind org-open-at-point-global and use that key
binding everywhere including org-mode buffers without
loss of functionality compared to org-open-at-point."

This sounds reasonable for me!?

Regards, Ggregor


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

* Re: [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]
  2024-01-21 13:09   ` Gregor Zattler
@ 2024-01-21 13:27     ` Ihor Radchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Ihor Radchenko @ 2024-01-21 13:27 UTC (permalink / raw)
  To: Gregor Zattler; +Cc: emacs-orgmode

Gregor Zattler <telegraph@gmx.net> writes:

> But how about this idea of Omar: 
>
> "I would like to suggest that org-open-at-point-global
> check to see if it is being run in an Org mode buffer
> and if so just call org-open-at-point.  That way users
> can bind org-open-at-point-global and use that key
> binding everywhere including org-mode buffers without
> loss of functionality compared to org-open-at-point."
>
> This sounds reasonable for me!?

That would be a breaking change.
`org-open-at-point-global' is more permissive compared to
`org-open-at-point'. For example, `org-open-at-point-global' would open
links inside verbatim or src blocks, while `org-open-at-point' would not.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]
  2024-01-21 12:18 ` Ihor Radchenko
  2024-01-21 13:09   ` Gregor Zattler
@ 2024-01-21 17:50   ` Omar Antolín Camarena
  1 sibling, 0 replies; 5+ messages in thread
From: Omar Antolín Camarena @ 2024-01-21 17:50 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Thank you for the quick fix! And I'm happily surprised you decided to check the whole paragraph. I hadn't dared suggest that because I thought the decision to check only the current line was made for performance reasons. On the other hand, I had not thought through my proposal carefully and in particular hadn't noticed the points you made in response to Gregor.

-- 
Omar Antolín-Camarena


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

end of thread, other threads:[~2024-01-21 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 19:44 [BUG] org-open-at-point-global fails on links with multiline descriptions in org-mode buffers [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)] Omar Antolín Camarena
2024-01-21 12:18 ` Ihor Radchenko
2024-01-21 13:09   ` Gregor Zattler
2024-01-21 13:27     ` Ihor Radchenko
2024-01-21 17:50   ` Omar Antolín Camarena

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).