Permalink
Browse files

Import upstream snapshot from SVN r2630

  • Loading branch information...
1 parent b016948 commit c2acb99b814de2d79cd36d0960f3f10b83cb101d @rfrancoise rfrancoise committed Nov 1, 2011
Showing with 717 additions and 107 deletions.
  1. +5 −0 Makefile.in
  2. +2 −8 TODO
  3. +160 −0 aclocal.m4
  4. +23 −13 cmd-if-shell.c
  5. +29 −17 cmd-list-clients.c
  6. +18 −3 cmd-load-buffer.c
  7. +10 −8 cmd-new-session.c
  8. +2 −2 cmd-pipe-pane.c
  9. +18 −3 cmd-save-buffer.c
  10. +2 −2 cmd-set-buffer.c
  11. +2 −2 cmd-show-buffer.c
  12. +279 −2 configure
  13. +21 −10 configure.ac
  14. +1 −1 examples/tmux.vim
  15. +36 −0 format.c
  16. +12 −1 input.c
  17. +5 −1 key-string.c
  18. +2 −2 options-table.c
  19. +12 −1 screen-write.c
  20. +2 −1 server-fn.c
  21. +27 −5 tmux.1
  22. +19 −3 tmux.c
  23. +5 −1 tmux.h
  24. +2 −1 tty-term.c
  25. +23 −20 window-copy.c
View
@@ -251,6 +251,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBEVENT_CFLAGS = @LIBEVENT_CFLAGS@
+LIBEVENT_LIBS = @LIBEVENT_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
@@ -265,6 +267,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PLATFORM = @PLATFORM@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
View
@@ -100,7 +100,6 @@
and a buffer) info() when changing to same window
- way to add dest for break-pane; maybe some easier way to unbreak-pane
- case insensitive searching
-- pane-index option like base-index
- option to move status line to top
- configurable borders and empty space filler for when panes < window?
- mouse-select-pane will screw up with !MODE_MOUSE_STANDARD (it sets the
@@ -113,10 +112,6 @@
in commands without quotes
- a command to choose from a generic list, so you can do eg
choose-list -l Abc,Moo,Blah "run-shell 'sh /my/choose/script %%'"
-- else part for if-shell
-- add general internal format for lists (key=value) and a way to output them in
- different representations, use for list-windows, etc etc. see message id
- 20110221205346.GA1580@yelena.nicm.ath.cx
- numeric prefix in copy mode should be paste buffer for C-w
- named buffers and allow gaps in the stack
- npage/ppage/dc/ic should have aliases for more typical names
@@ -128,14 +123,12 @@
- monitor-activity is broken in several ways with multiple clients
- monitor-activity should be more powerful (eg set a region)
- maybe a way to put pane names instead of window names in status line
-- Support for borderless panes
+- support for borderless panes
- run-shell/if-shell should support status_replace stuff
- wait-pane command or another way to make it synchronous/wait for command to
finish
- last-pane across sessions
- attach should take a pane and select it as well as attaching
-- support for E3, screen-devel
- <1311003510-28900-1-git-send-email-mlichvar@redhat.com>
- should default-path be a window option?
- option to put status line at top (why?)
- panes should have names like windows
@@ -146,6 +139,7 @@
- flags to find-window to select what is searched (title, name, content, history)
- fetch full command line on !Linux, and add option to strip prefixes
such as "sh " "/bin/sh " etc etc
+- synchronize-windows option
* We need a tmux terminfo entry to document the extensions we are using in
upstream terminfo. Must NOT change (only add or remove) anything from
TERM=screen so we can fallback!
View
@@ -19,6 +19,166 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes ],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-if-shell.c 2522 2011-05-29 15:13:36Z tcunha $ */
+/* $Id: cmd-if-shell.c 2627 2011-10-31 13:55:10Z tcunha $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -25,7 +25,7 @@
#include "tmux.h"
/*
- * Executes a tmux command if a shell command returns true.
+ * Executes a tmux command if a shell command returns true or false.
*/
int cmd_if_shell_exec(struct cmd *, struct cmd_ctx *);
@@ -35,16 +35,17 @@ void cmd_if_shell_free(void *);
const struct cmd_entry cmd_if_shell_entry = {
"if-shell", "if",
- "", 2, 2,
- "shell-command command",
+ "", 2, 3,
+ "shell-command command [command]",
0,
NULL,
NULL,
cmd_if_shell_exec
};
struct cmd_if_shell_data {
- char *cmd;
+ char *cmd_if;
+ char *cmd_else;
struct cmd_ctx ctx;
};
@@ -56,7 +57,11 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_ctx *ctx)
const char *shellcmd = args->argv[0];
cdata = xmalloc(sizeof *cdata);
- cdata->cmd = xstrdup(args->argv[1]);
+ cdata->cmd_if = xstrdup(args->argv[1]);
+ if (args->argc == 3)
+ cdata->cmd_else = xstrdup(args->argv[2]);
+ else
+ cdata->cmd_else = NULL;
memcpy(&cdata->ctx, ctx, sizeof cdata->ctx);
if (ctx->cmdclient != NULL)
@@ -75,12 +80,15 @@ cmd_if_shell_callback(struct job *job)
struct cmd_if_shell_data *cdata = job->data;
struct cmd_ctx *ctx = &cdata->ctx;
struct cmd_list *cmdlist;
- char *cause;
-
- if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0)
- return;
-
- if (cmd_string_parse(cdata->cmd, &cmdlist, &cause) != 0) {
+ char *cause, *cmd;
+
+ if (!WIFEXITED(job->status) || WEXITSTATUS(job->status) != 0) {
+ cmd = cdata->cmd_else;
+ if (cmd == NULL)
+ return;
+ } else
+ cmd = cdata->cmd_if;
+ if (cmd_string_parse(cmd, &cmdlist, &cause) != 0) {
if (cause != NULL) {
ctx->error(ctx, "%s", cause);
xfree(cause);
@@ -107,6 +115,8 @@ cmd_if_shell_free(void *data)
if (ctx->curclient != NULL)
ctx->curclient->references--;
- xfree(cdata->cmd);
+ if (cdata->cmd_else != NULL)
+ xfree(cdata->cmd_else);
+ xfree(cdata->cmd_if);
xfree(cdata);
}
View
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-clients.c 2582 2011-08-21 12:38:55Z tcunha $ */
+/* $Id: cmd-list-clients.c 2617 2011-10-23 15:03:50Z tcunha $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -31,8 +31,8 @@ int cmd_list_clients_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_clients_entry = {
"list-clients", "lsc",
- "t:", 0, 0,
- CMD_TARGET_SESSION_USAGE,
+ "F:t:", 0, 0,
+ "[-F format] " CMD_TARGET_SESSION_USAGE,
CMD_READONLY,
NULL,
NULL,
@@ -43,11 +43,13 @@ const struct cmd_entry cmd_list_clients_entry = {
int
cmd_list_clients_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct args *args = self->args;
- struct client *c;
- struct session *s;
- u_int i;
- const char *s_utf8;
+ struct args *args = self->args;
+ struct client *c;
+ struct session *s;
+ struct format_tree *ft;
+ const char *template;
+ u_int i;
+ char *line;
if (args_has(args, 't')) {
s = cmd_find_session(ctx, args_get(args, 't'), 0);
@@ -56,22 +58,32 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_ctx *ctx)
} else
s = NULL;
+ template = args_get(args, 'F');
+ if (template == NULL) {
+ template = "#{client_tty}: #{session_name} "
+ "[#{client_width}x#{client_height} #{client_termname}]"
+ "#{?client_utf8, (utf8),}"
+ "#{?client_readonly, (ro),}";
+ }
+
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session == NULL)
continue;
- if (c->tty.flags & TTY_UTF8)
- s_utf8 = " (utf8)";
- else
- s_utf8 = "";
-
if (s != NULL && s != c->session)
continue;
- ctx->print(ctx, "%s: %s [%ux%u %s]%s%s", c->tty.path,
- c->session->name, c->tty.sx, c->tty.sy,
- c->tty.termname, s_utf8,
- c->flags & CLIENT_READONLY ? " (ro)" : "");
+
+ ft = format_create();
+ format_add(ft, "line", "%u", i);
+ format_session(ft, c->session);
+ format_client(ft, c);
+
+ line = format_expand(ft, template);
+ ctx->print(ctx, "%s", line);
+ xfree(line);
+
+ format_free(ft);
}
return (0);
Oops, something went wrong.

0 comments on commit c2acb99

Please sign in to comment.