chiark / gitweb /
un-backslashify-selection: Handy X hack.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 5 May 2009 10:18:43 +0000 (11:18 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 5 May 2009 10:18:43 +0000 (11:18 +0100)
Now I'm using Emacs for reading email again, there's a small problem.
Long URLs are broken across lines with a backslash/newline pair.  This
makes them a bit tricky to paste into Iceweasel or whatever.

un-backslashify-selection reads the selection, kills the backslashes,
and rewrites the selection.  This command is bound to M5-F7, so pasting
is fairly painless.  (An extension is the right answer, but that's way
more work.)

e16-bindings
setup
un-backslashify-selection [new file with mode: 0755]

index 3677955ba1342b8ad51ab2e7d61f5524460e4080..1a4b870354398779df32801edc1c2df6753b2948 100644 (file)
@@ -33,6 +33,7 @@ KeyDown   S5     Down area move 0 1
 KeyDown   S5       Up area move 0 -1
 KeyDown   S5     Left area move -1 0
 KeyDown   S5    Right area move 1 0
+KeyDown    5       F7 exec un-backslashify-selection
 KeyDown    5       F8 exec xatom set XINIT_COMMAND :terminal
 KeyDown    5       F9 exec xatom set XINIT_COMMAND :ask-run
 KeyDown           5      F10 exec xatom set XINIT_COMMAND :ask-command
diff --git a/setup b/setup
index da1d071e88588a2e513c25e0fb6609b666d3afeb..0d39cdb14d812ee0d78a131a2bd2506bea9d64b7 100755 (executable)
--- a/setup
+++ b/setup
@@ -197,6 +197,7 @@ scripts="
   hyperspec"
 [ "$xstuff" ] && scripts="$scripts
   xinitcmd
+  un-backslashify-selection
   xshutdown"
 echo "Installing scripts..."
 mkdir -p $HOME$sub/bin
diff --git a/un-backslashify-selection b/un-backslashify-selection
new file mode 100755 (executable)
index 0000000..5bb279c
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+xsel -o | sed '
+       s:\\::g
+       H
+$      !d
+
+       x
+       s:\
+::g
+' | xsel -i