emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] org-capture, removing whitespace from new captures


From: paulusm
Subject: [O] [PATCH] org-capture, removing whitespace from new captures
Date: Wed, 14 Sep 2011 07:19:26 +1000
User-agent: Mutt/1.5.21 (2010-09-15)

I found myself manually "cleaning" most CAPTURE buffers of whitespace
prior to committing them with C-c C-c.  The attached patch adds a new
property :whitespace-cleanup to the org-capture-templates.

--
Paul.



diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index a7dc92b..ae5af6d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -205,6 +205,9 @@ properties are:
                      capture was invoked, kill the buffer again after capture
                      is finalized.
 
+ :whitespace-cleanup When set, call `whitespace-cleanup' prior to
+                     widening the buffer.
+
 The template defines the text to be inserted.  Often this is an
 org-mode entry (so the first line should start with a star) that
 will be filed as a child of the target headline.  It can also be
@@ -329,7 +332,8 @@ calendar                |  %:type %:date"
                            ((const :format "%v " :clock-keep) (const t))
                            ((const :format "%v " :clock-resume) (const t))
                            ((const :format "%v " :unnarrowed) (const t))
-                           ((const :format "%v " :kill-buffer) (const t))))))))
+                           ((const :format "%v " :kill-buffer) (const t))
+                           ((const :format "%v " :whitespace-cleanup) (const 
t))))))))
 
 (defcustom org-capture-before-finalize-hook nil
   "Hook that is run right before a capture process is finalized.
@@ -544,6 +548,9 @@ captured item after finalizing."
          (org-clock-in)))
       (message "Interrupted clock has been resumed")))
 
+  (when (org-capture-get :whitespace-cleanup 'local)
+    (whitespace-cleanup))
+
   (let ((beg (point-min))
        (end (point-max))
        (abort-note nil))



reply via email to

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