Remove the "info" message mechanism, this was only used for about five

mostly useless and annoying messages. Change those commands to silence
on success like all the others. Still accept the -q command line flag
and "quiet" server option for now.
This commit is contained in:
nicm 2014-04-17 07:55:43 +00:00
parent 877bdb46ed
commit 2740490e27
10 changed files with 12 additions and 77 deletions

View File

@ -86,37 +86,6 @@ cmdq_print(struct cmd_q *cmdq, const char *fmt, ...)
va_end(ap);
}
/* Show info from command. */
void printflike2
cmdq_info(struct cmd_q *cmdq, const char *fmt, ...)
{
struct client *c = cmdq->client;
va_list ap;
char *msg;
if (options_get_number(&global_options, "quiet"))
return;
va_start(ap, fmt);
if (c == NULL)
/* nothing */;
else if (c->session == NULL || (c->flags & CLIENT_CONTROL)) {
evbuffer_add_vprintf(c->stdout_data, fmt, ap);
evbuffer_add(c->stdout_data, "\n", 1);
server_push_stdout(c);
} else {
xvasprintf(&msg, fmt, ap);
*msg = toupper((u_char) *msg);
status_message_set(c, "%s", msg);
free(msg);
}
va_end(ap);
}
/* Show error from command. */
void printflike2
cmdq_error(struct cmd_q *cmdq, const char *fmt, ...)

View File

@ -161,13 +161,9 @@ cmd_run_shell_callback(struct job *job)
retcode = WTERMSIG(job->status);
xasprintf(&msg, "'%s' terminated by signal %d", cmd, retcode);
}
if (msg != NULL) {
if (lines == 0)
cmdq_info(cmdq, "%s", msg);
else
cmd_run_shell_print(job, msg);
free(msg);
}
if (msg != NULL)
cmd_run_shell_print(job, msg);
free(msg);
}
void

View File

@ -104,7 +104,6 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq)
else
layout = layout_set_previous(wl->window);
server_redraw_window(wl->window);
cmdq_info(cmdq, "arranging in: %s", layout_set_name(layout));
return (CMD_RETURN_NORMAL);
}
@ -115,7 +114,6 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq)
if (layout != -1) {
layout = layout_set_select(wl->window, layout);
server_redraw_window(wl->window);
cmdq_info(cmdq, "arranging in: %s", layout_set_name(layout));
return (CMD_RETURN_NORMAL);
}
@ -126,7 +124,6 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
}
server_redraw_window(wl->window);
cmdq_info(cmdq, "arranging in: %s", layoutname);
}
return (CMD_RETURN_NORMAL);
}

View File

@ -259,10 +259,6 @@ cmd_set_option_user(struct cmd *self, struct cmd_q *cmdq, const char* optstr,
return (CMD_RETURN_NORMAL);
}
options_set_string(oo, optstr, "%s", valstr);
if (!args_has(args, 'q')) {
cmdq_info(cmdq, "set option: %s -> %s", optstr,
valstr);
}
}
return (CMD_RETURN_NORMAL);
}
@ -285,8 +281,6 @@ cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq,
}
options_remove(oo, oe->name);
if (!args_has(args, 'q'))
cmdq_info(cmdq, "unset option: %s", oe->name);
return (0);
}
@ -295,9 +289,7 @@ int
cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
struct args *args = self->args;
struct options_entry *o;
const char *s;
if (oe->type != OPTIONS_TABLE_FLAG && value == NULL) {
cmdq_error(cmdq, "empty value");
@ -337,10 +329,6 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq,
}
if (o == NULL)
return (-1);
s = options_table_print_entry(oe, o, 0);
if (!args_has(args, 'q'))
cmdq_info(cmdq, "set option: %s -> %s", oe->name, s);
return (0);
}

View File

@ -71,13 +71,10 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
if (args_has(args, 'r')) {
if (c->flags & CLIENT_READONLY) {
if (c->flags & CLIENT_READONLY)
c->flags &= ~CLIENT_READONLY;
cmdq_info(cmdq, "made client writable");
} else {
else
c->flags |= CLIENT_READONLY;
cmdq_info(cmdq, "made client read-only");
}
}
tflag = args_get(args, 't');

View File

@ -212,7 +212,7 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c)
readonly = 0;
}
if (!readonly && (c->flags & CLIENT_READONLY)) {
cmdq_info(c->cmdq, "client is read-only");
cmdq_error(c->cmdq, "client is read-only");
return;
}

View File

@ -90,7 +90,7 @@ const struct options_table_entry server_options_table[] = {
{ .name = "quiet",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0 /* overridden in main() */
.default_num = 0
},
{ .name = "set-clipboard",

12
tmux.1
View File

@ -23,7 +23,7 @@
.Sh SYNOPSIS
.Nm tmux
.Bk -words
.Op Fl 2lCquv
.Op Fl 2lCuv
.Op Fl c Ar shell-command
.Op Fl f Ar file
.Op Fl L Ar socket-name
@ -168,10 +168,6 @@ server process to recreate it.
Behave as a login shell.
This flag currently has no effect and is for compatibility with other shells
when using tmux as a login shell.
.It Fl q
Set the
.Ic quiet
server option to prevent the server sending various informational messages.
.It Fl S Ar socket-path
Specify a full alternative path to the server socket.
If
@ -2110,12 +2106,6 @@ option.
Set the number of error or information messages to save in the message log for
each client.
The default is 100.
.It Xo Ic quiet
.Op Ic on | off
.Xc
Enable or disable the display of various informational messages (see also the
.Fl q
command line flag).
.It Xo Ic set-clipboard
.Op Ic on | off
.Xc

9
tmux.c
View File

@ -206,7 +206,7 @@ main(int argc, char **argv)
char in[256];
const char *home;
long long pid;
int opt, flags, quiet, keys, session;
int opt, flags, keys, session;
#ifdef DEBUG
malloc_options = (char *) "AFGJPX";
@ -214,7 +214,7 @@ main(int argc, char **argv)
setlocale(LC_TIME, "");
quiet = flags = 0;
flags = 0;
label = path = NULL;
login_shell = (**argv == '-');
while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUv")) != -1) {
@ -244,7 +244,6 @@ main(int argc, char **argv)
label = xstrdup(optarg);
break;
case 'q':
quiet = 1;
break;
case 'S':
free(path);
@ -291,11 +290,11 @@ main(int argc, char **argv)
options_init(&global_options, NULL);
options_table_populate_tree(server_options_table, &global_options);
options_set_number(&global_options, "quiet", quiet);
options_init(&global_s_options, NULL);
options_table_populate_tree(session_options_table, &global_s_options);
options_set_string(&global_s_options, "default-shell", "%s", getshell());
options_set_string(&global_s_options, "default-shell", "%s",
getshell());
options_init(&global_w_options, NULL);
options_table_populate_tree(window_options_table, &global_w_options);

1
tmux.h
View File

@ -1851,7 +1851,6 @@ size_t cmd_list_print(struct cmd_list *, char *, size_t);
struct cmd_q *cmdq_new(struct client *);
int cmdq_free(struct cmd_q *);
void printflike2 cmdq_print(struct cmd_q *, const char *, ...);
void printflike2 cmdq_info(struct cmd_q *, const char *, ...);
void printflike2 cmdq_error(struct cmd_q *, const char *, ...);
int cmdq_guard(struct cmd_q *, const char *, int);
void cmdq_run(struct cmd_q *, struct cmd_list *);