emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: paulusm@telstra.com
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-capture, removing whitespace from new captures
Date: Wed, 14 Sep 2011 07:19:26 +1000	[thread overview]
Message-ID: <20110913211926.GB15861@shift> (raw)

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	other threads:[~2011-09-13 21:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 21:19 paulusm [this message]
2011-09-14  8:44 ` [PATCH] org-capture, removing whitespace from new captures 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

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=20110913211926.GB15861@shift \
    --to=paulusm@telstra.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).