emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Ryan C. Thompson" <rct2c@virginia.edu>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Org-remember-handler fix for empty remember buffer
Date: Mon, 08 Jun 2009 15:45:02 -0400	[thread overview]
Message-ID: <4A2D6A3E.6000707@virginia.edu> (raw)
In-Reply-To: <A1C5A829-5C73-463B-BE12-533FCCEC5A1E@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

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.

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. If you know a better 
way to do the same thing, go for it.

[-- Attachment #2: org-remember.el.diff --]
[-- Type: text/x-patch, Size: 806 bytes --]

--- /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))

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

  reply	other threads:[~2009-06-08 19:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 17:45 Org-remember-handler fix for empty remember buffer Ryan C. Thompson
2009-06-07 14:18 ` Carsten Dominik
2009-06-08 17:45 ` Carsten Dominik
2009-06-08 19:45   ` Ryan C. Thompson [this message]
2009-06-08 20:51     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A2D6A3E.6000707@virginia.edu \
    --to=rct2c@virginia.edu \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).