From 1cca8f534fdfcb34d2bce53a179604f6f8f491f2 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 17 Apr 2014 10:30:44 +0200 Subject: [PATCH 1/8] org.el (org-sort-entries): Allow to sort by clocking time * org.el (org-sort-entries): Allow to sort by clocking time. Thanks to Noah Slater for this idea. --- lisp/org.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 3c7afd20d..cc1fc4096 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8585,20 +8585,21 @@ a time stamp, by a property, by priority order, or by a custom function. The command prompts for the sorting type unless it has been given to the function through the SORTING-TYPE argument, which needs to be a character, -\(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?o ?O ?r ?R ?f ?F). Here is the -precise meaning of each character: +\(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?o ?O ?r ?R ?f ?F ?k ?K). Here is +the precise meaning of each character: -n Numerically, by converting the beginning of the entry/item to a number. a Alphabetically, ignoring the TODO keyword and the priority, if any. -o By order of TODO keywords. -t By date/time, either the first active time stamp in the entry, or, if - none exist, by the first inactive one. -s By the scheduled date/time. -d By deadline date/time. c By creation time, which is assumed to be the first inactive time stamp at the beginning of a line. +d By deadline date/time. +k By clocking time. +n Numerically, by converting the beginning of the entry/item to a number. +o By order of TODO keywords. p By priority according to the cookie. r By the value of a property. +s By scheduled date/time. +t By date/time, either the first active time stamp in the entry, or, if + none exist, by the first inactive one. Capital letters will reverse the sort order. @@ -8675,8 +8676,8 @@ links." (unless sorting-type (message "Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc - [t]ime [s]cheduled [d]eadline [c]reated - A/N/P/R/O/F/T/S/D/C means reversed:" + [t]ime [s]cheduled [d]eadline [c]reated cloc[k]ing + A/N/P/R/O/F/T/S/D/C/K means reversed:" what) (setq sorting-type (read-char-exclusive)) @@ -8694,6 +8695,7 @@ links." (mapcar 'list (org-buffer-property-keys t)) nil t)))) + (when (member sorting-type '(?k ?K)) (org-clock-sum)) (message "Sorting entries...") (save-restriction @@ -8728,6 +8730,8 @@ links." (if (looking-at org-complex-heading-regexp) (funcall case-func (org-sort-remove-invisible (match-string 4))) nil)) + ((= dcst ?k) + (get-text-property (point) :org-clock-minutes)) ((= dcst ?t) (let ((end (save-excursion (outline-next-heading) (point)))) (if (or (re-search-forward org-ts-regexp end t) From 817619a50b05ead0b2330bc18de42b54bd5003d9 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 17 Apr 2014 10:32:23 +0200 Subject: [PATCH 2/8] Revert "org.el (org-sort-entries): Allow to sort by clocking time" This reverts commit 1cca8f534fdfcb34d2bce53a179604f6f8f491f2. --- lisp/org.el | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index cc1fc4096..3c7afd20d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8585,21 +8585,20 @@ a time stamp, by a property, by priority order, or by a custom function. The command prompts for the sorting type unless it has been given to the function through the SORTING-TYPE argument, which needs to be a character, -\(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?o ?O ?r ?R ?f ?F ?k ?K). Here is -the precise meaning of each character: +\(?n ?N ?a ?A ?t ?T ?s ?S ?d ?D ?p ?P ?o ?O ?r ?R ?f ?F). Here is the +precise meaning of each character: -a Alphabetically, ignoring the TODO keyword and the priority, if any. -c By creation time, which is assumed to be the first inactive time stamp - at the beginning of a line. -d By deadline date/time. -k By clocking time. n Numerically, by converting the beginning of the entry/item to a number. +a Alphabetically, ignoring the TODO keyword and the priority, if any. o By order of TODO keywords. -p By priority according to the cookie. -r By the value of a property. -s By scheduled date/time. t By date/time, either the first active time stamp in the entry, or, if none exist, by the first inactive one. +s By the scheduled date/time. +d By deadline date/time. +c By creation time, which is assumed to be the first inactive time stamp + at the beginning of a line. +p By priority according to the cookie. +r By the value of a property. Capital letters will reverse the sort order. @@ -8676,8 +8675,8 @@ links." (unless sorting-type (message "Sort %s: [a]lpha [n]umeric [p]riority p[r]operty todo[o]rder [f]unc - [t]ime [s]cheduled [d]eadline [c]reated cloc[k]ing - A/N/P/R/O/F/T/S/D/C/K means reversed:" + [t]ime [s]cheduled [d]eadline [c]reated + A/N/P/R/O/F/T/S/D/C means reversed:" what) (setq sorting-type (read-char-exclusive)) @@ -8695,7 +8694,6 @@ links." (mapcar 'list (org-buffer-property-keys t)) nil t)))) - (when (member sorting-type '(?k ?K)) (org-clock-sum)) (message "Sorting entries...") (save-restriction @@ -8730,8 +8728,6 @@ links." (if (looking-at org-complex-heading-regexp) (funcall case-func (org-sort-remove-invisible (match-string 4))) nil)) - ((= dcst ?k) - (get-text-property (point) :org-clock-minutes)) ((= dcst ?t) (let ((end (save-excursion (outline-next-heading) (point)))) (if (or (re-search-forward org-ts-regexp end t) From 7b3c11f797f713a85d2c9d0c5681f80386943a88 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 16 Apr 2014 22:46:30 +0200 Subject: [PATCH 3/8] Revert "Fix mailto links" This reverts commit f61cd6b7a17507dbcbd96a105d6c2e59a5b087b4. --- contrib/lisp/ox-groff.el | 3 +-- lisp/ox-html.el | 6 +----- lisp/ox-latex.el | 3 +-- lisp/ox-man.el | 3 +-- lisp/ox-odt.el | 3 +-- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el index bd9b8883a..46be766e4 100644 --- a/contrib/lisp/ox-groff.el +++ b/contrib/lisp/ox-groff.el @@ -1251,9 +1251,8 @@ INFO is a plist holding contextual information. See (imagep (org-export-inline-image-p link org-groff-inline-image-rules)) (path (cond - ((member type '("http" "https" "ftp")) + ((member type '("http" "https" "ftp" "mailto")) (concat type "://" raw-path)) - ((string= type "mailto") (concat type ":" raw-path)) ((string= type "file") (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 3dafb8455..9455d6249 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2658,11 +2658,7 @@ INFO is a plist holding contextual information. See (desc (org-string-nw-p desc)) (path (cond - ((member type '("http" "https" "ftp")) - (org-link-escape - (org-link-unescape - (concat type "://" raw-path)) org-link-escape-chars-browser)) - ((string= type "mailto") + ((member type '("http" "https" "ftp" "mailto")) (org-link-escape (org-link-unescape (concat type "://" raw-path)) org-link-escape-chars-browser)) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 3dab06ff7..e70ff0105 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1797,9 +1797,8 @@ INFO is a plist holding contextual information. See (imagep (org-export-inline-image-p link org-latex-inline-image-rules)) (path (cond - ((member type '("http" "https" "ftp")) + ((member type '("http" "https" "ftp" "mailto")) (concat type "://" raw-path)) - ((string= type "mailto") (concat type ":" raw-path)) ((string= type "file") (if (not (file-name-absolute-p raw-path)) raw-path (concat "file://" (expand-file-name raw-path)))) diff --git a/lisp/ox-man.el b/lisp/ox-man.el index 98a52b06b..2985a75e3 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -645,9 +645,8 @@ INFO is a plist holding contextual information. See (desc (and (not (string= desc "")) desc)) (path (cond - ((member type '("http" "https" "ftp")) + ((member type '("http" "https" "ftp" "mailto")) (concat type "://" raw-path)) - ((string= type "mailto") (concat type ":" raw-path)) ((string= type "file") (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index e522ebda0..e0f42d2a2 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2711,9 +2711,8 @@ INFO is a plist holding contextual information. See (imagep (org-export-inline-image-p link org-odt-inline-image-rules)) (path (cond - ((member type '("http" "https" "ftp")) + ((member type '("http" "https" "ftp" "mailto")) (concat type "://" raw-path)) - ((string= type "mailto") (concat type ":" raw-path)) ((string= type "file") (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) From 73c141e43ed1ab746d7f841478550fe4df85f432 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 16 Apr 2014 22:46:53 +0200 Subject: [PATCH 4/8] Revert "Fix link export" This reverts commit fc1f7d752fcd526909f0bb619cb9b3568c87665f. --- contrib/lisp/ox-groff.el | 4 +++- lisp/ox-html.el | 2 +- lisp/ox-latex.el | 2 +- lisp/ox-man.el | 4 +++- lisp/ox-md.el | 2 +- lisp/ox-odt.el | 2 +- lisp/ox-texinfo.el | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el index 46be766e4..1990f878f 100644 --- a/contrib/lisp/ox-groff.el +++ b/contrib/lisp/ox-groff.el @@ -1252,8 +1252,10 @@ INFO is a plist holding contextual information. See link org-groff-inline-image-rules)) (path (cond ((member type '("http" "https" "ftp" "mailto")) - (concat type "://" raw-path)) + (concat type ":" raw-path)) ((string= type "file") + (when (string-match "\\(.+\\)::.+" raw-path) + (setq raw-path (match-string 1 raw-path))) (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) (concat "file://" raw-path))) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 9455d6249..c590d86c4 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2661,7 +2661,7 @@ INFO is a plist holding contextual information. See ((member type '("http" "https" "ftp" "mailto")) (org-link-escape (org-link-unescape - (concat type "://" raw-path)) org-link-escape-chars-browser)) + (concat type ":" raw-path)) org-link-escape-chars-browser)) ((string= type "file") ;; Treat links to ".org" files as ".html", if needed. (setq raw-path diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index e70ff0105..6a2f69dde 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1798,7 +1798,7 @@ INFO is a plist holding contextual information. See link org-latex-inline-image-rules)) (path (cond ((member type '("http" "https" "ftp" "mailto")) - (concat type "://" raw-path)) + (concat type ":" raw-path)) ((string= type "file") (if (not (file-name-absolute-p raw-path)) raw-path (concat "file://" (expand-file-name raw-path)))) diff --git a/lisp/ox-man.el b/lisp/ox-man.el index 2985a75e3..f5653f1a2 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -646,8 +646,10 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) - (concat type "://" raw-path)) + (concat type ":" raw-path)) ((string= type "file") + (when (string-match "\\(.+\\)::.+" raw-path) + (setq raw-path (match-string 1 raw-path))) (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) (concat "file://" raw-path))) diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 455c3b334..47994ac32 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -320,7 +320,7 @@ a communication channel." (path (cond ((member type '("http" "https" "ftp")) - (concat type "://" raw-path)) + (concat type ":" raw-path)) ((equal type "file") (let ((path (funcall link-org-files-as-md raw-path))) (if (not (file-name-absolute-p path)) path diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index e0f42d2a2..0ddf2d56e 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2712,7 +2712,7 @@ INFO is a plist holding contextual information. See link org-odt-inline-image-rules)) (path (cond ((member type '("http" "https" "ftp" "mailto")) - (concat type "://" raw-path)) + (concat type ":" raw-path)) ((string= type "file") (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 865a21dbb..ef881afe2 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -1221,7 +1221,7 @@ INFO is a plist holding contextual information. See (desc (and (not (string= desc "")) desc)) (path (cond ((member type '("http" "https" "ftp")) - (concat type "://" raw-path)) + (concat type ":" raw-path)) ((string= type "file") (if (file-name-absolute-p raw-path) (concat "file://" (expand-file-name raw-path)) From 1ca819e398dea3a7bbdada7bd6402b3d8c8a2d86 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Apr 2014 08:41:14 +0200 Subject: [PATCH 5/8] Revert "Make Org links compatible with URI syntax" This reverts commit 3589f64e42dfbc894e789c2a9fba530eac36c665. --- lisp/org.el | 43 ++++++++++++++++++-------------- testing/lisp/test-org-element.el | 6 +++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 3c7afd20d..b59c8e8e6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5594,29 +5594,34 @@ stacked delimiters is N. Escaping delimiters is not possible." "Update the link regular expressions. This should be called after the variable `org-link-types' has changed." (setq org-link-types-re - (concat "\\`" (regexp-opt org-link-types t) ":\\(?://\\)") + (concat + "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):") org-link-re-with-space - (concat "?") + (concat + "?") org-link-re-with-space2 - (concat "?") + (concat + "?") org-link-re-with-space3 - (concat "") + (concat + "<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" + "\\([^" org-non-link-chars " ]" + "[^" org-non-link-chars "]*" + "\\)>") org-plain-link-re (concat - "\\<" (regexp-opt org-link-types t) ":\\(?://\\)?" + "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") org-bracket-link-regexp @@ -5624,7 +5629,7 @@ This should be called after the variable `org-link-types' has changed." org-bracket-link-analytic-regexp (concat "\\[\\[" - "\\(" (regexp-opt org-link-types t) ":\\(?://\\)?\\)?" + "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -5632,7 +5637,7 @@ This should be called after the variable `org-link-types' has changed." org-bracket-link-analytic-regexp++ (concat "\\[\\[" - "\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\(?://\\)?\\)?" + "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index fb5e9d40f..e131f92df 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1332,10 +1332,12 @@ e^{i\\pi}+1=0 ;; ... with expansion. (should (equal - "orgmode.org/worg" + "//orgmode.org/worg" (org-test-with-temp-text "[[Org:worg]]" (let ((org-link-abbrev-alist '(("Org" . "http://orgmode.org/")))) - (org-element-property :path (org-element-context)))))) + (org-element-property + :path + (org-element-map (org-element-parse-buffer) 'link 'identity nil t)))))) ;; ... with translation. (should (equal From 018a80541a96eee764fe929a11a3e8590df4500f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Apr 2014 08:42:14 +0200 Subject: [PATCH 6/8] Small refactoring * lisp/org.el (org-make-link-regexps): Use `regexp-opt' instead of `mapconcat' and `regexp-quote'. --- lisp/org.el | 102 +++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 53 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index b59c8e8e6..617829dbd 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5593,59 +5593,55 @@ stacked delimiters is N. Escaping delimiters is not possible." (defun org-make-link-regexps () "Update the link regular expressions. This should be called after the variable `org-link-types' has changed." - (setq org-link-types-re - (concat - "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):") - org-link-re-with-space - (concat - "?") - org-link-re-with-space2 - (concat - "?") - org-link-re-with-space3 - (concat - "") - org-plain-link-re - (concat - "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" - (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) - ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") - org-bracket-link-regexp - "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" - org-bracket-link-analytic-regexp - (concat - "\\[\\[" - "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?" - "\\([^]]+\\)" - "\\]" - "\\(\\[" "\\([^]]+\\)" "\\]\\)?" - "\\]") - org-bracket-link-analytic-regexp++ - (concat - "\\[\\[" - "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?" - "\\([^]]+\\)" - "\\]" - "\\(\\[" "\\([^]]+\\)" "\\]\\)?" - "\\]") - org-any-link-re - (concat "\\(" org-bracket-link-regexp "\\)\\|\\(" - org-angle-link-re "\\)\\|\\(" - org-plain-link-re "\\)"))) + (let ((types-re (regexp-opt org-link-types t))) + (setq org-link-types-re + (concat "\\`" types-re ":") + org-link-re-with-space + (concat "?") + org-link-re-with-space2 + (concat "?") + org-link-re-with-space3 + (concat "") + org-plain-link-re + (concat + "\\<" types-re ":" + (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) + ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") + org-bracket-link-regexp + "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" + org-bracket-link-analytic-regexp + (concat + "\\[\\[" + "\\(" types-re ":\\)?" + "\\([^]]+\\)" + "\\]" + "\\(\\[" "\\([^]]+\\)" "\\]\\)?" + "\\]") + org-bracket-link-analytic-regexp++ + (concat + "\\[\\[" + "\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\)?" + "\\([^]]+\\)" + "\\]" + "\\(\\[" "\\([^]]+\\)" "\\]\\)?" + "\\]") + org-any-link-re + (concat "\\(" org-bracket-link-regexp "\\)\\|\\(" + org-angle-link-re "\\)\\|\\(" + org-plain-link-re "\\)")))) (org-make-link-regexps) From b49cbf13389cc64154023b91433d9c886a537160 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Apr 2014 08:44:37 +0200 Subject: [PATCH 7/8] org-element: Fix ill-defined "file" type links * lisp/org-element.el (org-element-link-parser): Fix ill-defined "file" type links. Expand absolute file names in the process. Org accepts invalid URI syntax for absolute "file" links, e.g., file:/home/user/file.txt. This patch normalizes them. --- lisp/org-element.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 8c3d1c33e..b44466e53 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -3147,18 +3147,20 @@ Assume point is at the beginning of the link." ;; LINK-END variable. (setq post-blank (progn (goto-char link-end) (skip-chars-forward " \t")) end (point)) - ;; Extract search option and opening application out of - ;; "file"-type links. + ;; Special "file" type link processing. (when (member type org-element-link-type-is-file) - ;; Application. + ;; Extract opening application and search option. (cond ((string-match "^file\\+\\(.*\\)$" type) (setq application (match-string 1 type))) ((not (string-match "^file" type)) (setq application type))) - ;; Extract search option from PATH. - (when (string-match "::\\(.*\\)$" path) + (when (string-match "::\\(.*\\)\\'" path) (setq search-option (match-string 1 path) path (replace-match "" nil nil path))) + ;; Normalize URI. + (when (and (not (org-string-match-p "\\`//" path)) + (file-name-absolute-p path)) + (setq path (concat "//" (expand-file-name path)))) ;; Make sure TYPE always reports "file". (setq type "file")) (list 'link From 9dac00129d5ab939bc535e9dc42b8243f1fc710f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Apr 2014 09:15:09 +0200 Subject: [PATCH 8/8] Update export back-ends wrt "file" link changes * lisp/ox-latex.el (org-latex-link): * lisp/ox-html.el (org-html-link): Do not expand absolute file names and do not try to fix hierarchy part, as it is already taken care of at the parser level. * lisp/ox-md.el (org-md-link): Ditto. Also fix absolute file names. * lisp/ox-odt.el (org-odt-link): * lisp/ox-man.el (org-man-link): * lisp/ox-texinfo.el (org-texinfo-link): * contrib/lisp/ox-groff.el (org-groff-link): Ditto. Do not prepend scheme part to relative file names either. * contrib/lisp/ox-deck.el (org-deck-link): Small refactoring. --- contrib/lisp/ox-deck.el | 2 +- contrib/lisp/ox-groff.el | 8 ++------ lisp/ox-html.el | 13 ++++++------- lisp/ox-latex.el | 5 ++--- lisp/ox-man.el | 10 ++-------- lisp/ox-md.el | 6 +++--- lisp/ox-odt.el | 6 ++---- lisp/ox-texinfo.el | 6 ++---- 8 files changed, 20 insertions(+), 36 deletions(-) diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el index 60a2cbe74..9d84b0313 100644 --- a/contrib/lisp/ox-deck.el +++ b/contrib/lisp/ox-deck.el @@ -378,7 +378,7 @@ the \"slide\" class will be added to the to the list element, (defun org-deck-link (link desc info) (replace-regexp-in-string "href=\"#" "href=\"#outline-container-" - (org-html-link link desc info))) + (org-export-with-backend 'html link desc info))) (defun org-deck-template (contents info) "Return complete document string after HTML conversion. diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el index 1990f878f..8484def38 100644 --- a/contrib/lisp/ox-groff.el +++ b/contrib/lisp/ox-groff.el @@ -1253,12 +1253,8 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((string= type "file") - (when (string-match "\\(.+\\)::.+" raw-path) - (setq raw-path (match-string 1 raw-path))) - (if (file-name-absolute-p raw-path) - (concat "file://" (expand-file-name raw-path)) - (concat "file://" raw-path))) + ((and (string= type "file") (file-name-absolute-p raw-path)) + (concat "file://" raw-path)) (t raw-path))) protocol) (cond diff --git a/lisp/ox-html.el b/lisp/ox-html.el index c590d86c4..c82c642ef 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2667,13 +2667,12 @@ INFO is a plist holding contextual information. See (setq raw-path (funcall link-org-files-as-html-maybe raw-path info)) ;; If file path is absolute, prepend it with protocol - ;; component - "file://". - (cond ((file-name-absolute-p raw-path) - (setq raw-path - (concat "file://" (expand-file-name - raw-path)))) - ((and home use-abs-url) - (setq raw-path (concat (file-name-as-directory home) raw-path)))) + ;; component - "file:". + (cond + ((file-name-absolute-p raw-path) + (setq raw-path (concat "file:" raw-path))) + ((and home use-abs-url) + (setq raw-path (concat (file-name-as-directory home) raw-path)))) ;; Add search option, if any. A search option can be ;; relative to a custom-id or a headline title. Any other ;; option is ignored. diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 6a2f69dde..5b30246f2 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1799,9 +1799,8 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((string= type "file") - (if (not (file-name-absolute-p raw-path)) raw-path - (concat "file://" (expand-file-name raw-path)))) + ((and (string= type "file") (file-name-absolute-p raw-path)) + (concat "file:" raw-path)) (t raw-path))) protocol) (cond diff --git a/lisp/ox-man.el b/lisp/ox-man.el index f5653f1a2..d58c119fc 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -638,21 +638,15 @@ CONTENTS is nil. INFO is a plist holding contextual information." DESC is the description part of the link, or the empty string. INFO is a plist holding contextual information. See `org-export-data'." - (let* ((type (org-element-property :type link)) (raw-path (org-element-property :path link)) ;; Ensure DESC really exists, or set it to nil. (desc (and (not (string= desc "")) desc)) - (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((string= type "file") - (when (string-match "\\(.+\\)::.+" raw-path) - (setq raw-path (match-string 1 raw-path))) - (if (file-name-absolute-p raw-path) - (concat "file://" (expand-file-name raw-path)) - (concat "file://" raw-path))) + ((and (string= type "file") (file-name-absolute-p raw-path)) + (concat "file:" raw-path)) (t raw-path))) protocol) (cond diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 47994ac32..1f841c865 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -321,12 +321,12 @@ a communication channel." (cond ((member type '("http" "https" "ftp")) (concat type ":" raw-path)) - ((equal type "file") + ((string= type "file") (let ((path (funcall link-org-files-as-md raw-path))) (if (not (file-name-absolute-p path)) path ;; If file path is absolute, prepend it - ;; with "file://" component. - (concat "file://" (expand-file-name raw-path))))) + ;; with "file:" component. + (concat "file:" path)))) (t raw-path)))) (if (not contents) (format "<%s>" path) (format "[%s](%s)" contents path))))))) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 0ddf2d56e..772017cdd 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -2713,10 +2713,8 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) - ((string= type "file") - (if (file-name-absolute-p raw-path) - (concat "file://" (expand-file-name raw-path)) - (concat "file://" raw-path))) + ((and (string= type "file") (file-name-absolute-p raw-path)) + (concat "file:" raw-path)) (t raw-path))) ;; Convert & to & for correct XML representation (path (replace-regexp-in-string "&" "&" path)) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index ef881afe2..a961d7acd 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -1222,10 +1222,8 @@ INFO is a plist holding contextual information. See (path (cond ((member type '("http" "https" "ftp")) (concat type ":" raw-path)) - ((string= type "file") - (if (file-name-absolute-p raw-path) - (concat "file://" (expand-file-name raw-path)) - (concat "file://" raw-path))) + ((and (string= type "file") (file-name-absolute-p raw-path)) + (concat "file:" raw-path)) (t raw-path))) (email (if (string= type "mailto") (let ((text (replace-regexp-in-string