Re: if-shell 'tmux has-session' hangs
Probably epoll bug in Linux. If you are using libevent 1.4 NOEPOLL can trigger a different bug in libevent though :-/. On Fri, Apr 29, 2011 at 08:32:14AM -0700, Randy Stauner wrote: >yes it does. >i also had my first experience of tmux completely not responding... >(only happened once so far). >since i have "tmux list-sessions" in my .bashrc >I had to open a new xterm with a different shell (dash) just to be able to >issue a "killall tmux". >Was this hang related to the NOEPOLL or should i just go back to using the >1.4 release? > >On Fri, Apr 29, 2011 at 12:06 AM, Nicholas Marriott ><[1]nicholas.marri...@gmail.com> wrote: > > If you kill tmux entirely and export EVENT_NOEPOLL=1 before starting it > again does the problem go away? > > On Thu, Apr 28, 2011 at 09:43:12AM -0700, Randy Stauner wrote: > > ** **I was trying to source a conf file to create default windows, > > ** **but it seems that when doing > > ** **if-shell "tmux has-session -t auto" "display-message yes" > > ** **tmux seems to hang on the "has-session" call if the session does > not > > ** **exist. > > ** **I can see these in a ps: > > ** **rando ** **27867 **0.0 **0.0 ** 1832 ** 496 ? ** ** ** **S ** > **08:51 ** 0:00 sh -c > > ** **tmux has-session -t auto > > ** **rando ** **27868 **0.0 **0.0 ** 2968 **1072 ? ** ** ** **S ** > **08:51 ** 0:00 tmux > > ** **has-session -t auto > > ** **I think they'll sit there like that forever. > > ** **If I kill the child process (27868 in the example) with SIGTERM > then, > > ** **ironically, my tmux session will display the message. > > ** **If I send a SIGKILL I see nothing. > > ** **If i run it from my shell (using "tmux if-shell ..." instead of > the tmux > > ** **command prompt) > > ** **my shell will just hang. **It won't even respond to SIGINT > (Ctrl-C). > > ** **I have to switch to another window and kill it. > > ** **If the session *does* exist (tmux if-shell "tmux has-session -t > 0" > > ** **"display-message hi") > > ** **it returns immediately and displays the expected message. > > ** **I also don't see any problems with has-session without the > if-shell. > > ** **I have experienced the same thing with the following > configurations: > > ** **tmux 1.4 and 1.5 from the sourceforge CVS (as of > 2011-4-28T16:12:48Z). > > ** **Ubuntu 10.04.2 LTS: Linux 2.6.32-31-generic #61-Ubuntu SMP Fri > Apr 8 > > ** **18:24:35 UTC 2011 i686 GNU/Linux > > ** **libevent 1.4 > > ** **tmux 1.4 > > ** **Debian 5.0.5: Linux 2.6.26-2-686-bigmem #1 SMP Wed Nov 4 21:12:12 > UTC 2009 > > ** **i686 GNU/Linux > > ** **libevent 2.0 > > ** **I've tried it all through the same gui terminal (xfce4-terminal > with > > ** **TERM=xterm-256color). > > ** **Let me know if you'd like any more info or if there's something > else I > > ** **should try. > > ** **Thanks! > > ** **- Randy > > > > > -- > > WhatsUp Gold - Download Free Network Management Software > > The most intuitive, comprehensive, and cost-effective network > > management toolset available today. **Delivers lowest initial > > acquisition cost and overall TCO of any competing solution. > > [2]http://p.sf.net/sfu/whatsupgold-sd > > > ___ > > tmux-users mailing list > > [3]tmux-users@lists.sourceforge.net > > [4]https://lists.sourceforge.net/lists/listinfo/tmux-users > > References > >Visible links >1. mailto:nicholas.marri...@gmail.com >2. http://p.sf.net/sfu/whatsupgold-sd >3. mailto:tmux-users@lists.sourceforge.net >4. https://lists.sourceforge.net/lists/listinfo/tmux-users -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users
Re: bind a key to multiple commands in copy mode
I only seem to be getting half of this exchange, where is this patch? On Fri, Apr 29, 2011 at 04:45:34PM -0700, Randy Stauner wrote: >I added copy-end-of-line on top of the last two patches. >In copy mode it selects from the cursor to the end of the line, then >copies and exits. >Is that what you were thinking Nicholas? >I tested it in vi and emacs mode, it works for me. >I bound it to D (vi) and C-k (emacs) to be consistent with edit-mode >and adjusted the documentation slightly. >If people like these changes I'd be willing to try my hand at documenting >the rest of them. >Also, should we setup default key-bindings for the other ones? >So far i like this thread! >Thanks everybody! >On Fri, Apr 29, 2011 at 3:35 PM, Randy Stauner ><[1]ra...@magnificent-tears.com> wrote: > > Very nice! I will use this. > I must admit I still find myself too lazy to want to hit Enter > afterwards, though, > since this only selects the lines. > I did think the feature might be useful, though, > so I changed your function to 'select-line' and defined 'copy-line' > to additionally copy the selection and exit copy-mode. > I'm attaching two patches: >- select-line-after-copy.patch can be applied on top of your last > patch >- select-and-copy-line.patch can be applied to sf cvs as > of 2011-04-29T22:32:14Z > Note I did put a comment in there.. > I'm not sure if there should be an additional "if (sess != NULL)" check > in there > or if the code above ensures it's there. > Please forgive my rusty C code, it's been a while, and it's never been > good. > > On Fri, Apr 29, 2011 at 2:14 PM, Dave Disser <[2]dis...@gmail.com> > wrote: > >Yes, I goofed it up spectacularly! Here's the correct patch. >--Dave > >On Fri, Apr 29, 2011 at 1:40 PM, Randy Stauner ><[3]ra...@magnificent-tears.com> wrote: > > is this patch missing something? > it looks awfully short and doesn't make sense to me... it just looks > like a line was moved up. > It doesn't apply to sf cvs and if i just add the line it won't > compile. > Is there some other patch i need to apply first, or is this for a > different branch or is the patch incomplete? > Thanks. > > On Fri, Apr 29, 2011 at 11:13 AM, Dave Disser <[4]dis...@gmail.com> > wrote: > >I decided I didn't like my kludge. Here's a proper copy-line with >working prefix arg. I also have another patch to use a single >function for begin-selection and copy-selection since I like to >have both bound to the same key, if anyone's interested. >--Dave > >On Thu, Apr 28, 2011 at 6:49 PM, Randy Stauner ><[5]ra...@magnificent-tears.com> wrote: > > thanks for the idea. > I definitely must applaud the effort. > you've given me an idea for the 5Y option... if i ever take it > any further i'll write back. > > On Thu, Apr 28, 2011 at 12:55 PM, Dave Disser > <[6]dis...@gmail.com> wrote: > >I *just* subscribed now, but I was wrestling with nearly the >same problem yesterday. Here's my kludge of rebinding with >unprefixed keys. >Hard to follow, I know, but the gist is that when entering >copy mode it rebinds y and Enter (unprefixed) to source >scripts. The scripts in turn do actions and rebind other >keys. In order to execute copy-mode actions from the global >bindings, it rebinds the copy-mode actions to a temporary key >T, then send-keys T to execute the action. I'm sure there are >bugs in this if there are ways to exit out of copy mode that I >haven't considered. >I think the cleaner solution would be to allow the full >command parser in all the key tables, but this was easier than >making that change to the source. >.tmux.conf: >bind-key C-c source-file /home/disser/.tmux-copy-mode >/home/disser/.tmux-copy-mode: >bind-key -n y send-keys 0 \; source >"/home/disser/.tmux-begin-selection" \; send-keys "\$" >bind-key -n Enter source /home/disser/.tmux-begin-selection >bind-key -n q source /home/disser/.tmux-cancel-selection >copy-mode >/home/disser/.tmux-begin-selection: >bind-key -n y source /home/disser/.tmux-copy-selection >bind-key -n Enter source /home/disser/.tmux-copy-selection >bind-key -t vi-copy T begin-selection >send-keys T >unbin
Re: bind a key to multiple commands in copy mode
Sorry about that. Attached is a full patch containing Dave's initial work and my additions for: select-line, copy-line, and copy-end-of-line. Let me know if you'd prefer incremental patches or if you need them based off of a different point in the source history. Thanks! On Sat, Apr 30, 2011 at 3:39 AM, Nicholas Marriott < nicholas.marri...@gmail.com> wrote: > I only seem to be getting half of this exchange, where is this patch? > > diff --git a/mode-key.c b/mode-key.c index 89c3e90..4938de1 100644 --- a/mode-key.c +++ b/mode-key.c @@ -82,6 +82,8 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_BOTTOMLINE, "bottom-line" }, { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_CLEARSELECTION, "clear-selection" }, + { MODEKEYCOPY_COPYLINE, "copy-line" }, + { MODEKEYCOPY_COPYENDOFLINE, "copy-end-of-line" }, { MODEKEYCOPY_COPYSELECTION, "copy-selection" }, { MODEKEYCOPY_DOWN, "cursor-down" }, { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, @@ -110,6 +112,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_SEARCHDOWN, "search-forward" }, { MODEKEYCOPY_SEARCHREVERSE, "search-reverse" }, { MODEKEYCOPY_SEARCHUP, "search-backward" }, + { MODEKEYCOPY_SELECTLINE, "select-line" }, { MODEKEYCOPY_STARTNUMBERPREFIX, "start-number-prefix" }, { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, @@ -198,6 +201,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { ':', 0, MODEKEYCOPY_GOTOLINE }, { '?', 0, MODEKEYCOPY_SEARCHUP }, { 'B', 0, MODEKEYCOPY_PREVIOUSSPACE }, + { 'D', 0, MODEKEYCOPY_COPYENDOFLINE }, { 'E', 0, MODEKEYCOPY_NEXTSPACEEND }, { 'F', 0, MODEKEYCOPY_JUMPBACK }, { 'G', 0, MODEKEYCOPY_HISTORYBOTTOM }, @@ -323,6 +327,7 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { '\005' /* C-e */, 0, MODEKEYCOPY_ENDOFLINE }, { '\006' /* C-f */, 0, MODEKEYCOPY_RIGHT }, { '\007' /* C-g */, 0, MODEKEYCOPY_CLEARSELECTION }, + { '\013' /* C-k */, 0, MODEKEYCOPY_COPYENDOFLINE }, { '\016' /* C-n */, 0, MODEKEYCOPY_DOWN }, { '\020' /* C-p */, 0, MODEKEYCOPY_UP }, { '\022' /* C-r */, 0, MODEKEYCOPY_SEARCHUP }, diff --git a/tmux.1 b/tmux.1 index d0a92a5..cb41d42 100644 --- a/tmux.1 +++ b/tmux.1 @@ -770,7 +770,7 @@ The following keys are supported as appropriate for the mode: .It Li "Cursor to top line" Ta "H" Ta "M-R" .It Li "Cursor up" Ta "k" Ta "Up" .It Li "Delete entire line" Ta "d" Ta "C-u" -.It Li "Delete to end of line" Ta "D" Ta "C-k" +.It Li "Delete/Copy to end of line" Ta "D" Ta "C-k" .It Li "End of line" Ta "$" Ta "C-e" .It Li "Go to line" Ta ":" Ta "g" .It Li "Half page down" Ta "C-d" Ta "M-Down" diff --git a/tmux.h b/tmux.h index 89ea61b..c62183f 100644 --- a/tmux.h +++ b/tmux.h @@ -454,6 +454,8 @@ enum mode_key_cmd { MODEKEYCOPY_BOTTOMLINE, MODEKEYCOPY_CANCEL, MODEKEYCOPY_CLEARSELECTION, + MODEKEYCOPY_COPYLINE, + MODEKEYCOPY_COPYENDOFLINE, MODEKEYCOPY_COPYSELECTION, MODEKEYCOPY_DOWN, MODEKEYCOPY_ENDOFLINE, @@ -484,6 +486,7 @@ enum mode_key_cmd { MODEKEYCOPY_SEARCHDOWN, MODEKEYCOPY_SEARCHREVERSE, MODEKEYCOPY_SEARCHUP, + MODEKEYCOPY_SELECTLINE, MODEKEYCOPY_STARTNUMBERPREFIX, MODEKEYCOPY_STARTOFLINE, MODEKEYCOPY_STARTSELECTION, diff --git a/window-copy.c b/window-copy.c index 123cc21..1c4d55a 100644 --- a/window-copy.c +++ b/window-copy.c @@ -500,6 +500,26 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key) window_copy_start_selection(wp); window_copy_redraw_screen(wp); break; + case MODEKEYCOPY_COPYLINE: + // copy-line includes select-line + case MODEKEYCOPY_SELECTLINE: + // only move to the beginning for select or copy line + window_copy_cursor_start_of_line(wp); + case MODEKEYCOPY_COPYENDOFLINE: + window_copy_start_selection(wp); + for (; np > 1; np--) + window_copy_cursor_down(wp, 0); + window_copy_cursor_end_of_line(wp); + window_copy_redraw_screen(wp); + + // do we need to check if sess != NULL + // or do we know it's not because of the above copying? + if (cmd == MODEKEYCOPY_COPYLINE || cmd == MODEKEYCOPY_COPYENDOFLINE) { + window_copy_copy_selection(wp); + window_pane_reset_mode(wp); + return; + } + break; case MODEKEYCOPY_CLEARSELECTION: window_copy_clear_selection(wp); window_copy_redraw_screen(wp); -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd___ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users
Re: bind a key to multiple commands in copy mode
If copy and select line are the same surely there is no need for both? Also please use C89 block comments (/* */) not C++ comments. On Sat, Apr 30, 2011 at 11:24:18AM -0700, Randy Stauner wrote: >Sorry about that. >Attached is a full patch containing Dave's initial work >and my additions for:**select-line, copy-line, and copy-end-of-line. >Let me know if you'd prefer incremental patches >or if you need them based off of a different point in the source history. >Thanks! >On Sat, Apr 30, 2011 at 3:39 AM, Nicholas Marriott ><[1]nicholas.marri...@gmail.com> wrote: > > I only seem to be getting half of this exchange, where is this patch? > > References > >Visible links >1. mailto:nicholas.marri...@gmail.com -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd ___ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users
Re: bind a key to multiple commands in copy mode
Dave's original command highlighted the line(s), but did not immediately copy it (you still had to hit Enter). We may not need both commands, but I wanted to respect Dave's contribution. I didn't want to remove the select-only version if that functionality was desirable to anyone so I renamed his to select-line and added copy-line to additionally copy the selection and exit copy mode. I apologize for my uneducated C code, thank you for bearing with me. I have attached a patch with fixed (and additional) comments. On Sat, Apr 30, 2011 at 11:44 AM, Nicholas Marriott < nicholas.marri...@gmail.com> wrote: > If copy and select line are the same surely there is no need for both? > Also please use C89 block comments (/* */) not C++ comments. > > > > On Sat, Apr 30, 2011 at 11:24:18AM -0700, Randy Stauner wrote: > >Sorry about that. > >Attached is a full patch containing Dave's initial work > >and my additions for:**select-line, copy-line, and copy-end-of-line. > >Let me know if you'd prefer incremental patches > >or if you need them based off of a different point in the source > history. > >Thanks! > >On Sat, Apr 30, 2011 at 3:39 AM, Nicholas Marriott > ><[1]nicholas.marri...@gmail.com> wrote: > > > > I only seem to be getting half of this exchange, where is this > patch? > > > > References > > > >Visible links > >1. mailto:nicholas.marri...@gmail.com > > > diff --git a/mode-key.c b/mode-key.c index 89c3e90..4938de1 100644 --- a/mode-key.c +++ b/mode-key.c @@ -82,6 +82,8 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_BOTTOMLINE, "bottom-line" }, { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_CLEARSELECTION, "clear-selection" }, + { MODEKEYCOPY_COPYLINE, "copy-line" }, + { MODEKEYCOPY_COPYENDOFLINE, "copy-end-of-line" }, { MODEKEYCOPY_COPYSELECTION, "copy-selection" }, { MODEKEYCOPY_DOWN, "cursor-down" }, { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, @@ -110,6 +112,7 @@ const struct mode_key_cmdstr mode_key_cmdstr_copy[] = { { MODEKEYCOPY_SEARCHDOWN, "search-forward" }, { MODEKEYCOPY_SEARCHREVERSE, "search-reverse" }, { MODEKEYCOPY_SEARCHUP, "search-backward" }, + { MODEKEYCOPY_SELECTLINE, "select-line" }, { MODEKEYCOPY_STARTNUMBERPREFIX, "start-number-prefix" }, { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, @@ -198,6 +201,7 @@ const struct mode_key_entry mode_key_vi_copy[] = { { ':', 0, MODEKEYCOPY_GOTOLINE }, { '?', 0, MODEKEYCOPY_SEARCHUP }, { 'B', 0, MODEKEYCOPY_PREVIOUSSPACE }, + { 'D', 0, MODEKEYCOPY_COPYENDOFLINE }, { 'E', 0, MODEKEYCOPY_NEXTSPACEEND }, { 'F', 0, MODEKEYCOPY_JUMPBACK }, { 'G', 0, MODEKEYCOPY_HISTORYBOTTOM }, @@ -323,6 +327,7 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { '\005' /* C-e */, 0, MODEKEYCOPY_ENDOFLINE }, { '\006' /* C-f */, 0, MODEKEYCOPY_RIGHT }, { '\007' /* C-g */, 0, MODEKEYCOPY_CLEARSELECTION }, + { '\013' /* C-k */, 0, MODEKEYCOPY_COPYENDOFLINE }, { '\016' /* C-n */, 0, MODEKEYCOPY_DOWN }, { '\020' /* C-p */, 0, MODEKEYCOPY_UP }, { '\022' /* C-r */, 0, MODEKEYCOPY_SEARCHUP }, diff --git a/tmux.1 b/tmux.1 index d0a92a5..cb41d42 100644 --- a/tmux.1 +++ b/tmux.1 @@ -770,7 +770,7 @@ The following keys are supported as appropriate for the mode: .It Li "Cursor to top line" Ta "H" Ta "M-R" .It Li "Cursor up" Ta "k" Ta "Up" .It Li "Delete entire line" Ta "d" Ta "C-u" -.It Li "Delete to end of line" Ta "D" Ta "C-k" +.It Li "Delete/Copy to end of line" Ta "D" Ta "C-k" .It Li "End of line" Ta "$" Ta "C-e" .It Li "Go to line" Ta ":" Ta "g" .It Li "Half page down" Ta "C-d" Ta "M-Down" diff --git a/tmux.h b/tmux.h index 89ea61b..c62183f 100644 --- a/tmux.h +++ b/tmux.h @@ -454,6 +454,8 @@ enum mode_key_cmd { MODEKEYCOPY_BOTTOMLINE, MODEKEYCOPY_CANCEL, MODEKEYCOPY_CLEARSELECTION, + MODEKEYCOPY_COPYLINE, + MODEKEYCOPY_COPYENDOFLINE, MODEKEYCOPY_COPYSELECTION, MODEKEYCOPY_DOWN, MODEKEYCOPY_ENDOFLINE, @@ -484,6 +486,7 @@ enum mode_key_cmd { MODEKEYCOPY_SEARCHDOWN, MODEKEYCOPY_SEARCHREVERSE, MODEKEYCOPY_SEARCHUP, + MODEKEYCOPY_SELECTLINE, MODEKEYCOPY_STARTNUMBERPREFIX, MODEKEYCOPY_STARTOFLINE, MODEKEYCOPY_STARTSELECTION, diff --git a/window-copy.c b/window-copy.c index 123cc21..cc4824a 100644 --- a/window-copy.c +++ b/window-copy.c @@ -500,6 +500,28 @@ window_copy_key(struct window_pane *wp, struct session *sess, int key) window_copy_start_selection(wp); window_copy_redraw_screen(wp); break; + case MODEKEYCOPY_COPYLINE: + /* copy-line includes select-line */ + case MODEKEYCOPY_SELECTLINE: + /* only move to the beginning for select or copy line */ + window_copy_cursor_start_of_line(wp); + case MODEKEYCOPY_COPYENDOFLINE: + window_copy_start_selection(wp); + for (; np > 1; np--) + window_copy_cursor_down(wp, 0); + window_copy_cursor_end_of_line(wp); + window_copy_redraw_screen(wp); + + /* if it was a copy command copy the selection and exit */ + /* do we