help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make sort-paragraph do non-paragraphs; key = numAsterisks


From: David Combs
Subject: make sort-paragraph do non-paragraphs; key = numAsterisks
Date: 3 Oct 2013 04:14:25 -0400

Maybe 20 years I solved with sort-paragraphs a file todo-tasks like
below, each task beginning with a "^\[\]",  where the sort-key is a
string of asterisks, and if no such string on the left of the 
pseudo-paragraphs first line, then the sort key is zero or negative
infinity or would "bottom" be a proper term for this also?
The MORE asterisks that first-line asterisk-string had, the 
HIGHER the sort-order, with no such asterisk-string giving zero.



------------------- beginning of file or region:

 [] get gas, plus
 fill one 5-gal tank.

   Also put Stabil into the lawnmower

 [] ** go to store

 [] **** order books from amazon:

   book1 ...

   book2 ...

 [] wash the dog
   and the cat too.

 [] ** email HELLO to John.

 [] 2oct13: ******* now is the time for
     all good men [NOTE: if necessary, I could
     have the possible asterisk-string shifted
     left, to come after the  "[]<whiteSpace>*" (THAT
     asterisk meaning, between you and me, 0 or 
     more white-chars)end-NOTE]

     to come to the aid of their country.

------------------- ending of file or region.

This was my idea of CHANGING what sort-paragraph
 thought a "paragraph" looked like:

The body of my pseudo paragraph contained a [] as the
first two chars, and included everything up to (not
through) the NEXT [] OR the EOB or end of region.


What I wanted to do was to pretend that each "[]" 
  (a) ended any prior "paragraph"
       and was not contained with in it
       (with option with its trailing "vertical" blankspace
         was or was not to be eaten away), AND ALSO

 (b) started a paragraph AND indeed was kept as part of it.


I used sort-paragraph rearrange the "paragraphs" of the
HIGHEST priority (MOST asterisks) ended up FIRST in the file or region..

I recall I had to fool with paragraph-start and -end,
and somehow made it work.

But I stupidly didn't save it somewhere I could find it,
with my documentation of it.


Thanks!

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]