Subject: 31.0.50; browse-url-emacs (url-file-handler) errors when eglot is loaded

From: Nick OBrien <[email-masked]>
Date: Sat, 20 Jul 2024 00:56:38 +0000

Steps to reproduce:

    emacs -Q

    (require 'eglot)
    (setq debug-on-error t)
    (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt")

There is an error, but after the gpl-3.0.txt buffer is populated.  I got
this backtrace (with long arguments manually replaced with ...):

    Debugger entered--Lisp error: (void-function nil)
      nil(...)
      url-directory-files("https://www.gnu.org/licenses/" nil ... t nil)
      apply(url-directory-files ("https://www.gnu.org/licenses/" nil ... t nil))
      url-file-handler(directory-files "https://www.gnu.org/licenses/" nil ... t nil)
      directory-files("https://www.gnu.org/licenses/" nil ... t)
      #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>)("https://www.gnu.org/licenses/")
      locate-dominating-file("https://www.gnu.org/licenses/" #f(compiled-function (d) #<bytecode 0x183c21e239c1e2a3>))
      project-try-vc("https://www.gnu.org/licenses/")
      run-hook-with-args-until-success(project-try-vc "https://www.gnu.org/licenses/")
      project--find-in-directory("https://www.gnu.org/licenses/")
      project-current()
      eglot--current-project()
      eglot-current-server()
      eglot--maybe-activate-editing-mode()
      run-hooks(after-change-major-mode-hook)
      run-mode-hooks(text-mode-hook)
      text-mode()
      set-auto-mode-0(text-mode nil)
      set-auto-mode--apply-alist(... nil nil)
      set-auto-mode()
      normal-mode(t)
      after-find-file(nil t)
      find-file-noselect-1(#<buffer gpl-3.0.txt> "https://www.gnu.org/licenses/gpl-3.0.txt" nil nil "https://www.gnu.org/licenses/gpl-3.0.txt" (nil nil))
      find-file-noselect("https://www.gnu.org/licenses/gpl-3.0.txt" nil nil nil)
      find-file-other-window("https://www.gnu.org/licenses/gpl-3.0.txt")
      browse-url-emacs("https://www.gnu.org/licenses/gpl-3.0.txt")
      (progn (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt"))
      eval((progn (browse-url-emacs "https://www.gnu.org/licenses/gpl-3.0.txt")) t)
      elisp--eval-last-sexp(nil)
      #f(compiled-function () #<bytecode 0x29ba0505e5b8a>)()
      eval-last-sexp(nil)
      funcall-interactively(eval-last-sexp nil)
      command-execute(eval-last-sexp)

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.0, Xaw3d scroll bars)
Repository revision: 99b360bb5aabf324cf038c27ac76ac1513319754
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: NixOS 24.05 (Uakari)

Configured using:
 'configure
 --prefix=/nix/store/1wzjg52vljqzzwgj3i1wvlq8ybz8safl-emacs-git-20240718.0
 --disable-build-details --with-modules --with-x-toolkit=lucid
 --with-cairo --with-xft --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --with-xinput2 --without-xwidgets --with-dbus
 --with-selinux'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr jka-compr misearch multi-isearch emacsbug
help-fns radix-tree cl-extra cl-print mm-archive message sendmail
yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config gnus-util mailabbrev gmm-utils mailheader mm-decode
mm-bodies mm-encode mail-utils gnutls network-stream url-cache url-dav
parse-time iso8601 xml url-http url-auth mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny url-handlers
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf mailcap eglot
external-completion jsonrpc xref flymake thingatpt project compat diff
diff-mode track-changes easy-mmode ert pp ewoc debug backtrace help-mode
find-func filenotify warnings compile text-property-search comint
ansi-osc ansi-color ring pcase url-util url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json map byte-opt gv
bytecomp byte-compile url-vars imenu time-date subr-x cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 176537 29166) (symbols 48 11470 0) (strings 32 36163 1998)
 (string-bytes 1 1251305) (vectors 16 22615)
 (vector-slots 8 273895 25920) (floats 8 60 96) (intervals 56 3301 59)
 (buffers 992 17))