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

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

Expand Messages
  • Jon Green
    Jan 27, 2011
    • 0 Attachment
      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
    • Show all 8 messages in this topic