bug#81666: 31.1; browse-url fails in emacsclient -nw

समीर सिंह Sameer Singh <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <CAOR1sLy6ztavSoY7+yX_sT3_kx_h2PqnC6RYf5W4VCen0fCMHg@mail.gmail.com>
Eli Zaretskii <[email protected]> writes:

>> From: Abdulnafé Toulaïmat
>>  <[email protected]>
>> Cc: Po Lu <[email protected]>,  Stefan Monnier <[email protected]>,
>>   martin rudalics <[email protected]>,  Yuuki Harano <[email protected]>,
>>   [email protected]
>> Date: Fri, 21 Aug 2026 08:55:36 +0200
>>
>> Eli Zaretskii <[email protected]> writes:
>>
>> > 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.

With some grepping it appears to be because of commit:
e2b64f8999f79a5820ba00d2987885d7dda492d5

which solves bug#54844

>
> So the next question is: how come that value of ":0" appears in a TTY
> frame?  Can anyone explain that?
>
> Regardless, we could apply a band-aid, whereby we condition this
> fragment on the frame being a GUI frame, in addition to testing the
> value of the parameter to be a string.
>
>
>

-- 
समीरसिंह
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.