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

RE: [jasspa] Newbie Q: Narrow-to-region

Expand Messages
  • Phillips, Steven
    ... The narrow command works on lines, not part of lines, i.e. if I set the mark half way along this line and then did forward-line then 4 narrow-buffer the
    Message 1 of 3 , Jul 7, 2005
    • 0 Attachment
      > Now your macro does the following sequence, starting at the beginnig
      > of the text:
      >
      > search-forward "d"
      > beginning-of-line
      > set-mark
      > end-of-line
      > 4 narrow-buffer
      >
      > with the last command it fails with
      >
      > "illegal narrow"

      The narrow command works on lines, not part of lines, i.e. if I set the
      mark half way along this line and then did forward-line then 4
      narrow-buffer the whole line would be narrowed. Your region did not span
      a line so there were no lines to narrow.

      > and:
      > If a file has no final CR/LF or LF the last line cannot be
      > narrowed...or am I wrong (as usual... ;)

      ME has a line flag which tells it whether to write out a line
      termination or not, it sets this flag to no when it has to split a long
      line (greater that 65520) or if the last line does not have a CR. ME
      always inserts a blank line at the end so alas you are wrong, you will
      always be able to narrow the last text containing line.

      Steve
    • Thomas Hundt
      Without trying to figure out your exact problem, let me say that sometimes you end up using the technique: copy stuff to a temporary buffer, do some work on
      Message 2 of 3 , Jul 8, 2005
      • 0 Attachment
        Without trying to figure out your exact problem, let me say that
        sometimes you end up using the technique: copy stuff to a temporary
        buffer, do some work on it, and copy it back. Maybe that will help.

        -Th


        Phillips, Steven wrote:
        >> Now your macro does the following sequence, starting at the beginnig
        >> of the text:
        >>
        >> search-forward "d"
        >> beginning-of-line
        >> set-mark
        >> end-of-line
        >> 4 narrow-buffer
        >>
        >> with the last command it fails with
        >>
        >> "illegal narrow"
        >
        >
        > The narrow command works on lines, not part of lines, i.e. if I set the
        > mark half way along this line and then did forward-line then 4
        > narrow-buffer the whole line would be narrowed. Your region did not span
        > a line so there were no lines to narrow.
        >
        >
        >> and:
        >> If a file has no final CR/LF or LF the last line cannot be
        >> narrowed...or am I wrong (as usual... ;)
        >
        >
        > ME has a line flag which tells it whether to write out a line
        > termination or not, it sets this flag to no when it has to split a long
        > line (greater that 65520) or if the last line does not have a CR. ME
        > always inserts a blank line at the end so alas you are wrong, you will
        > always be able to narrow the last text containing line.
        >
        > Steve
      Your message has been successfully submitted and would be delivered to recipients shortly.