emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org 6e9ea3a076 2/4: org.el: Preserve case for link subg


From: ELPA Syncer
Subject: [elpa] externals/org 6e9ea3a076 2/4: org.el: Preserve case for link subgroups from `org-file-apps'
Date: Fri, 9 Sep 2022 07:58:00 -0400 (EDT)

branch: externals/org
commit 6e9ea3a0766de9df6992bfb0359a5826ed1951b5
Author: Max Nikulin <manikulin@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org.el: Preserve case for link subgroups from `org-file-apps'
    
    * lisp/org.el (org-open-file): Avoid matching of `org-file-apps' records
    against the link converted to downcase since it caused incorrect
    substitutions to the command.
    
    Consider the following entry
    
        (add-to-list
         'org-file-apps
         '("\\.PDF\\(?:\\.[gx]z\\|\\.bz2\\)?::\\(#[^:]*\\)::\\(.+\\)\\'"
          . "okular --find %2 -- %s%1"))
    
    and the link
    <file:///usr/share/doc/bash/bashref.pdf::#Redirections::before>
    Without the patch
    
        okular --find before -- /usr/share/doc/bash/bashref.pdf\#redirections
    
    command is executed and the application can not resolve internal
    cross-reference anchor.
    
    In https://list.orgmode.org/4B51D104.9090502@jboecker.de/T/#u
    
https://list.orgmode.org/k2jfb2eb6811004041733zf176e0aq8367924746db81f5@mail.gmail.com/T/#u
    the purpose of `dlink' is not clarified, so I assume that the only
    purpose is to allow matching file suffixes, e.g. ".pdf" vs ".PDF".
---
 lisp/org.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3d2fbd2cbc..236969649e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8134,7 +8134,6 @@ If the file does not exist, throw an error."
         (link (cond (line (concat file "::" (number-to-string line)))
                     (search (concat file "::" search))
                     (t file)))
-        (dlink (downcase link))
         (ext
          (and (string-match "\\`.*?\\.\\([a-zA-Z0-9]+\\(\\.gz\\)?\\)\\'" dfile)
               (match-string 1 dfile)))
@@ -8159,8 +8158,9 @@ If the file does not exist, throw an error."
                    ;; First, try matching against apps-dlink if we
                    ;; get a match here, store the match data for
                    ;; later.
-                   (let ((match (assoc-default dlink apps-dlink
-                                               'string-match)))
+                   (let* ((case-fold-search t)
+                           (match (assoc-default link apps-dlink
+                                                 'string-match)))
                      (if match
                          (progn (setq link-match-data (match-data))
                                 match)
@@ -8191,7 +8191,7 @@ If the file does not exist, throw an error."
       (user-error "No such file: %s" file))
     (cond
      ((org-string-nw-p cmd)
-      (setq cmd (org--open-file-format-command cmd file dlink link-match-data))
+      (setq cmd (org--open-file-format-command cmd file link link-match-data))
 
       (save-window-excursion
        (message "Running %s...done" cmd)



reply via email to

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