* [PATCH] lisp/net/browse-url.el allow fragments in file: urls
@ 2021-04-01 2:16 Tom Gillespie
2021-04-01 7:20 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Tom Gillespie @ 2021-04-01 2:16 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 356 bytes --]
This fixes the current behavior of browse-url--non-html-file-url-p and
makes it possible to open file:// urls that end with a #fragment. The
current behavior results in a nasty side effect where opening a file
with browse-url-emacs that has a fragment causes any invocation of
call-process to fail because the fragment is not handled correctly.
Best!
Tom
[-- Attachment #2: 0001-lisp-net-browse-url.el-allow-fragments-in-file-urls.patch --]
[-- Type: text/x-patch, Size: 987 bytes --]
From a557f1b9ee397f93ca6b56c1fcc36896e6b4fafc Mon Sep 17 00:00:00 2001
From: Tom Gillespie <tgbugs@gmail.com>
Date: Wed, 31 Mar 2021 18:50:49 -0700
Subject: [PATCH] lisp/net/browse-url.el allow fragments in file:// urls
* lisp/net/browse-url.el (browse-url--non-html-file-url-p): Update
regexp to match file:// urls that end in a fragment.
---
lisp/net/browse-url.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 1c98335a20..aef221e9d7 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -617,7 +617,7 @@ browse-url--browser-kind-browser
(defun browse-url--non-html-file-url-p (url)
"Return non-nil if URL is a file:// URL of a non-HTML file."
(and (string-match-p "\\`file://" url)
- (not (string-match-p "\\`file://.*\\.html?\\b" url))))
+ (not (string-match-p "\\`file://.*\\.html?\\(#.*\\)?\\b" url))))
;;;###autoload
(defvar browse-url-default-handlers
--
2.26.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] lisp/net/browse-url.el allow fragments in file: urls
2021-04-01 2:16 [PATCH] lisp/net/browse-url.el allow fragments in file: urls Tom Gillespie
@ 2021-04-01 7:20 ` Eli Zaretskii
2021-04-02 0:22 ` Tom Gillespie
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-04-01 7:20 UTC (permalink / raw)
To: Tom Gillespie; +Cc: emacs-devel
> From: Tom Gillespie <tgbugs@gmail.com>
> Date: Wed, 31 Mar 2021 19:16:32 -0700
>
> This fixes the current behavior of browse-url--non-html-file-url-p and
> makes it possible to open file:// urls that end with a #fragment. The
> current behavior results in a nasty side effect where opening a file
> with browse-url-emacs that has a fragment causes any invocation of
> call-process to fail because the fragment is not handled correctly.
Thanks, but can you show a test case for this (or, better yet, write a
test for our test suite)?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lisp/net/browse-url.el allow fragments in file: urls
2021-04-01 7:20 ` Eli Zaretskii
@ 2021-04-02 0:22 ` Tom Gillespie
2021-04-02 5:43 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Tom Gillespie @ 2021-04-02 0:22 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Hi Eli,
I've added a few tests, but in the process discovered that
something strange seems to be going on (possibly of the dynamic
variable kind) so this patch should be put on hold until I understand
what is going wrong. Best!
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lisp/net/browse-url.el allow fragments in file: urls
2021-04-02 0:22 ` Tom Gillespie
@ 2021-04-02 5:43 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-04-02 5:43 UTC (permalink / raw)
To: Tom Gillespie; +Cc: emacs-devel
> From: Tom Gillespie <tgbugs@gmail.com>
> Date: Thu, 1 Apr 2021 17:22:07 -0700
> Cc: emacs-devel@gnu.org
>
> Hi Eli,
> I've added a few tests, but in the process discovered that
> something strange seems to be going on (possibly of the dynamic
> variable kind) so this patch should be put on hold until I understand
> what is going wrong. Best!
Thanks. Please take your time, there's no rush.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-02 5:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-01 2:16 [PATCH] lisp/net/browse-url.el allow fragments in file: urls Tom Gillespie
2021-04-01 7:20 ` Eli Zaretskii
2021-04-02 0:22 ` Tom Gillespie
2021-04-02 5:43 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.