From 75846c9783542499425ffec491998427bcef9d68 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Wed, 4 Sep 2019 22:36:50 -0400 Subject: [PATCH] Limit the url-path-and-query override only for older Emacsen Continuation of https://github.com/kaushalmodi/ox-hugo/commit/3b3f63f9a92be1ebcc8a34610336931dae339af2. --- test/setup-ox-hugo.el | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/setup-ox-hugo.el b/test/setup-ox-hugo.el index cf67e7b..d58f2db 100644 --- a/test/setup-ox-hugo.el +++ b/test/setup-ox-hugo.el @@ -287,17 +287,18 @@ Fake current time: 2100/12/21 00:00:00 (arbitrary)." ;; https://ox-hugo.scripter.co/! As it turns out, this behavior got ;; fixed in Emacs 25+ in: ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b792ecea1715e080ad8e232d3d154b8a25d2edfb - (with-eval-after-load 'url-parse - (defun url-path-and-query (urlobj) - "Return the path and query components of URLOBJ. + (unless (version<= "25.0" emacs-version) + (with-eval-after-load 'url-parse + (defun url-path-and-query (urlobj) + "Return the path and query components of URLOBJ. These two components are stored together in the FILENAME slot of the object. The return value of this function is (PATH . QUERY), where each of PATH and QUERY are strings or nil." - (let ((name (url-filename urlobj)) - path query) - (when name - (if (string-match "\\?" name) - (setq path (substring name 0 (match-beginning 0)) - query (substring name (match-end 0))) - (setq path name))) - (cons path query))))) + (let ((name (url-filename urlobj)) + path query) + (when name + (if (string-match "\\?" name) + (setq path (substring name 0 (match-beginning 0)) + query (substring name (match-end 0))) + (setq path name))) + (cons path query))))))