all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org-capture, removing whitespace from new captures
@ 2011-09-13 21:19 paulusm
  2011-09-14  8:44 ` Olaf Dietsche
  0 siblings, 1 reply; 8+ messages in thread
From: paulusm @ 2011-09-13 21:19 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-18 17:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 21:19 [PATCH] org-capture, removing whitespace from new captures paulusm
2011-09-14  8:44 ` Olaf Dietsche
2011-09-14 11:14   ` Paul
2011-09-14 12:59     ` Olaf Dietsche
2011-10-29 12:08     ` Bastien
2012-02-18 15:50       ` David Maus
2012-02-18 17:19         ` Bastien
2012-02-18 17:33           ` David Maus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.