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

Re: [jasspa] Graceful kill

Expand Messages
  • Meino Christian Cramer
    From: Phillips, Steven Subject: RE: [jasspa] Graceful kill Date: Mon, 11 Jul 2005 03:08:43 -0400 Hi STeven, thank you very much for
    Message 1 of 6 , Jul 11, 2005
    • 0 Attachment
      From: "Phillips, Steven" <sphillips@...>
      Subject: RE: [jasspa] Graceful kill
      Date: Mon, 11 Jul 2005 03:08:43 -0400

      Hi STeven,

      thank you very much for helping me with the macro !!! :)

      I missed out the "beginning-of-buffer" intentionally, just to give
      the user the possibily to decide by her/himself, from where to delete
      all (non) matching lines.

      Your solution is by far more elegant than mine ! :)

      I will check it.

      Thanks a lot!

      Keep microemacsing!
      Meino


      > One thing both macros may be missing is a beginning-of-buffer to start
      > with.
      >
      > The second macro is very inefficient, I suggest you change this one
      > completely. You do not need to use narrows to achieve this, you just
      > need to kill all but matching lines:
      >
      > define-macro delete-non-matching-lines
      > set-variable #l1 @ml05 "delete-non-matching-lines"
      > beginning-of-buffer
      > set-mark
      > !repeat
      > !force search-forward #l1
      > !if $status
      > beginning-of-line
      > -1 kill-region
      > forward-line
      > set-mark
      > !endif
      > !until ¬ $status
      > end-of-buffer
      > -1 kill-region
      > beginning-of-buffer
      > !emacro
      >
      > Not tested this thoroughly but first indications are promising. The
      > version will not handle search strings that span multiple lines. It may
      > also fail to handle regex "^..." (start of line) searches correctly, you
      > should test this thoroughly before you rely on this working correctly.
      >
      > Steve
      >
      > > -----Original Message-----
      > > From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf
      > Of
      > > Meino Christian Cramer
      > > Sent: Sunday, July 10, 2005 5:51 AM
      > > To: jasspa@yahoogroups.com; thundt@...
      > > Subject: Re: [jasspa] Graceful kill
      > >
      > > From: Thomas Hundt <thundt@...>
      > > Subject: Re: [jasspa] Graceful kill
      > > Date: Sat, 09 Jul 2005 15:56:09 -0700
      > >
      > > Hi Thomas,
      > >
      > > This was my first try also....
      > > But it kills the narrowed parts also.
      > >
      > > I am trying to get this two working (first works in the meanwhile...)
      > >
      > >
      > > ;------------------------------------------------------------
      > > ; delete-matching-lines
      > > ;
      > > ;------------------------------------------------------------
      > > define-macro delete-matching-lines
      > > !force search-forward @mna
      > > !while $status
      > > beginning-of-line
      > > kill-line
      > > !force hunt-forward
      > > !done
      > > !emacro
      > >
      > > ;------------------------------------------------------------
      > > ; delete-not-matching-lines
      > > ;
      > > ;------------------------------------------------------------
      > > define-macro delete-non-matching-lines
      > > ;; set-variable $debug 1
      > > !force search-forward @mna
      > > !if $status
      > > set-variable #l1 1
      > > !else
      > > set-variable #l1 0
      > > !endif
      > > !while $status
      > > beginning-of-line
      > > set-mark
      > > forward-line
      > > 4 narrow-buffer
      > > !force hunt-forward
      > > !done
      > > !if #l1
      > > beginning-of-buffer
      > > set-mark
      > > end-of-buffer
      > > kill-region
      > > 0 narrow-buffer
      > > !endif
      > > ;; set-variable $debug 0
      > > !emacro
      > >
      > >
      > > Have a nice weekend and keep microemacsing! ;)
      > > Meino
      > >
      > >
      > >
      > >
      > >
      > >
      > > > The obvious thing to try is
      > > >
      > > > beginning-of-buffer
      > > > set-mark
      > > > end-of-buffer
      > > > kill-region
      > > >
      > > > Did you try this? It seems pretty "quick" to me.
      > > >
      > > > Another obvious way is to copy the part you've narrowed to somewhere
      > > > else, and kill the buffer.
      > > >
      > > >
      > > >
      > > >
      > > >
      > > > Meino Christian Cramer wrote:
      > > > > Hi,
      > > > >
      > > > > is there a way to quickly kill the contents of a buffer except
      > those
      > > > > few lines, which are narrowed out (invisible, 4 narrow-buffer
      > used) ?
      > > > >
      > > > > Keep microemacsing!
      > > > > 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
      > > >
      > > >
      > > >
      > > >
      > > >
      > > >
      > >
      > >
      > >
      > ________________________________________________________________________
      > __
      > >
      > > 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
      >
      >
      >
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.