bug#81666: 31.1; browse-url fails in emacsclient -nw
Abdulnafé Toulaïmat <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Eli Zaretskii <[email protected]> writes: >> From: Abdulnafé Toulaïmat >> <[email protected]> >> Date: Thu, 20 Aug 2026 21:53:24 +0200 >> >> ‘browse-url’ gives an error "funcall-interactively: Frames are not in use or >> not initialized", but only when called in an emacsclient TTY frame. It >> works fine in GUI frames, for both emacs and emacsclient, as well as in >> emacs TTY frames. >> >> Steps to reproduce: >> >> 1) emacs --daemon -Q >> 2) emacsclient -nw >> 3) M-x browse-url RET >> 4) https://www.gnu.org/software/emacs/ RET >> >> With ‘toggle-debug-on-error’, I get this trace: >> >> --8<---------------cut here---------------start------------->8--- >> Debugger entered--Lisp error: (error "Frames are not in use or not initialized") >> browse-url("https://www.gnu.org/software/emacs/" nil) >> funcall-interactively(browse-url "https://www.gnu.org/software/emacs/" nil) >> command-execute(browse-url record) >> #<subr execute-extended-command>(nil "browse-url" nil) >> apply(#<subr execute-extended-command> (nil "browse-url" nil)) >> execute-extended-command(nil "browse-url" nil) >> funcall-interactively(execute-extended-command nil "browse-url" nil) >> command-execute(execute-extended-command) >> --8<---------------cut here---------------end--------------->8--- > > This error is specific to a PGTK build, and comes from browse-url here: > > ;; When connected to various displays, be careful to use the display of > ;; the currently selected frame, rather than the original start display, > ;; which may not even exist any more. > (let ((dpy (frame-parameter nil 'display)) > classname) > (if (stringp dpy) > (cond > ((featurep 'pgtk) > (setq classname (pgtk-backend-display-class)) <<<<<<<<<<<<<<< > (if (equal classname "GdkWaylandDisplay") > (progn > ;; The `display' frame parameter is probably wrong. > ;; See bug#53969 for some context. > ;; (setenv "WAYLAND_DISPLAY" dpy) > ) > (setenv "DISPLAY" dpy))) > > All this is conditioned on "(frame-parameter nil 'display)" returning > a string, which AFAIU is not expected in the -nw case. So the first > question is: what does "(frame-parameter nil 'display)" yield in your > case, in the scenario you describe, just before you invoke browse-url > from the client frame? > > (FWIW, I tried to reproduce this in a PGTK build I have here, but > couldn't: I see no error in this case. And frame-parameter returns > nil in my case, as expected.) Hello, thanks for looking into this. In the emacsclient TTY frame, I get ":0". This does indeed appear to be the main culprit, because in an *emacs* TTY frame, I get nil, as you describe. -- Abdulnafé Toulaïmat