When I create a link with org-insert-link, it automatically escapes spaces.
E.g., C-c C-l shell:ls *.org [RET] a shell link [RET] results in [[shell:ls%20*.org][a shell link]] The problem is that the recent rewrite of org-open-at-point (commit fc9ce86cfc1ecf7e86028027a12875a26500e774) removed all invocations of org-unescape-link. As a result, if I use org-open-at-point on the link above, it sends the string "ls%20*.org" to my shell, which complains: "zsh:1: no matches found: ls%20*.org" At the bottom of the mail you'll find the backtrack that results when I call org-open-at-point on an elisp link: [[elisp:(org-agenda%20"a")][agenda]] Thanks, Matt Debugger entered--Lisp error: (void-function org-agenda%20) (org-agenda%20 "a") eval((org-agenda%20 "a")) (if (eq (string-to-char cmd) 40) (eval (read cmd)) (call-interactively (read cmd))) (message "%s => %s" cmd (if (eq (string-to-char cmd) 40) (eval (read cmd)) (call-interactively (read cmd)))) (if (or (and (org-string-nw-p org-confirm-elisp-link-not-regexp) (org-string-match-p org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " (org-add-props cmd nil (quote face) (quote org-warning))))) (message "%s => %s" cmd (if (eq (string-to-char cmd) 40) (eval (read cmd)) (call-interactively (read cmd)))) (error "Abort")) (let ((cmd path)) (if (or (and (org-string-nw-p org-confirm-elisp-link-not-regexp) (org-string-match-p org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " (org-add-props cmd nil (quote face) (quote org-warning))))) (message "%s => %s" cmd (if (eq (string-to-char cmd) 40) (eval (read cmd)) (call-interactively (read cmd)))) (error "Abort"))) (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (apply (or (let ((app ...)) (nth 1 (assoc ... org-link-protocols))) (function org-open-file)) path arg (let ((option (org-element-property :search-option context))) (cond ((not option) nil) ((org-string-match-p "\\`[0-9]+\\'" option) (list ...)) (t (list nil option))))))) ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "help") (let ((f-or-v (intern path))) (cond ((fboundp f-or-v) (describe-function f-or-v)) ((boundp f-or-v) (describe-variable f-or-v)) (t (error "Not a known function or variable"))))) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) (spec (format-spec-make 97 path 115 (let (...) (if ... "" ...)))) final-args) (apply cmd (dolist (arg args (nreverse final-args)) (if (not (stringp arg)) (push arg final-args) (push (format-spec arg spec) final-args)))))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (org-link-escape-browser (concat type ":" path)))) ((equal type "doi") (browse-url (org-link-escape-browser (concat org-doi-server-url path)))) ((equal type "message") (browse-url (concat type ":" path))) ((equal type "shell") (let ((buf (generate-new-buffer "*Org Shell Output")) (cmd path)) (if (or (and (org-string-nw-p org-confirm-shell-link-not-regexp) (string-match org-confirm-shell-link-not-regexp cmd)) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function (format "Execute \"%s\" in shell? " (org-add-props cmd nil ... ...)))) (progn (message "Executing %s" cmd) (shell-command cmd buf) (when (featurep (quote midnight)) (setq clean-buffer-list-kill-buffer-names (cons buf clean-buffer-list-kill-buffer-names)))) (error "Abort")))) ((equal type "elisp") (let ((cmd path)) (if (or (and (org-string-nw-p org-confirm-elisp-link-not-regexp) (org-string-match-p org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " (org-add-props cmd nil ... ...)))) (message "%s => %s" cmd (if (eq (string-to-char cmd) 40) (eval (read cmd)) (call-interactively (read cmd)))) (error "Abort")))) ((equal type "id") (require (quote ord-id)) (funcall (nth 1 (assoc "id" org-link-protocols)) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (unless (run-hook-with-args-until-success (quote org-open-link-functions) path) (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer)))) (let ((cmd (\` (org-link-search ... ... ...)))) (condition-case nil (let ((org-link-search-inhibit-query t)) (eval cmd)) (error (progn (widen) (eval cmd))))))) (t (browse-url-at-point))) (save-current-buffer (set-buffer (or reference-buffer (current-buffer))) (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (apply (or (let (...) (nth 1 ...)) (function org-open-file)) path arg (let ((option ...)) (cond (... nil) (... ...) (t ...)))))) ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "help") (let ((f-or-v (intern path))) (cond ((fboundp f-or-v) (describe-function f-or-v)) ((boundp f-or-v) (describe-variable f-or-v)) (t (error "Not a known function or variable"))))) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) (spec (format-spec-make 97 path 115 (let ... ...))) final-args) (apply cmd (dolist (arg args (nreverse final-args)) (if (not ...) (push arg final-args) (push ... final-args)))))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (org-link-escape-browser (concat type ":" path)))) ((equal type "doi") (browse-url (org-link-escape-browser (concat org-doi-server-url path)))) ((equal type "message") (browse-url (concat type ":" path))) ((equal type "shell") (let ((buf (generate-new-buffer "*Org Shell Output")) (cmd path)) (if (or (and (org-string-nw-p org-confirm-shell-link-not-regexp) (string-match org-confirm-shell-link-not-regexp cmd)) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function (format "Execute \"%s\" in shell? " ...))) (progn (message "Executing %s" cmd) (shell-command cmd buf) (when (featurep ...) (setq clean-buffer-list-kill-buffer-names ...))) (error "Abort")))) ((equal type "elisp") (let ((cmd path)) (if (or (and (org-string-nw-p org-confirm-elisp-link-not-regexp) (org-string-match-p org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " ...))) (message "%s => %s" cmd (if (eq ... 40) (eval ...) (call-interactively ...))) (error "Abort")))) ((equal type "id") (require (quote ord-id)) (funcall (nth 1 (assoc "id" org-link-protocols)) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (unless (run-hook-with-args-until-success (quote org-open-link-functions) path) (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer)))) (let ((cmd (\` ...))) (condition-case nil (let (...) (eval cmd)) (error (progn ... ...)))))) (t (browse-url-at-point)))) (with-current-buffer (or reference-buffer (current-buffer)) (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (apply (or (let (...) (nth 1 ...)) (function org-open-file)) path arg (let ((option ...)) (cond (... nil) (... ...) (t ...)))))) ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "help") (let ((f-or-v (intern path))) (cond ((fboundp f-or-v) (describe-function f-or-v)) ((boundp f-or-v) (describe-variable f-or-v)) (t (error "Not a known function or variable"))))) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) (spec (format-spec-make 97 path 115 (let ... ...))) final-args) (apply cmd (dolist (arg args (nreverse final-args)) (if (not ...) (push arg final-args) (push ... final-args)))))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (org-link-escape-browser (concat type ":" path)))) ((equal type "doi") (browse-url (org-link-escape-browser (concat org-doi-server-url path)))) ((equal type "message") (browse-url (concat type ":" path))) ((equal type "shell") (let ((buf (generate-new-buffer "*Org Shell Output")) (cmd path)) (if (or (and (org-string-nw-p org-confirm-shell-link-not-regexp) (string-match org-confirm-shell-link-not-regexp cmd)) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function (format "Execute \"%s\" in shell? " ...))) (progn (message "Executing %s" cmd) (shell-command cmd buf) (when (featurep ...) (setq clean-buffer-list-kill-buffer-names ...))) (error "Abort")))) ((equal type "elisp") (let ((cmd path)) (if (or (and (org-string-nw-p org-confirm-elisp-link-not-regexp) (org-string-match-p org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " ...))) (message "%s => %s" cmd (if (eq ... 40) (eval ...) (call-interactively ...))) (error "Abort")))) ((equal type "id") (require (quote ord-id)) (funcall (nth 1 (assoc "id" org-link-protocols)) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (unless (run-hook-with-args-until-success (quote org-open-link-functions) path) (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer)))) (let ((cmd (\` ...))) (condition-case nil (let (...) (eval cmd)) (error (progn ... ...)))))) (t (browse-url-at-point)))) (let ((type (org-element-property :type context)) (path (org-element-property :path context))) (with-current-buffer (or reference-buffer (current-buffer)) (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (apply (or (let ... ...) (function org-open-file)) path arg (let (...) (cond ... ... ...))))) ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "help") (let ((f-or-v (intern path))) (cond ((fboundp f-or-v) (describe-function f-or-v)) ((boundp f-or-v) (describe-variable f-or-v)) (t (error "Not a known function or variable"))))) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) (spec (format-spec-make 97 path 115 ...)) final-args) (apply cmd (dolist (arg args ...) (if ... ... ...))))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (org-link-escape-browser (concat type ":" path)))) ((equal type "doi") (browse-url (org-link-escape-browser (concat org-doi-server-url path)))) ((equal type "message") (browse-url (concat type ":" path))) ((equal type "shell") (let ((buf (generate-new-buffer "*Org Shell Output")) (cmd path)) (if (or (and ... ...) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function ...)) (progn (message "Executing %s" cmd) (shell-command cmd buf) (when ... ...)) (error "Abort")))) ((equal type "elisp") (let ((cmd path)) (if (or (and ... ...) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function ...)) (message "%s => %s" cmd (if ... ... ...)) (error "Abort")))) ((equal type "id") (require (quote ord-id)) (funcall (nth 1 (assoc "id" org-link-protocols)) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (unless (run-hook-with-args-until-success (quote org-open-link-functions) path) (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link ...))) (let ((cmd ...)) (condition-case nil (let ... ...) (error ...))))) (t (browse-url-at-point))))) (cond ((not context) (user-error "No link found")) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not (match-beginning 5)) (< (point) (match-beginning 5))))) (let* ((data (org-offer-links-in-entry (current-buffer) (point) arg)) (links (car data)) (links-end (cdr data))) (if links (dolist (link (if (stringp links) (list links) links)) (search-forward link nil links-end) (goto-char (match-beginning 0)) (org-open-at-point)) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((> (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " ") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= (point) (match-beginning 5))))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-element-property :path context))) (with-current-buffer (or reference-buffer (current-buffer)) (cond ((equal type "file") (if (string-match "[*?{]" ...) (dired path) (apply ... path arg ...))) ((assoc type org-link-protocols) (funcall (nth 1 ...) path)) ((equal type "help") (let (...) (cond ... ... ...))) ((equal type "mailto") (let (... ... ... final-args) (apply cmd ...))) ((member type (quote ...)) (browse-url (org-link-escape-browser ...))) ((equal type "doi") (browse-url (org-link-escape-browser ...))) ((equal type "message") (browse-url (concat type ":" path))) ((equal type "shell") (let (... ...) (if ... ... ...))) ((equal type "elisp") (let (...) (if ... ... ...))) ((equal type "id") (require (quote ord-id)) (funcall (nth 1 ...) path)) ((member type (quote ...)) (unless (run-hook-with-args-until-success ... path) (if ... ... ...) (let ... ...))) (t (browse-url-at-point)))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " ") (let ((begin ...)) (if begin (< ... begin) (= ... ...)))))) (org-footnote-action)) (t (user-error "No link found"))) (let* ((context (org-element-context)) type) (while (and (not (memq (setq type (org-element-type context)) (quote (headline inlinetask link footnote-definition footnote-reference timestamp)))) (setq context (org-element-property :parent context)))) (cond ((not context) (user-error "No link found")) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not (match-beginning 5)) (< (point) (match-beginning 5))))) (let* ((data (org-offer-links-in-entry (current-buffer) (point) arg)) (links (car data)) (links-end (cdr data))) (if links (dolist (link (if ... ... links)) (search-forward link nil links-end) (goto-char (match-beginning 0)) (org-open-at-point)) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((> (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " ") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= (point) (match-beginning 5))))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-element-property :path context))) (with-current-buffer (or reference-buffer (current-buffer)) (cond ((equal type "file") (if ... ... ...)) ((assoc type org-link-protocols) (funcall ... path)) ((equal type "help") (let ... ...)) ((equal type "mailto") (let ... ...)) ((member type ...) (browse-url ...)) ((equal type "doi") (browse-url ...)) ((equal type "message") (browse-url ...)) ((equal type "shell") (let ... ...)) ((equal type "elisp") (let ... ...)) ((equal type "id") (require ...) (funcall ... path)) ((member type ...) (unless ... ... ...)) (t (browse-url-at-point)))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " ") (let (...) (if begin ... ...))))) (org-footnote-action)) (t (user-error "No link found")))) (if (run-hook-with-args-until-success (quote org-open-at-point-functions)) nil (let* ((context (org-element-context)) type) (while (and (not (memq (setq type (org-element-type context)) (quote (headline inlinetask link footnote-definition footnote-reference timestamp)))) (setq context (org-element-property :parent context)))) (cond ((not context) (user-error "No link found")) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not ...) (< ... ...)))) (let* ((data (org-offer-links-in-entry ... ... arg)) (links (car data)) (links-end (cdr data))) (if links (dolist (link ...) (search-forward link nil links-end) (goto-char ...) (org-open-at-point)) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((> (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " ") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= ... ...)))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-element-property :path context))) (with-current-buffer (or reference-buffer (current-buffer)) (cond (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ... ...) (... ...) (t ...))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " ") (let ... ...)))) (org-footnote-action)) (t (user-error "No link found"))))) (unless (run-hook-with-args-until-success (quote org-open-at-point-functions)) (let* ((context (org-element-context)) type) (while (and (not (memq (setq type (org-element-type context)) (quote (headline inlinetask link footnote-definition footnote-reference timestamp)))) (setq context (org-element-property :parent context)))) (cond ((not context) (user-error "No link found")) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not ...) (< ... ...)))) (let* ((data (org-offer-links-in-entry ... ... arg)) (links (car data)) (links-end (cdr data))) (if links (dolist (link ...) (search-forward link nil links-end) (goto-char ...) (org-open-at-point)) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((> (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " ") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (progn (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= ... ...)))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-element-property :path context))) (with-current-buffer (or reference-buffer (current-buffer)) (cond (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ...) (... ... ...) (... ...) (t ...))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " ") (let ... ...)))) (org-footnote-action)) (t (user-error "No link found"))))) (if (call-interactively (function org-babel-open-src-block-result)) nil (org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq org-window-config-before-follow-link (current-window-configuration)) (org-remove-occur-highlights nil nil t) (unless (run-hook-with-args-until-success (quote org-open-at-point-functions)) (let* ((context (org-element-context)) type) (while (and (not (memq (setq type ...) (quote ...))) (setq context (org-element-property :parent context)))) (cond ((not context) (user-error "No link found")) ((and (memq type (quote ...)) (progn (save-excursion ... ...) (or ... ...))) (let* ((data ...) (links ...) (links-end ...)) (if links (dolist ... ... ... ...) (require ...) (org-attach-reveal ...)))) ((> (point) (save-excursion (goto-char ...) (skip-chars-backward " ") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote ...)) (progn (save-excursion ... ...) (and ... ...))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type ...) (path ...)) (with-current-buffer (or reference-buffer ...) (cond ... ... ... ... ... ... ... ... ... ... ... ...)))) ((or (eq type (quote footnote-reference)) (and (eq type ...) (save-excursion ... ...))) (org-footnote-action)) (t (user-error "No link found"))))) (move-marker org-open-link-marker nil) (run-hook-with-args (quote org-follow-link-hook))) (unless (call-interactively (function org-babel-open-src-block-result)) (org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq org-window-config-before-follow-link (current-window-configuration)) (org-remove-occur-highlights nil nil t) (unless (run-hook-with-args-until-success (quote org-open-at-point-functions)) (let* ((context (org-element-context)) type) (while (and (not (memq (setq type ...) (quote ...))) (setq context (org-element-property :parent context)))) (cond ((not context) (user-error "No link found")) ((and (memq type (quote ...)) (progn (save-excursion ... ...) (or ... ...))) (let* ((data ...) (links ...) (links-end ...)) (if links (dolist ... ... ... ...) (require ...) (org-attach-reveal ...)))) ((> (point) (save-excursion (goto-char ...) (skip-chars-backward " ") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote ...)) (progn (save-excursion ... ...) (and ... ...))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type ...) (path ...)) (with-current-buffer (or reference-buffer ...) (cond ... ... ... ... ... ... ... ... ... ... ... ...)))) ((or (eq type (quote footnote-reference)) (and (eq type ...) (save-excursion ... ...))) (org-footnote-action)) (t (user-error "No link found"))))) (move-marker org-open-link-marker nil) (run-hook-with-args (quote org-follow-link-hook))) org-open-at-point(nil) call-interactively(org-open-at-point) org-return() call-interactively(org-return nil nil)