emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

greedy substitution in org-open-file


From: Maxim Nikulin
Subject: greedy substitution in org-open-file
Date: Wed, 20 Jan 2021 23:08:35 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Looking into the code related to 'pty problem with start-process-shell-command, I have realized that the following case is not handled correctly:

#+begin_src elisp
  (setq org-file-apps '(("\\.pdf::\\([0-9]+\\)\\'" . "xpdf %s %1")))
#+end_src

I hope, I adapted an example from [[help:org-file-apps]] correctly. When I try to open the following link using C-c C-o

[[file:test-%1f.pdf::42]]

I get

Running xpdf /home/ubuntu/examples/org/test-\42f.pdf 42...done

I believe, it should be

Running xpdf /home/ubuntu/examples/org/test-%1f.pdf 42...done

Or

Running xpdf /home/ubuntu/examples/org/test-\%1f.pdf 42...done

Org mode version 9.4.4 (release_9.4.4-164-g7a9a8a

The source of the problem is that %s substitution is expanded at first and regexp groups are replaced later. Ideally, it should be performed in a single pass. I have found format-spec function but I am unsure concerning it, maybe it is avoided intentionally.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]