bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55883: [PATCH] Update X Primary Selection with active regions


From: Duncan Findlay
Subject: bug#55883: [PATCH] Update X Primary Selection with active regions
Date: Tue, 14 Jun 2022 19:01:58 -0700

On Tue, Jun 14, 2022 at 5:15 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Duncan Findlay <duncf@google.com>
> > Date: Mon, 13 Jun 2022 23:36:13 -0700
> > Cc: 55883@debbugs.gnu.org
> >
> > > > --- a/lisp/frame.el
> > > > +++ b/lisp/frame.el
> > > > @@ -2164,6 +2164,8 @@ display-selections-p
> > > >         (not (null dos-windows-version))))
> > > >       ((memq frame-type '(x w32 ns pgtk))
> > > >        t)
> > > > +     ((terminal-parameter display 'display-selections-p)
> > > > +      t)
> > >
> > > This should test xterm--set-selection parameter.
> >
> > OK, so the goal is to check the xterm--set-selection terminal
> > parameter and variable xterm-select-active-regions before selecting
> > the active region in deactivate-mark in simple.el.
> >
> > We could do this in display-selections-p, but given that these
> > variables are not obviously related to display-selections-p, it seems
> > to me we probably want to do this check in deactivate-mark instead.
> > Does that seem reasonable to you?
>
> I think I'd prefer to have it in display-selections-p, like your last
> version did, just using xterm--set-selection terminal parameter, not
> the new one you invented.

Updated.

> > > I think the code should instead check the value of
> > > xterm-select-active-regions in keyboard.c, where it decides whether to
> > > set PRIMARY.  (Let me know if you need guidance for how to reference a
> > > Lisp variable from C.)
> >
> > This seems to work -- is there a better way?
> >
> > !NILP (SYMBOL_VAL (XSYMBOL (Qxterm_select_active_regions)))
>
> This is not safe, IMO.  I think this is better:
>
>   if ((!NILP (Fwindow_system (Qnil))
>        || ((symval = find_symbol_value (Qxterm_select_active_regions),
>             (!EQ (symval, Qunbound) && !NILP (symval)))
>             && !NILP (Fterminal_parameter (Qnil, Qxterm__set_selection))))

Thanks, I would never have figured that out myself.

> > I've also addressed Po's comments about long conditionals.
>
> Thanks, the patch LGTM, modulo the above 2 minor nits.

Duncan

Attachment: 0001-Support-select-active-regions-with-xterm.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]