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

Re: [jasspa] String-rectangle unable to insert at pos 0 ?

Expand Messages
  • Thomas Hundt
    You say the query-replace-string is heavy . ( Schwer ? You mean difficult . See http://dict.leo.org/ ) I don t see what the problem is. Are you aware of
    Message 1 of 5 , Nov 12, 2005
    • 0 Attachment
      You say the query-replace-string is "heavy". ("Schwer"? You mean
      "difficult". See http://dict.leo.org/ )

      I don't see what the problem is. Are you aware of the '!' key which
      means "replace all the rest of them"? It is documented. If you want an
      industrial-strength solution, I'd recommend Perl.

      "Official version" = currently released version. I.e., you have the
      correct code. There is no other I'm aware of.

      I don't think you know what firmware is.
      http://www.google.com/search?q=define%3A+firmware

      -Th



      Meino Christian Cramer wrote:
      > From: Thomas Hundt <thundt@...>
      > Subject: Re: [jasspa] String-rectangle unable to insert at pos 0 ?
      > Date: Sat, 05 Nov 2005 23:42:47 -0800
      >
      > Hi Thomas !
      >
      > Thanks for your reply ! :)
      >
      >> For now do a workaround:
      >> query-replace-string "^" with "rm -f"
      >
      > ...this is a little heavy for that much lines with
      > files I want to remove i.e. prepend with "rm -f "...
      >
      > By the way: What did you mean with "official version"? Is there
      > something better "inofficial" rectangle-warez out there ? Where
      > can I get it and is it all0wed to uz it? I liked hacked firmware --
      > especially for my ME, hahahahaha ;)))
      >
      >
      > Keep hacking!
      > Meino
      >
      >
      >> Works for me when I select a rectangle where the last line is a blank
      >> line. (The string gets inserted at the same column where the end of the
      >> rectangle is.)
      >>
      >> Yours does seem to be the official version (q.v.: rect.emf).
      >>
      >> For now do a workaround:
      >> query-replace-string "^" with "rm -f"
      >>
      >> -Th
      >>
      >>
      >> Meino Christian Cramer wrote:
      >>> Hi,
      >>>
      >>> Something mysterious happened.... :)
      >>>
      >>> I tried to string-insert a "rm -f " at position 0 (C-like counting ;)
      >>> of the coloumns in a list of no longer used files. But it simply does
      >>> nothing...no error...
      >>>
      >>> The macro I use for that was posted here on the list and looks like
      >>> that:
      >>>
      >>> ======================================================================
      >>>
      >>> ;------------------------------------------------------------
      >>> ; string-rectangle; The user is prompted for a string which is inserted at
      >>> ; the same horizontal position on all lines spanned by the current region.
      >>> ;------------------------------------------------------------
      >>> define-macro string-rectangle
      >>> set-variable #l0 $window-line
      >>> set-variable #l3 $window-col
      >>> exchange-point-and-mark
      >>> set-variable #l2 $window-line
      >>> exchange-point-and-mark
      >>> ; Compute the top line.
      >>> !if &gre #l0 #l2
      >>> set-variable #l1 #l2
      >>> set-variable #l2 #l0
      >>> !else
      >>> set-variable #l1 #l0
      >>> !endif
      >>> ; Get the string to insert
      >>> !force set-variable #l6 @1
      >>> !if ¬ $status
      >>> set-variable #l6 @ml "String"
      >>> !endif
      >>> ; Fill all of the lines in the region from the first column.
      >>> set-variable $window-line #l1
      >>> !repeat
      >>> ; Move to the column
      >>> beginning-of-line
      >>> !while &les $window-col #l3
      >>> !if ¬ &seq @wc "\n"
      >>> forward-char
      >>> !else
      >>> insert-string " "
      >>> !endif
      >>> !done
      >>> ; Insert the string
      >>> insert-string #l6
      >>> !if ¬ &les $window-line #l2
      >>> ; done the last line, return
      >>> set-variable $window-line #l0
      >>> set-variable $window-col &add #l3 &len #l6
      >>> !return
      >>> !endif
      >>> forward-line
      >>> !until 0
      >>> !emacro
      >>>
      >>> ======================================================================
      >>>
      >>> What I am doing wrong here ?
      >>>
      >>> Kind regards and thank you very much in advance for any help or hint!
      >>>
      >>> Have a nice weekend!
      >>> Meino
    • Phillips, Steven
      If you are trying to replace strings over multiple files look at the following commands: replace-all-string, query-replace-all-string replace-all-pairs These
      Message 2 of 5 , Nov 14, 2005
      • 0 Attachment
        If you are trying to replace strings over multiple files look at the
        following commands:

        replace-all-string, query-replace-all-string

        replace-all-pairs

        These commands use grep to find all references of the 'from' string in a
        given set of files, it then uses replace-string for each occurrence. As
        your grep's regex may not be compatible (or as powerful) as ME's you can
        use the numeric argument to tell the command you are giving it a
        specific grep string, i.e.:

        3 replace-all-string "a[bB]c" "def" "*.c" "a.c"

        In this example all "abc" or "aBc" strings in all C files will be
        replaced with "def", the grep string of "a.c" will match many more
        combinations (i.e. "azc") but these will not be matched by the "a[bB]c"
        regex so they will be ignored.

        The equivalent in replace-all-pairs is to use a line like:

        /a[bB]c/def/a.c/

        Try:

        3 replace-all-string "^" "rm -f " "*" "."

        This will insert "rm -f " at the start of every non-empty line in every
        file in the current directory. But please make a copy of these files
        FIRST, if these go wrong they can go very wrong.

        I have used these commands to make major api changes to source code
        (e.g. using replace-all-pairs lines like the following:

        /\<int32\>/meInt/int32/

        which replaces any 'int32' as a word (i.e. not 'print32') to meInt) and
        have found them invaluable and a lot less hassle than sed, awk or perl!

        Steve

        > -----Original Message-----
        > From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf
        Of
        > Meino Christian Cramer
        > Sent: Saturday, November 12, 2005 2:46 AM
        > To: jasspa@yahoogroups.com; thundt@...
        > Subject: Re: [jasspa] String-rectangle unable to insert at pos 0 ?
        >
        > From: Thomas Hundt <thundt@...>
        > Subject: Re: [jasspa] String-rectangle unable to insert at pos 0 ?
        > Date: Sat, 05 Nov 2005 23:42:47 -0800
        >
        > Hi Thomas !
        >
        > Thanks for your reply ! :)
        >
        > > For now do a workaround:
        > > query-replace-string "^" with "rm -f"
        >
        > ...this is a little heavy for that much lines with
        > files I want to remove i.e. prepend with "rm -f "...
        >
        > By the way: What did you mean with "official version"? Is there
        > something better "inofficial" rectangle-warez out there ? Where
        > can I get it and is it all0wed to uz it? I liked hacked firmware --
        > especially for my ME, hahahahaha ;)))
        >
        >
        > Keep hacking!
        > Meino
        >
        >
        > > Works for me when I select a rectangle where the last line is a
        blank
        > > line. (The string gets inserted at the same column where the end of
        the
        > > rectangle is.)
        > >
        > > Yours does seem to be the official version (q.v.: rect.emf).
        > >
        > > For now do a workaround:
        > > query-replace-string "^" with "rm -f"
        > >
        > > -Th
        > >
        > >
        > > Meino Christian Cramer wrote:
        > > > Hi,
        > > >
        > > > Something mysterious happened.... :)
        > > >
        > > > I tried to string-insert a "rm -f " at position 0 (C-like
        counting ;)
        > > > of the coloumns in a list of no longer used files. But it simply
        does
        > > > nothing...no error...
        > > >
        > > > The macro I use for that was posted here on the list and looks
        like
        > > > that:
        > > >
        > > >
        ======================================================================
        > > >
        > > > ;------------------------------------------------------------
        > > > ; string-rectangle; The user is prompted for a string which is
        > inserted at
        > > > ; the same horizontal position on all lines spanned by the current
        > region.
        > > > ;------------------------------------------------------------
        > > > define-macro string-rectangle
        > > > set-variable #l0 $window-line
        > > > set-variable #l3 $window-col
        > > > exchange-point-and-mark
        > > > set-variable #l2 $window-line
        > > > exchange-point-and-mark
        > > > ; Compute the top line.
        > > > !if &gre #l0 #l2
        > > > set-variable #l1 #l2
        > > > set-variable #l2 #l0
        > > > !else
        > > > set-variable #l1 #l0
        > > > !endif
        > > > ; Get the string to insert
        > > > !force set-variable #l6 @1
        > > > !if ¬ $status
        > > > set-variable #l6 @ml "String"
        > > > !endif
        > > > ; Fill all of the lines in the region from the first column.
        > > > set-variable $window-line #l1
        > > > !repeat
        > > > ; Move to the column
        > > > beginning-of-line
        > > > !while &les $window-col #l3
        > > > !if ¬ &seq @wc "\n"
        > > > forward-char
        > > > !else
        > > > insert-string " "
        > > > !endif
        > > > !done
        > > > ; Insert the string
        > > > insert-string #l6
        > > > !if ¬ &les $window-line #l2
        > > > ; done the last line, return
        > > > set-variable $window-line #l0
        > > > set-variable $window-col &add #l3 &len #l6
        > > > !return
        > > > !endif
        > > > forward-line
        > > > !until 0
        > > > !emacro
        > > >
        > > >
        ======================================================================
        > > >
        > > > What I am doing wrong here ?
        > > >
        > > > Kind regards and thank you very much in advance for any help or
        hint!
        > > >
        > > > Have a nice weekend!
        > > > Meino
        > >
        > >
        > >
        > >
        >
        ________________________________________________________________________
        __
        > >
        > > This is an unmoderated list. JASSPA is not responsible for the
        content
        > of
        > > any material posted to this list.
        > >
        > > To unsubscribe, send a mail message to
        > >
        > > mailto:jasspa-unsubscribe@yahoogroups.com
        > >
        > > or visit http://groups.yahoo.com/group/jasspa and
        > > modify your account settings manually.
        > >
        > >
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >
        > >
        > >
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        >
        ________________________________________________________________________
        __
        >
        > This is an unmoderated list. JASSPA is not responsible for the content
        of
        > any material posted to this list.
        >
        > To unsubscribe, send a mail message to
        >
        > mailto:jasspa-unsubscribe@yahoogroups.com
        >
        > or visit http://groups.yahoo.com/group/jasspa and
        > modify your account settings manually.
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.