From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: A tidy file maketh a tidy mind? Date: Tue, 14 Aug 2012 23:50:51 +0200 Message-ID: <87ehn9ywg4.fsf@altern.org> References: <50204522.8030402@neilsmithline.com> <50208208.3080300@neilsmithline.com> <87sjbzxc49.fsf_-_@gnu.org> <16161.1344344832@alphaville> <87txwdi94q.fsf@gmail.com> <87boij423l.fsf@altern.org> <20120813115601.21602lsob8q1dpwk@webmail.tuffmail.net> <874no57gtn.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1P0N-0002M0-Je for emacs-orgmode@gnu.org; Tue, 14 Aug 2012 17:50:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1P0M-0006UU-NI for emacs-orgmode@gnu.org; Tue, 14 Aug 2012 17:50:27 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:46883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1P0M-0006UK-Fp for emacs-orgmode@gnu.org; Tue, 14 Aug 2012 17:50:26 -0400 Received: by wibhn17 with SMTP id hn17so687305wib.12 for ; Tue, 14 Aug 2012 14:50:25 -0700 (PDT) In-Reply-To: <874no57gtn.fsf@gmx.com> (Eric Schulte's message of "Tue, 14 Aug 2012 07:10:17 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: 'Mash , emacs-orgmode@gnu.org Eric Schulte writes: > The code could look something like the following > > ;; -*- emacs-lisp -*- > (let ((buf (org-element-parse-buffer))) ;; convert current buffer to ELisp > (dolist (rule cleanup-rules) ;; run cleanup transformations on the buffer > (setq buf (funcall rule buf))) > (delete-region (point-min) (point-max)) ;; replace the buffer contents > (insert (org-element-interpret-data buf))) ;; with the cleaned results > > The only catch would be deciding what to add to the cleanup-rules. One useful clean up operation, also illustrated in 'Mash's example, is to put time-stamps (i.e. SCHEDULED: lines etc.) where they belong, right after the headline. Is there any taker for such a function? It would be a nice addition to org-hacks.org! -- Bastien