From: Andrew Stribblehill <ads@wompom.org>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] Remove some blank leading blank lines from ASCII export.
Date: Sun, 9 Aug 2009 12:20:50 +0100 [thread overview]
Message-ID: <1f38ae890908090420q6db51cdfubedcba3020ba7a71@mail.gmail.com> (raw)
With the following org file:
------
Foo
In which foos are described.
#+OPTIONS: num:nil author:nil creator:nil timestamp:nil d:nil toc:nil skip:t
#+TITLE:
* The construction of a foo
** Armaments
------
I found exporting to ASCII gave five leading blank lines. The
following patch reduces that to one. (I'd love some help in tracking
down that final one.)
---
lisp/ChangeLog | 5 +++++
lisp/org-ascii.el | 11 +++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dd00a9a..2c477d7 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-09 Andrew Stribblehill <ads@wompom.org>
+
+ * org-ascii.el (org-export-as-ascii): Remove some leading blank
+ lines from output when skipping preamble.
+
2009-08-08 Bastien Guerry <bzg@altern.org>
* org.el (org-iswitchb): Fix bug when aborting the `org-iswitchb'
diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el
index ede4ccc..846be8a 100644
--- a/lisp/org-ascii.el
+++ b/lisp/org-ascii.el
@@ -266,11 +266,13 @@ publishing directory."
;; File header
(unless body-only
- (if title (org-insert-centered title ?=))
- (insert "\n")
+ (when (and title (not (string= "" title)))
+ (org-insert-centered title ?=)
+ (insert "\n"))
+
(if (and (or author email)
org-export-author-info)
- (insert (concat (nth 1 lang-words) ": " (or author "")
+ (insert(concat (nth 1 lang-words) ": " (or author "")
(if email (concat " <" email ">") "")
"\n")))
@@ -283,7 +285,8 @@ publishing directory."
(if (and date org-export-time-stamp-file)
(insert (concat (nth 2 lang-words) ": " date"\n")))
- (insert "\n\n"))
+ (unless (= (point) (point-min))
+ (insert "\n\n")))
(if (and org-export-with-toc (not body-only))
(progn
--
1.6.3.GIT
next reply other threads:[~2009-08-09 11:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 11:20 Andrew Stribblehill [this message]
2009-08-09 12:34 ` [PATCH] Remove some blank leading blank lines from ASCII export Carsten Dominik
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f38ae890908090420q6db51cdfubedcba3020ba7a71@mail.gmail.com \
--to=ads@wompom.org \
--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 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.