From 587f237e93aa32b05f9415dff34c376e5b133c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Endsj=C3=B8?= Date: Thu, 23 May 2024 21:34:55 +0200 Subject: [PATCH] fix(org): avoid `(file-exists-p "file://")` on Windows Emacs bug#70914 handles `file://whatever` incorrectly, potentially crashing emacs. Fixed in emacs commit 350ae75f5c1c47a03560e43e8699781c04c9078a: Avoid crashes on MS-Windows due to invalid UNC file names * src/w32.c (parse_root): Avoid crashes due to invalid (too short) UNC names, such as "\\". (Bug#70914) --- modules/lang/org/config.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 8ae011dc8..0d34604da 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -502,6 +502,10 @@ relative to `org-directory', unless it is an absolute path." (org-link-set-parameters "file" :face (lambda (path) (if (or + ;; file uris is not a valid path on windows + ;; ref https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-05/threads.html#00729 + ;; emacs <= 29 crashes for (file-exists-p "file://whatever") + (if (featurep :system 'windows) (string-prefix-p "//" path)) (file-remote-p path) ;; filter out network shares on windows (slow) (if (featurep :system 'windows) (string-prefix-p "\\\\" path))