emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* link syntax fixing bug?
@ 2021-03-20 22:46 Samuel Wales
  2021-04-17 19:27 ` Kyle Meyer
  2021-04-25 10:46 ` Maxim Nikulin
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Wales @ 2021-03-20 22:46 UTC (permalink / raw)
  To: emacs-orgmode

in recent maint, i am trying the code included with the maint release
to update org link escaping syntax.

the issue is that when i click on google, the space before "hi" does
not show up in the earch box.  ergo, different results.

*** should be orig
*** should be fixed, is not?
[[http://www.google.com/search?q=~"retroactive whatever" "hi"][retro
*** [[https://orgmode.org/Changes.html][Org mode for Emacs – Release notes]]
The following function will help switching your links to the new syntax:

(defun org-update-link-syntax (&optional no-query)
  "Update syntax for links in current buffer.
Query before replacing a link, unless optional argument NO-QUERY
is non-nil."
  (interactive "P")
  (org-with-point-at 1
    (let ((case-fold-search t))
      (while (re-search-forward "\\[\\[[^]]*?%\\(?:2[05]\\|5[BD]\\)" nil t)
        (let ((object (save-match-data (org-element-context))))
          (when (and (eq 'link (org-element-type object))
                     (= (match-beginning 0)
                        (org-element-property :begin object)))
            (goto-char (org-element-property :end object))
            (let* ((uri-start (+ 2 (match-beginning 0)))
                   (uri-end (save-excursion
                              (goto-char uri-start)
                              (re-search-forward "\\][][]" nil t)
                              (match-beginning 0)))
                   (uri (buffer-substring-no-properties uri-start uri-end)))
              (when (or no-query
                         (format "Possibly obsolete URI syntax: %S.  Fix? "
                (setf (buffer-substring uri-start uri-end)
                      (org-link-escape (org-link-decode uri)))))))))))

i'm kind of clueless about what the issue is.
thank you.

The Kafka Pandemic

Please learn what misopathy is.

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

end of thread, other threads:[~2021-04-25 10:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20 22:46 link syntax fixing bug? Samuel Wales
2021-04-17 19:27 ` Kyle Meyer
2021-04-25 10:46 ` Maxim Nikulin

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


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