Ok by me, I was just  following the existing code :)

So the patch is good to merge? Need me to do any other modifications?

On Fri, Feb 22, 2013 at 6:50 PM, Nicholas Marriott
<nicholas.marri...@gmail.com> wrote:
> On Fri, Feb 22, 2013 at 06:34:14PM -0300, Thiago Padilha wrote:
>> I had forgotten to update the man pages to reflect the nem flag, this
>> patch contains the complete thing.
>
> I think this is a bit more pithy, don't see a need to info() the old
> value.
>
>
> diff --git a/cmd-set-option.c b/cmd-set-option.c
> index a09e6db..94b44c7 100644
> --- a/cmd-set-option.c
> +++ b/cmd-set-option.c
> @@ -63,8 +63,8 @@ struct options_entry *cmd_set_option_choice(struct cmd *, 
> struct cmd_ctx *,
>
>  const struct cmd_entry cmd_set_option_entry = {
>         "set-option", "set",
> -       "agqst:uw", 1, 2,
> -       "[-agsquw] [-t target-session|target-window] option [value]",
> +       "agoqst:uw", 1, 2,
> +       "[-agosquw] [-t target-session|target-window] option [value]",
>         0,
>         NULL,
>         NULL,
> @@ -73,8 +73,8 @@ const struct cmd_entry cmd_set_option_entry = {
>
>  const struct cmd_entry cmd_set_window_option_entry = {
>         "set-window-option", "setw",
> -       "agqt:u", 1, 2,
> -       "[-agqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
> +       "agoqt:u", 1, 2,
> +       "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
>         0,
>         NULL,
>         NULL,
> @@ -151,6 +151,11 @@ cmd_set_option_exec(struct cmd *self, struct cmd_ctx 
> *ctx)
>                 if (cmd_set_option_unset(self, ctx, oe, oo, valstr) != 0)
>                         return (CMD_RETURN_ERROR);
>         } else {
> +               if (args_has(args, 'o') && options_find1(oo, optstr) != NULL) 
> {
> +                       if (!args_has(args, 'q'))
> +                               ctx->print(ctx, "already set: %s", optstr);
> +                       return (CMD_RETURN_NORMAL);
> +               }
>                 if (cmd_set_option_set(self, ctx, oe, oo, valstr) != 0)
>                         return (CMD_RETURN_ERROR);
>         }
> @@ -227,6 +232,11 @@ cmd_set_option_user(struct cmd *self, struct cmd_ctx 
> *ctx, const char* optstr,
>                         ctx->error(ctx, "empty value");
>                         return (CMD_RETURN_ERROR);
>                 }
> +               if (args_has(args, 'o') && options_find1(oo, optstr) != NULL) 
> {
> +                       if (!args_has(args, 'q'))
> +                               ctx->print(ctx, "already set: %s", optstr);
> +                       return (CMD_RETURN_NORMAL);
> +               }
>                 options_set_string(oo, optstr, "%s", valstr);
>                 if (!args_has(args, 'q'))
>                         ctx->info(ctx, "set option: %s -> %s", optstr, 
> valstr);
> diff --git a/tmux.1 b/tmux.1
> index 475bac0..0b2892a 100644
> --- a/tmux.1
> +++ b/tmux.1
> @@ -1996,7 +1996,7 @@ abc123
>  Commands which set options are as follows:
>  .Bl -tag -width Ds
>  .It Xo Ic set-option
> -.Op Fl agqsuw
> +.Op Fl agoqsuw
>  .Op Fl t Ar target-session | Ar target-window
>  .Ar option Ar value
>  .Xc
> @@ -2025,6 +2025,10 @@ options.
>  It is not possible to unset a global option.
>  .Pp
>  The
> +.Fl o
> +flag prevents setting an option that is already set.
> +.Pp
> +The
>  .Fl q
>  flag suppresses the informational message (as if the
>  .Ic quiet
>
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to