Ok I think it is better not to include tmux.el at all then, instead just
put the bit to copy in FAQ like this:

diff --git a/FAQ b/FAQ
index da72d43..c5abf01 100644
--- a/FAQ
+++ b/FAQ
@@ -238,6 +238,31 @@ would be welcome.
 
 vim users may also want to set the "ttyfast" option inside tmux.
 
+* How do I make ctrl and shift arrow keys work in emacs?
+
+The terminal-init-screen function in term/screen.el is called for new frames,
+but it doesn't configure any function keys.
+
+If the tmux xterm-keys option is on, it is enough to define the same keys as
+xterm. Add the following to init.el or .emacs to do this:
+
+(defadvice terminal-init-screen
+  ;; The advice is named `tmux', and is run before `terminal-init-screen' runs.
+  (before tmux activate)
+  ;; Docstring.  This describes the advice and is made available inside emacs;
+  ;; for example when doing C-h f terminal-init-screen RET
+  "Apply xterm keymap, allowing use of keys passed through tmux."
+  ;; This is the elisp code that is run before `terminal-init-screen'.
+  (if (getenv "TMUX")
+    (let ((map (copy-keymap xterm-function-map)))
+    (set-keymap-parent map (keymap-parent input-decode-map))
+    (set-keymap-parent input-decode-map map))))
+
+And ensure .tmux.conf contains "set -g xterm-keys on".
+
+Alternatively, the screen.el file can be copied to the load path and
+customized.
+
 * Why doesn't elinks set the window title inside tmux?
 
 There isn't a way to detect if a terminal supports setting the window title, so



On Mon, Feb 17, 2014 at 07:47:51PM -0500, Mark Oteiza wrote:
> Nicholas Marriott <nicholas.marri...@gmail.com> writes:
> 
> >> I wrote tmux.el, it's the Groups thread that gave me the clue.  I tried
> >> rewriting the useful bits from there into the file, as well as applying
> >> the other things you suggested.
> >> 
> >> On another note, the plugins that Suraj pointed out look nice.  In
> >> particular, Fixkeys seems to cover a lot.
> >> 
> > Hi
> >
> > Thanks.
> >
> > I tried to make your FAQ text clearer but I don't understand what the
> > FAQ entry is telling me to do.
> >
> > Should I copy screen.el into load path and edit it? Or tmux.el? Or both?
> > It seems like just tmux.el is enough if xterm-keys is on?
> >
> > So what should I do with tmux.el? Put it in load path and then require
> > 'tmux? Or something else?
> >
> > So maybe this text:
> >
> > --- >8 ---
> > * How do I make ctrl and shift arrow keys work in emacs?
> >
> > The terminal-init-screen function in term/screen.el is called for new
> > frames, but it doesn't configure any function keys.
> >
> > If the tmux xterm-keys option is on, it is enough to define the same
> > keys as xterm - use the examples/tmux.el file to do this.
> >
> > Alternatively, the screen.el file can be copied to the load path and
> > customized.
> > --- 8< ---
> 
> What you wrote is a lot clearer and concise than what I wrote.  Yes, you
> are right, either (a) customize screen.el, or (b) include the contents
> of examples/tmux.el in your init.el.
> 
> I meant examples/tmux.el as just a snippet of elisp rather than a
> library that can be require'd.  I try to communicate this (basically
> (b)) with this sentence from examples/tmux.el:
> 
> ;; This can be added to `~/.emacs/init.el' to get xterm keys in Emacs
> ;; & tmux, when `xterm-keys' is set to `on' in tmux.
> 
> Perhaps s/added to/inserted into/ would be clearer?
> 
> 
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to