Loading ...
Sorry, an error occurred while loading the content.

2628Re: [jasspa] Re: Passing value of varaiable from command line to the start-up macro

Expand Messages
  • Jon Green
    Jan 28, 2011
      On 28/01/2011 17:36, igcain wrote:
      > --- In jasspa@yahoogroups.com, Jon Green<jon@...> wrote:
      >> On 27/01/2011 20:58, igcain wrote:
      >>> Hi there
      >>> I want to invoke the ne editor such that when it starts it goes to a specified line of text ready for over typing. My start-up macro in ne.emf looks something like;
      >>> define-macro start-up
      >>> 19 buffer-mode "over"
      >>> !force search-buffer "M" "MONTH= "
      >>> end-of-line
      >>> !macro
      >>> unfortunately my start-up macro (as currently written) only ever goes to the string constant "MONTH= ". But what I really would like to do is execute the command line with;
      >>> ne -vVarName="MONTH= " somefile
      >>> where VarName can be substituted for any string that happens to be present in the file to be ediited. Only thing is how do I reference the variable VarName within the start-up macro?
      >>> Any help, much appreciated
      >>> Ian
      >> Hi Ian,
      >> VarName needs to be a MicroEmacs variable i.e. $foo so you will do:
      >> ne -v"$foo=MONTH= " somefile
      >> Then in your start-up macro you reference the variable $foo.
      >> search-buffer "M" $foo
      >> You will need to be careful about how you quote the argument on the command
      >> line if there are any special characters or spaces. This will depend on the
      >> operating system you are using.
      >> Before you test the start-up macro probably best to play with starting the
      >> editor with the variable setting on the command line and checking that the
      >> variable is coming through correctly with a
      >> esc-x describe-variable $foo
      >> This will show you the variable value. If it is OK then you can work on the
      >> start-up.
      >> Regards
      >> Jon
      > Jon
      > thanks for the reply. One question how do I know which variable I can use?
      > Ian
      Hi Ian,

      You can use any variable that is *NOT* listed in

      esc-x list-variables

      These are ME's variables that are used by macros.
      Also avoid any environment variable (i.e. $DISPLAY as used on UNIX).

      So something like $arg1 would be a sensible choice i.e.
      -v$arg1=This -v$arg2=and -v$arg3=that

    • Show all 8 messages in this topic