* headline entries order.
@ 2009-04-14 20:24 dericbytes
2009-04-14 22:09 ` Nick Dokos
2009-04-18 15:38 ` I wrote code to reverse top-level entries order within region dericbytes
0 siblings, 2 replies; 6+ messages in thread
From: dericbytes @ 2009-04-14 20:24 UTC (permalink / raw)
To: emacs-orgmode
I want to reverse the entries of my logs. So the newest is at the top. I know
there is the C-c ^ sort function, but I'm not sure if any are applicable. (Not
all of my entries are dated)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: headline entries order.
2009-04-14 20:24 headline entries order dericbytes
@ 2009-04-14 22:09 ` Nick Dokos
2009-04-14 23:17 ` Bernt Hansen
2009-04-18 15:38 ` I wrote code to reverse top-level entries order within region dericbytes
1 sibling, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2009-04-14 22:09 UTC (permalink / raw)
To: dericbytes; +Cc: emacs-orgmode
dericbytes <dericbytes@gmail.com> wrote:
> I want to reverse the entries of my logs. So the newest is at the top. I know
> there is the C-c ^ sort function, but I'm not sure if any are applicable. (Not
> all of my entries are dated)
>
o If you are trying to rearrange headings and there is no "natural"
order, then the best I can offer is to number them by hand, use org-sort
and then strip the numbers out again. For simple cases (e.g. to reverse
the order of the entries), the numbering can be done by a program, but
you will have to write that program (I'd use an awk script.) Or you can
add dates to the entries that are missing them (interpolating between
the closest entries that *are* date-marked) - and you won't even have to
strip them out again.
o If what you are trying to do is enter your entries with org-remember and
you want to set up the template so that the new ones go at the top, this
portion of the Org manual should help:
,----
| 9.1.2 Remember templates
| ------------------------
|
| In combination with Org, you can use templates to generate different
| types of remember notes. For example, if you would like to use one
| template to create general TODO entries, another one for journal
| entries, and a third one for collecting random ideas, you could use:
|
| (setq org-remember-templates
| '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
| ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
| ("Idea" ?i "* %^{Title}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
|
| In these entries, the first string is just a name, and the character
| specifies how to select the template. It is useful if the character is
| also the first letter of the name. The next string specifies the
| template. Two more (optional) strings give the file in which, and the
| headline under which the new note should be stored. The file (if not
| present or `nil') defaults to `org-default-notes-file', the heading to
| `org-remember-default-headline'. If the file name is not an absolute
| path, it will be interpreted relative to `org-directory'. The heading
| can also be the symbols `top' or `bottom' to send note as level 1
| entries to the beginning or end of the file, respectively.
`----
HTH,
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: headline entries order.
2009-04-14 22:09 ` Nick Dokos
@ 2009-04-14 23:17 ` Bernt Hansen
0 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2009-04-14 23:17 UTC (permalink / raw)
To: nicholas.dokos; +Cc: dericbytes, emacs-orgmode
Nick Dokos <nicholas.dokos@hp.com> writes:
> dericbytes <dericbytes@gmail.com> wrote:
>
>> I want to reverse the entries of my logs. So the newest is at the top. I know
>> there is the C-c ^ sort function, but I'm not sure if any are applicable. (Not
>> all of my entries are dated)
>>
>
> o If you are trying to rearrange headings and there is no "natural"
> order, then the best I can offer is to number them by hand, use org-sort
> and then strip the numbers out again. For simple cases (e.g. to reverse
> the order of the entries), the numbering can be done by a program, but
> you will have to write that program (I'd use an awk script.) Or you can
> add dates to the entries that are missing them (interpolating between
> the closest entries that *are* date-marked) - and you won't even have to
> strip them out again.
>
> o If what you are trying to do is enter your entries with org-remember and
> you want to set up the template so that the new ones go at the top, this
> portion of the Org manual should help:
>
>
> ,----
> | 9.1.2 Remember templates
> | ------------------------
> |
> | In combination with Org, you can use templates to generate different
> | types of remember notes. For example, if you would like to use one
> | template to create general TODO entries, another one for journal
> | entries, and a third one for collecting random ideas, you could use:
> |
> | (setq org-remember-templates
> | '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
> | ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
> | ("Idea" ?i "* %^{Title}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
> |
> | In these entries, the first string is just a name, and the character
> | specifies how to select the template. It is useful if the character is
> | also the first letter of the name. The next string specifies the
> | template. Two more (optional) strings give the file in which, and the
> | headline under which the new note should be stored. The file (if not
> | present or `nil') defaults to `org-default-notes-file', the heading to
> | `org-remember-default-headline'. If the file name is not an absolute
> | path, it will be interpreted relative to `org-directory'. The heading
> | can also be the symbols `top' or `bottom' to send note as level 1
> | entries to the beginning or end of the file, respectively.
> `----
Also look at the variables 'org-reverse-note-order' and
'org-log-states-order-reversed' for inserting future notes and logs in
the right order.
-Bernt
^ permalink raw reply [flat|nested] 6+ messages in thread
* I wrote code to reverse top-level entries order within region
2009-04-14 20:24 headline entries order dericbytes
2009-04-14 22:09 ` Nick Dokos
@ 2009-04-18 15:38 ` dericbytes
2009-04-19 1:15 ` Nick Dokos
1 sibling, 1 reply; 6+ messages in thread
From: dericbytes @ 2009-04-18 15:38 UTC (permalink / raw)
To: emacs-orgmode
> I want to reverse the entries of my logs. So the newest is at the top. I know
> there is the C-c ^ sort function, but I'm not sure if any are applicable. (Not
> all of my entries are dated)
Here's a link to the code I wrote to reverse top-level entries on region.
http://dericbytes.blogspot.com/2009/04/emacs-orgmode-my-code-to-reverse.html
NOTE: its my first attempt at elisp, any tips for improving future code welcome.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: I wrote code to reverse top-level entries order within region
2009-04-18 15:38 ` I wrote code to reverse top-level entries order within region dericbytes
@ 2009-04-19 1:15 ` Nick Dokos
2009-04-19 11:45 ` thanks nick dericbytes
0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2009-04-19 1:15 UTC (permalink / raw)
To: dericbytes; +Cc: emacs-orgmode
dericbytes <dericbytes@gmail.com> wrote:
>
> > I want to reverse the entries of my logs. So the newest is at the top. I know
> > there is the C-c ^ sort function, but I'm not sure if any are applicable. (Not
> > all of my entries are dated)
>
>
> Here's a link to the code I wrote to reverse top-level entries on region.
> http://dericbytes.blogspot.com/2009/04/emacs-orgmode-my-code-to-reverse.html
>
> NOTE: its my first attempt at elisp, any tips for improving future code welcome.
>
I took a quick look and a few things jumped out:
o indentation - but maybe that's the result of publishing it on the web?
If not, emacs knows a lot about that, so let it help!
o If you do C-h f beginning-of-buffer <RET>, it'll tell you:
"....
Don't use this command in Lisp programs!
(goto-char (point-min)) is faster and avoids clobbering the mark."
o In fact, the last bit of the program
; delete old contents of buffer
(let ((buffer-beg)
(buffer-end))
(beginning-of-buffer)
(setq buffer-beg (point))
(end-of-buffer)
(setq buffer-end (point))
(kill-region buffer-beg buffer-end))
can be simplified to
(kill-region (point-min) (point-max)
If you have not done so already, you should look at the the "Emacs Lisp
Intro" and, after you are familiar with that, at the Elisp manual: both
of them should be available through Info - in Emacs, just do C-h i, find
the right menu entry and press <RET>. On my Ubuntu 8.04 system, they
show up like this:
...
* Emacs Lisp Intro: (eintr). A simple introduction to Emacs Lisp
programming.
* Elisp: (elisp). The Emacs Lisp Reference Manual.
...
HTH,
Nick
^ permalink raw reply [flat|nested] 6+ messages in thread
* thanks nick
2009-04-19 1:15 ` Nick Dokos
@ 2009-04-19 11:45 ` dericbytes
0 siblings, 0 replies; 6+ messages in thread
From: dericbytes @ 2009-04-19 11:45 UTC (permalink / raw)
To: emacs-orgmode
Thanks nick,
made those changes + I do use indenting in emacs (indent-region)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-19 11:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14 20:24 headline entries order dericbytes
2009-04-14 22:09 ` Nick Dokos
2009-04-14 23:17 ` Bernt Hansen
2009-04-18 15:38 ` I wrote code to reverse top-level entries order within region dericbytes
2009-04-19 1:15 ` Nick Dokos
2009-04-19 11:45 ` thanks nick dericbytes
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).