emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Org-remember-handler fix for empty remember buffer


From: Carsten Dominik
Subject: Re: [Orgmode] Org-remember-handler fix for empty remember buffer
Date: Mon, 8 Jun 2009 22:51:18 +0200

Hi Ryan,

On Jun 8, 2009, at 9:45 PM, Ryan C. Thompson wrote:

Carsten Dominik wrote:
Fixed, thanks.

- Carsten

On Jun 4, 2009, at 7:45 PM, Ryan C. Thompson wrote:


If you used the code I sent in my previous email, I discovered a bug in it. It would delete the last nonblank line as well. I have fixed this in my code. I've fixed things by copying the function into my .emacs and then editing it, so generating a diff -u is nontrivial. I'll do it now though.

Thanks.


Also, I should mention that I'm not an experienced elisp hacker, so the solution that I came up with might not be the best.

No worry, I do look at every patch beore checking it in.

- Carsten


--- /usr/share/emacs/site-lisp/org-mode/org-remember.el 2009-03-13 10:00:34.000000000 -0400
+++ org-remember.el     2009-06-08 15:43:04.708905961 -0400
@@ -740,10 +740,14 @@
    (replace-match ""))
  (goto-char (point-max))
  (beginning-of-line 1)
-  (while (looking-at "[ \t]*$\\|##.*")
-    (delete-region (1- (point)) (point-max))
-    (beginning-of-line 1))
  (catch 'quit
+    (while (looking-at "[ \t]*$\\|##.*")
+      ;; Abort on empty buffer
+      (if (= (point) (point-min))
+          (throw 'quit nil)
+        (previous-line)))
+    (end-of-line 1) ; end of last nonblank line
+    (delete-region (point) (point-max))
    (if org-note-abort (throw 'quit nil))
    (let* ((visitp (org-bound-and-true-p org-jump-to-target-location))
           (previousp (and (member current-prefix-arg '((16) 0))





reply via email to

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