vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] 9.8h and +'command' or -c 'command'


From: Thomas Dickey
Subject: Re: [vile] 9.8h and +'command' or -c 'command'
Date: Thu, 20 Sep 2012 19:57:55 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Sep 20, 2012 at 07:22:00PM -0400, Wayne Cuddy wrote:
> On Thu, Sep 20, 2012 at 06:46:39PM -0400, Thomas Dickey wrote:
> > On Thu, Sep 20, 2012 at 06:12:52PM -0400, Thomas Dickey wrote:
> > > On Thu, Sep 20, 2012 at 04:59:21PM -0400, Wayne Cuddy wrote:
> > > > When starting vile from mutt my muttrc file passes this option to vile
> > > > to force it into mailmode.
> > > > 
> > > > +"set-mode mailmode"
> > > > 
> > > > When I attempt this with 9.8h I get the following startup error:
> > > > 
> > > > [Reading /usr/local/share/vile/.vilerc]  
> > > > [Read 151 lines from "/usr/local/share/vile/.vilerc"  (read-only)]
> > > > [Reading /usr/local/share/vile/filters.rc]
> > > > [Reading /usr/local/share/vile/modes.rc]
> > > > [Reading /usr/local/share/vile/palettes.rc]
> > > > [Improper line range 'set-mode mailmode']
> > > > 
> > > > I upgraded from 9.8f so I don't know if g exhibited the same behavior.
> > > > 
> > > > Am I doing something wrong that just hasn't been caught until now?
> > > > mailmode is properly activated on previous versions. This doesn't just
> > > > happen for mailmode, it happens for pretty much anything that is passed.
> > > 
> > > perhaps this change needs more work:
> > > 
> > >  20120807 (h)
> > >   + modify initialization of [vileinit] to quote parameters passed from
> > >     the command-line, e.g., for the "-s" option so that embedded blanks
> > >     are retained (report by Greg McFarlane, Savannah #36801).
> > 
> > Here's the related change:
> > 
> > --- main.c  2012/07/11 14:23:04     1.708
> > +++ main.c  2012/07/14 15:54:06     1.709
> > @@ -200,6 +200,17 @@
> >  }
> >  
> >  static void
> > +add_cmdarg(BUFFER *bp, const char *cmd, const char *arg)
> > +{
> > +    TBUFF *tb = 0;
> > +    if (tb_scopy(&tb, arg) != 0
> > +   && tb_enquote(&tb) != 0) {
> > +   b2printf(bp, cmd, tb_values(tb));
> > +    }
> > +    tb_free(&tb);
> > +}
> > +
> > +static void
> >  setup_command(BUFFER *opts_bp, char *param)
> >  {
> >      char *p1;
> > @@ -217,7 +228,7 @@
> >         param = skip_blanks(p2 + 1);
> >     }
> >      }
> > -    b2printf(opts_bp, "execute-named-command %s\n", param);
> > +    add_cmdarg(opts_bp, "execute-named-command %s\n", param);
> >  }
> >  
> >  static int
> > @@ -585,7 +596,7 @@
> >                 break;
> >             case 'g':       /* -g for initial goto */
> >             case 'G':
> > -               b2printf(opts_bp, "%s goto-line\n", GetArgVal(param));
> > +               add_cmdarg(opts_bp, "%s goto-line\n", GetArgVal(param));
> >                 break;
> >             case 'h':       /* -h for initial help */
> >             case 'H':
> > @@ -602,7 +613,7 @@
> >                 if (cfg_locate(vileinit, LOCATE_SOURCE) != 0
> >                     && cfg_locate(startup_file, LOCATE_SOURCE) == 0)
> >                     make_startup_file(vileinit);
> > -               b2printf(init_bp, "source %s\n", vileinit);
> > +               add_cmdarg(init_bp, "source %s\n", vileinit);
> >                 break;
> >  
> >  #if OPT_ENCRYPT
> > @@ -622,12 +633,12 @@
> >  #endif
> >             case 's':       /* -s <pattern> */
> >             case 'S':
> > -               b2printf(opts_bp, "search-forward %s\n", GetArgVal(param));
> > +               add_cmdarg(opts_bp, "search-forward %s\n", 
> > GetArgVal(param));
> >                 break;
> >  #if OPT_TAGS
> >             case 't':       /* -t for initial tag lookup */
> >             case 'T':
> > -               b2printf(opts_bp, "tag %s\n", GetArgVal(param));
> > +               add_cmdarg(opts_bp, "tag %s\n", GetArgVal(param));
> >                 break;
> >  #endif
> >             case 'v':       /* -v is view mode */
> > @@ -657,7 +668,7 @@
> >         setup_command(opts_bp, GetArgVal(param));
> >     } else if (*param == '@') {
> >         vileinit = ++param;
> > -       b2printf(init_bp, "source %s\n", param);
> > +       add_cmdarg(init_bp, "source %s\n", param);
> >     } else if (*param != EOS) {
> >  
> >         /* must be a filename */
... 
> Seems to be the change in setup_command that caused my problem. I don't
> know if the other calls to add_cmdarg are issues we well though.

hmm: parameters for "-s", "-t" and the "source" can have embedded blanks
since they're unambiguously single-valued, and a blank would be legal.

A blank in the "-g" value would always be an error.

(the change to execute-named-command is a problem that's not so simple to
improve other than a revert)

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]