From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ryan C. Thompson" Subject: Re: Org-remember-handler fix for empty remember buffer Date: Mon, 08 Jun 2009 15:45:02 -0400 Message-ID: <4A2D6A3E.6000707@virginia.edu> References: <4A280827.2070705@virginia.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040708090809040804030202" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDkmT-0004qe-KU for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 15:45:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDkmN-0004ka-RQ for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 15:45:16 -0400 Received: from [199.232.76.173] (port=42583 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDkmN-0004kW-KN for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 15:45:11 -0400 Received: from fork4.mail.virginia.edu ([128.143.2.194]:38646) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDkmN-000563-0t for emacs-orgmode@gnu.org; Mon, 08 Jun 2009 15:45:11 -0400 Received: from localhost (localhost [127.0.0.1]) by fork4.mail.virginia.edu (Postfix) with ESMTP id 8810711B086 for ; Mon, 8 Jun 2009 15:45:09 -0400 (EDT) Received: from fork4.mail.virginia.edu ([127.0.0.1]) by localhost (fork4.mail.virginia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03073-10 for ; Mon, 8 Jun 2009 15:45:09 -0400 (EDT) Received: from mail-qy0-f185.google.com (mail-qy0-f185.google.com [209.85.221.185]) by fork4.mail.virginia.edu (Postfix) with ESMTP id 4A3A111B0A0 for ; Mon, 8 Jun 2009 15:45:08 -0400 (EDT) Received: by mail-qy0-f185.google.com with SMTP id 15so4570123qyk.8 for ; Mon, 08 Jun 2009 12:45:08 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------040708090809040804030202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------040708090809040804030202 Content-Type: text/x-patch; name="org-remember.el.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="org-remember.el.diff" --- /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)) --------------040708090809040804030202 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --------------040708090809040804030202--