dericbytes <dericby...@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 _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode