unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] term/rxvt: Enable bracketed paste mode
@ 2020-03-02  2:00 Daniel Gröber
  2020-03-03 20:22 ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Gröber @ 2020-03-02  2:00 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Gröber

rxvt-unicode uses the same escape sequences as xterm so just re-use
the xterm function to enable it.

The xterm-rxvt-function-map keymap already has

    (define-key map "\e[200~" [xterm-paste])

so we're already handling the paste sequence and only need to enable
it.

Tested on rxvt-unicode version 9.22.
---
 lisp/term/rxvt.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index ca6c468f52..d0a98e9618 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -171,7 +171,11 @@
   (xterm-register-default-colors rxvt-standard-colors)
   (rxvt-set-background-mode)
   ;; This recomputes all the default faces given the colors we've just set up.
-  (tty-set-up-initial-frame-faces))
+  (tty-set-up-initial-frame-faces)
+
+  ;; Unconditionally enable bracketed paste mode: terminals that don't
+  ;; support it just ignore the sequence.
+  (xterm--init-bracketed-paste-mode))
 
 ;; rxvt puts the default colors into an environment variable
 ;; COLORFGBG.  We use this to set the background mode in a more
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] term/rxvt: Enable bracketed paste mode
  2020-03-02  2:00 [PATCH] term/rxvt: Enable bracketed paste mode Daniel Gröber
@ 2020-03-03 20:22 ` Stefan Monnier
  2020-03-04  0:46   ` [PATCH v2 0/3] Improved rxvt support dxld
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2020-03-03 20:22 UTC (permalink / raw)
  To: Daniel Gröber; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/x-markdown; coding=UTF-8, Size: 728 bytes --]

> rxvt-unicode uses the same escape sequences as xterm so just re-use
> the xterm function to enable it.
>
> The xterm-rxvt-function-map keymap already has
>
>     (define-key map "\e[200~" [xterm-paste])
>
> so we're already handling the paste sequence and only need to enable it.

I don't have rxvt to test, but the patch looks good.  What I wonder if
whether it would make sense to use even more of `terminal-init-xterm` in
rxvt.el.
E.g. focus-tracking, frame-title?

I also see that terminal-init-xterm tries to detect when it's been
accidentally called in rxvt, and in that case it still keeps most of
terminal-init-xterm intact.  Apparently, this is right for
bracketed-paste, but what about the rest?


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] Improved rxvt support
  2020-03-03 20:22 ` Stefan Monnier
@ 2020-03-04  0:46   ` dxld
  2020-03-04  0:46     ` [PATCH v2 1/3] term/rxvt: Enable bracketed paste mode dxld
                       ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: dxld @ 2020-03-04  0:46 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Gröber

From: Daniel Gröber <dxld@darkboxed.org>

Hi Stefan,

On Tue, Mar 03, 2020 at 03:22:24PM -0500, Stefan Monnier wrote:
> I don't have rxvt to test, but the patch looks good.  What I wonder if
> whether it would make sense to use even more of `terminal-init-xterm` in
> rxvt.el.
> E.g. focus-tracking, frame-title?

urxvt doesn't have native focus tracking support, there are perl extensions
to do it but I don't see a good way to feature detect it. Either way the
control sequence would be different since perl extension cannot catch
arbitary seqs but just one specific CSI sequence.

I think it's best to leave that to users if they want support for
that. I added a terminal-init-rxvt-hook like in xtermel for that.

> I also see that terminal-init-xterm tries to detect when it's been
> accidentally called in rxvt, and in that case it still keeps most of
> terminal-init-xterm intact.  Apparently, this is right for
> bracketed-paste, but what about the rest?

As for {get,set}-selection there doesn't seem to be an equivalent upstream
and I also can't find any extension for that.

xterm-set-window-title looks to be compatible with rxvt though, I
copied that over.

--Daniel

Daniel Gröber (3):
  term/rxvt: Enable bracketed paste mode
  term/rxvt: Add window title support
  term/rxvt: Add terminal-init hook

 lisp/term/rxvt.el | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

--
2.20.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] term/rxvt: Enable bracketed paste mode
  2020-03-04  0:46   ` [PATCH v2 0/3] Improved rxvt support dxld
@ 2020-03-04  0:46     ` dxld
  2020-03-04  0:46     ` [PATCH v2 2/3] term/rxvt: Add window title support dxld
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: dxld @ 2020-03-04  0:46 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Gröber

From: Daniel Gröber <dxld@darkboxed.org>

rxvt-unicode uses the same escape sequences as xterm so just re-use
the xterm function to enable it.

The xterm-rxvt-function-map keymap already has

    (define-key map "\e[200~" [xterm-paste])

so we're already handling the paste sequence and only need to enable
it.

Tested on rxvt-unicode version 9.22.
---
 lisp/term/rxvt.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index ca6c468f52..d0a98e9618 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -171,7 +171,11 @@
   (xterm-register-default-colors rxvt-standard-colors)
   (rxvt-set-background-mode)
   ;; This recomputes all the default faces given the colors we've just set up.
-  (tty-set-up-initial-frame-faces))
+  (tty-set-up-initial-frame-faces)
+
+  ;; Unconditionally enable bracketed paste mode: terminals that don't
+  ;; support it just ignore the sequence.
+  (xterm--init-bracketed-paste-mode))
 
 ;; rxvt puts the default colors into an environment variable
 ;; COLORFGBG.  We use this to set the background mode in a more
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] term/rxvt: Add window title support
  2020-03-04  0:46   ` [PATCH v2 0/3] Improved rxvt support dxld
  2020-03-04  0:46     ` [PATCH v2 1/3] term/rxvt: Enable bracketed paste mode dxld
@ 2020-03-04  0:46     ` dxld
  2020-03-04  0:46     ` [PATCH v2 3/3] term/rxvt: Add terminal-init hook dxld
  2020-03-08 18:13     ` [PATCH v2 0/3] Improved rxvt support Stefan Monnier
  3 siblings, 0 replies; 9+ messages in thread
From: dxld @ 2020-03-04  0:46 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Gröber

From: Daniel Gröber <dxld@darkboxed.org>

---
 lisp/term/rxvt.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index d0a98e9618..6250809abb 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -26,6 +26,16 @@
 
 (require 'term/xterm)
 
+(defgroup rxvt nil
+  "(U)RXVT support."
+  :version "28.1"
+  :group 'terminals)
+
+(defcustom rxvt-set-window-title nil
+  "Whether Emacs should set window titles to an Emacs frame in RXVT."
+  :version "28.1"
+  :type 'boolean)
+
 (defvar rxvt-function-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map xterm-rxvt-function-map)
@@ -175,7 +185,10 @@
 
   ;; Unconditionally enable bracketed paste mode: terminals that don't
   ;; support it just ignore the sequence.
-  (xterm--init-bracketed-paste-mode))
+  (xterm--init-bracketed-paste-mode)
+
+  (when rxvt-set-window-title
+    (xterm--init-frame-title)))
 
 ;; rxvt puts the default colors into an environment variable
 ;; COLORFGBG.  We use this to set the background mode in a more
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] term/rxvt: Add terminal-init hook
  2020-03-04  0:46   ` [PATCH v2 0/3] Improved rxvt support dxld
  2020-03-04  0:46     ` [PATCH v2 1/3] term/rxvt: Enable bracketed paste mode dxld
  2020-03-04  0:46     ` [PATCH v2 2/3] term/rxvt: Add window title support dxld
@ 2020-03-04  0:46     ` dxld
  2020-03-08 18:13     ` [PATCH v2 0/3] Improved rxvt support Stefan Monnier
  3 siblings, 0 replies; 9+ messages in thread
From: dxld @ 2020-03-04  0:46 UTC (permalink / raw)
  To: emacs-devel; +Cc: Daniel Gröber

From: Daniel Gröber <dxld@darkboxed.org>

---
 lisp/term/rxvt.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 6250809abb..31e3d6ede4 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -188,7 +188,9 @@
   (xterm--init-bracketed-paste-mode)
 
   (when rxvt-set-window-title
-    (xterm--init-frame-title)))
+    (xterm--init-frame-title))
+
+  (run-hooks 'terminal-init-rxvt-hook))
 
 ;; rxvt puts the default colors into an environment variable
 ;; COLORFGBG.  We use this to set the background mode in a more
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/3] Improved rxvt support
  2020-03-04  0:46   ` [PATCH v2 0/3] Improved rxvt support dxld
                       ` (2 preceding siblings ...)
  2020-03-04  0:46     ` [PATCH v2 3/3] term/rxvt: Add terminal-init hook dxld
@ 2020-03-08 18:13     ` Stefan Monnier
  2020-03-08 19:33       ` Daniel Gröber
  3 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2020-03-08 18:13 UTC (permalink / raw)
  To: dxld; +Cc: emacs-devel

Thanks Daniel, I just pushed those 3 (squashed and with minor tweaks to
the commit messages).

Sorry it took a bit longer than planned,


        Stefan


> From: Daniel Gröber <dxld@darkboxed.org>
>
> Hi Stefan,
>
> On Tue, Mar 03, 2020 at 03:22:24PM -0500, Stefan Monnier wrote:
>> I don't have rxvt to test, but the patch looks good.  What I wonder if
>> whether it would make sense to use even more of `terminal-init-xterm` in
>> rxvt.el.
>> E.g. focus-tracking, frame-title?
>
> urxvt doesn't have native focus tracking support, there are perl extensions
> to do it but I don't see a good way to feature detect it. Either way the
> control sequence would be different since perl extension cannot catch
> arbitary seqs but just one specific CSI sequence.
>
> I think it's best to leave that to users if they want support for
> that. I added a terminal-init-rxvt-hook like in xtermel for that.
>
>> I also see that terminal-init-xterm tries to detect when it's been
>> accidentally called in rxvt, and in that case it still keeps most of
>> terminal-init-xterm intact.  Apparently, this is right for
>> bracketed-paste, but what about the rest?
>
> As for {get,set}-selection there doesn't seem to be an equivalent upstream
> and I also can't find any extension for that.
>
> xterm-set-window-title looks to be compatible with rxvt though, I
> copied that over.
>
> --Daniel
>
> Daniel Gröber (3):
>   term/rxvt: Enable bracketed paste mode
>   term/rxvt: Add window title support
>   term/rxvt: Add terminal-init hook
>
>  lisp/term/rxvt.el | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
>
> --
> 2.20.1




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/3] Improved rxvt support
  2020-03-08 18:13     ` [PATCH v2 0/3] Improved rxvt support Stefan Monnier
@ 2020-03-08 19:33       ` Daniel Gröber
  2020-03-08 23:20         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Gröber @ 2020-03-08 19:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Sun, Mar 08, 2020 at 02:13:51PM -0400, Stefan Monnier wrote:
> Thanks Daniel, I just pushed those 3 (squashed and with minor tweaks to
> the commit messages).

Ah, sorry. I wasn't sure whether I should just amend the changes or not,
but thanks!

> Sorry it took a bit longer than planned,

No worries, I'm positively surprised by the <1mo response time on this ML
anyways :)

--Daniel

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/3] Improved rxvt support
  2020-03-08 19:33       ` Daniel Gröber
@ 2020-03-08 23:20         ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2020-03-08 23:20 UTC (permalink / raw)
  To: Daniel Gröber; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/x-markdown; coding=UTF-8, Size: 397 bytes --]

> Ah, sorry. I wasn't sure whether I should just amend the changes or not,
> but thanks!

The patches were fine, it was just the lack of commit-message for the other
two and the fact that the commit-message on the first lacked a bit of
detail (naming the affected file(s) and functions(s), basically).

Check the `CONTRIBUTE` file for the details of the format we like to use.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-08 23:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02  2:00 [PATCH] term/rxvt: Enable bracketed paste mode Daniel Gröber
2020-03-03 20:22 ` Stefan Monnier
2020-03-04  0:46   ` [PATCH v2 0/3] Improved rxvt support dxld
2020-03-04  0:46     ` [PATCH v2 1/3] term/rxvt: Enable bracketed paste mode dxld
2020-03-04  0:46     ` [PATCH v2 2/3] term/rxvt: Add window title support dxld
2020-03-04  0:46     ` [PATCH v2 3/3] term/rxvt: Add terminal-init hook dxld
2020-03-08 18:13     ` [PATCH v2 0/3] Improved rxvt support Stefan Monnier
2020-03-08 19:33       ` Daniel Gröber
2020-03-08 23:20         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).