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

Re: [jasspa] Restricting actions on text to a region

Expand Messages
  • Meino Christian Cramer
    From: Steven Phillips Subject: Re[2]: [jasspa] Restricting actions on text to a region Date: Wed, 1 Jun 2005 21:02:52 +0100 Is there a
    Message 1 of 6 , Jun 1, 2005
    • 0 Attachment
      From: Steven Phillips <bill@...>
      Subject: Re[2]: [jasspa] Restricting actions on text to a region
      Date: Wed, 1 Jun 2005 21:02:52 +0100

      Is there a non-menu way of activating the opposite of "narrow-region"
      in me? I tried "widen" (as in Gnu-EMacs) but this was unknown. Other
      keywords like "region", "narrow" etc. with apropos gave also nothing
      appropiate...

      Meino


      > Thomas's suggestion of using narrowing is the best solution.
      >
      > Use the main menu's Edit -> Narrow To to reduce the visible part of the buffer
      > to the required region and then use replace-string as normal, once done use
      > Edit -> Remove All Narrows to get the whole buffer back.
      >
      > Steve
      >
      > > Subject: [jasspa] Restricting actions on text to a region
      > > From: Thomas Hundt <thundt@...>
      > > Date: Wednesday, June 1, 2005, 8:33:09 PM
      > > To: jasspa@yahoogroups.com
      > > Replace just a couple? You need query-replace-string. It is interactive.
      >
      > > Or... if you just want to operate on a particular region, you want to
      > > narrow the buffer (narrow-buffer) to just this area. Then do your
      > > search and replace.
      >
      > > Also: in your case you would want to replace ^FNORD with ERIS. (The ^
      > > is part of a regular expression, meaning "beginning of line".)
      >
      > > You know about the apropos help command, right? ^H-a
      >
      > > -Th
      >
      >
      > > Meino Christian Cramer wrote:
      > >> is there a "inexpensive" way to do such a thing:
      > >> Suppose I have a text consisting of lines each starting with the word
      > >> FNORD
      > >> . Now I want to replace a couple (no, I DONT want to count them) of
      > >> FNORDs with the word
      > >> ERIS.
      > >> I mark them with a region and do a replace-string <FNORD> <ERIS>
      > >> and TADA! ....everything below the region is affected. Hmmmm....
      > >>
      > >> Is there a flag, a knob, a switch to say to Microemacs: "Hey, please
      > >> do that only inside the marked region!" ?
      >
      >
      > > __________________________________________________________________________
      >
      > > 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
      >
      >
      >
      >
      >
      >
      >
      >
      > __________________________________________________________________________
      >
      > 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
      >
      >
      >
      >
      >
      >
      >
    • Thomas Hundt
      I was going to say, you want unnarrow-buffer . But it turns out that s a macro in my init file. I don t remember now why I wrote it, but I must have been
      Message 2 of 6 , Jun 1, 2005
      • 0 Attachment
        I was going to say, you want "unnarrow-buffer". But it turns out that's
        a macro in my init file. I don't remember now why I wrote it, but I
        must have been annoyed at some behavior of "1 narrow-buffer" which
        unnarrows (widens) it:


        ;------------------------------------------------------------
        ; unnarrow-buffer: leave user at previously-narrowed area
        ;------------------------------------------------------------
        define-macro unnarrow-buffer
        set-variable #l3 $window-aline ; save in case of failure

        ; Save narrowed area's start/end
        beginning-of-buffer
        set-variable #l1 $window-aline
        end-of-buffer
        backward-line ; otherwise $window-aline = EOF
        set-variable #l2 $window-aline

        !force 1 narrow-buffer
        !if $status ; 1=succeed
        ; Set region to previously-narrowed area
        #l1 goto-line
        set-mark
        #l2 goto-line
        forward-line
        3 show-region
        show-region ;; doesn't work for some reason
        !else
        ; if narrow-buffer fails, now at EOF
        #l3 goto-line ; take us back to current line
        ml-write "[Buffer is not narrowed]"
        !bell
        !abort
        !endif
        !emacro
        !force global-bind-key unnarrow-buffer "C-x >"


        > Is there a non-menu way of activating the opposite of "narrow-region"
        > in me? I tried "widen" (as in Gnu-EMacs) but this was unknown. Other
        > keywords like "region", "narrow" etc. with apropos gave also nothing
        > appropiate...
        >
        > Meino


        --
        Thomas Hundt <tom@...> +1-415-867-6698
      Your message has been successfully submitted and would be delivered to recipients shortly.