emacs-devel
[Top][All Lists]
Advanced

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

Re: Set X primary selection with Emacs in xterm


From: Duncan Findlay
Subject: Re: Set X primary selection with Emacs in xterm
Date: Fri, 10 Jun 2022 19:03:50 -0700

On Fri, Jun 10, 2022 at 12:38 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Duncan Findlay <duncf@google.com>
> > Date: Fri, 10 Jun 2022 11:10:50 -0700
> > Cc: emacs-devel@gnu.org
> >
> > On Thu, Jun 2, 2022 at 11:56 PM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > Thanks.  I think we should solve this differently.  I don't think it's
> > > a good idea to call arbitrary Lisp from input-processing loop in
> > > keyboard.c, anymore than we already do (which is already too much,
> > > IMNSHO), especially if we envision advices for that code.
> > >
> > > We should instead modify the condition in command_loop_1 to support
> > > terminals that can set GUI selections.  terminal-parameter is a
> > > primitive written in C, so command_loop_1 could call it directly (it
> > > should also pay attention to the defcustom described below).
> >
> > I considered this, but given that we're making the same decision in
> > lisp/simple.el (deactivate-mark) using display-selections-p, the
> > benefits of sharing an implementation seemed compelling.
>
> That's not what bothers me, as I explain above.  I don't want us to
> call more Lisp from the loop that processes keyboard input, if that
> can be avoided.  And in this case, it can be easily avoided.
>
> > I see your point about wanting to minimize lisp in the command loop.
> > Can we just port display-selections-p to C and use it from both
> > places, or will that break things?
>
> I see no need for doing that.  display-selections-p is okay in Lisp,
> as it is called from Lisp programs.

Got it -- thanks. This ended up being not nearly as difficult as I'd feared.

> > > > +     ((and (memq frame-type '(t))
> > > > +           (eq (terminal-parameter nil 'xterm--set-selection) t))
> > > > +      t)
> > >
> > > This is unnecessarily strict: there should be no need to test
> > > frame-type, since any frame type could arrange for this parameter when
> > > it supports selections.
> >
> > In practice, are there other frame types? Is it reasonable to set
> > terminal-parameter for other frame types?
>
> Maybe not today, but I'd like this code to be more future-proof.
> There's no need to test for more things that are absolutely necessary,
> and testing for the xterm--set-selection parameter is enough in this
> case, isn't it?

I've sent a new version that addresses this, too.
https://debbugs.gnu.org/55883

Thanks for bearing with me on this.


Duncan



reply via email to

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