unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37056: 26.1; file-name-absolute-p does not recognize "man:" urls
@ 2019-08-16 16:56 Matthew Bauer
  2019-08-23  4:02 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Bauer @ 2019-08-16 16:56 UTC (permalink / raw)
  To: 37056

file-name-absolute-p does not recognize URLs like
"man:systemd-timesyncd.service(8)" as absolute. For instance, try this:

> (file-name-absolute-p "man:systemd-timesyncd.service(8)")
nil

This should be considered an absolute URL, and not be relativized. This
interferes with browse-url where this is done:

> (when (and url-handler-mode (not (file-name-absolute-p url)))
>   (setq url (expand-file-name url)))

so "man:systemd-timesyncd.service(8)" becomes:

> (expand-file-name "man:systemd-timesyncd.service(8)")
"/home/USER/man:systemd-timesyncd.service(8)"

Below is diff to update browse-url function to handle this.
---
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index aa31e25fa9..ffc2c766a2 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -801,8 +801,9 @@ as ARGS."
   (interactive (browse-url-interactive-arg "URL: "))
   (unless (called-interactively-p 'interactive)
     (setq args (or args (list browse-url-new-window-flag))))
-  (when (and url-handler-mode (not (file-name-absolute-p url)))
+  (when (and url-handler-mode
+             (not (file-name-absolute-p url))
+             (not (string-match "\\`[a-z]+:" url)))
     (setq url (expand-file-name url)))
   (let ((process-environment (copy-sequence process-environment))
 	(function (or (and (string-match "\\`mailto:" url)





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#37056: 26.1; file-name-absolute-p does not recognize "man:" urls
  2019-08-16 16:56 bug#37056: 26.1; file-name-absolute-p does not recognize "man:" urls Matthew Bauer
@ 2019-08-23  4:02 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-23  4:02 UTC (permalink / raw)
  To: Matthew Bauer; +Cc: 37056

Matthew Bauer <mjbauer95@gmail.com> writes:

> file-name-absolute-p does not recognize URLs like
> "man:systemd-timesyncd.service(8)" as absolute. For instance, try this:
>
>> (file-name-absolute-p "man:systemd-timesyncd.service(8)")
> nil
>
> This should be considered an absolute URL, and not be relativized. This
> interferes with browse-url where this is done:
>
>> (when (and url-handler-mode (not (file-name-absolute-p url)))
>>   (setq url (expand-file-name url)))
>
> so "man:systemd-timesyncd.service(8)" becomes:
>
>> (expand-file-name "man:systemd-timesyncd.service(8)")
> "/home/USER/man:systemd-timesyncd.service(8)"
>
> Below is diff to update browse-url function to handle this.

[...]

> -  (when (and url-handler-mode (not (file-name-absolute-p url)))
> +  (when (and url-handler-mode
> +             (not (file-name-absolute-p url))
> +             (not (string-match "\\`[a-z]+:" url)))

Makes sense.  The patch was mangled by Gmail during transport (as
usual), so I had to apply it manually.  In the future, attaching patches
as attachments is probably the best thing if Gmail can't be avoided.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-23  4:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16 16:56 bug#37056: 26.1; file-name-absolute-p does not recognize "man:" urls Matthew Bauer
2019-08-23  4:02 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).