From 1aae9d83bf664753f1a62fcba0c748c17ea06827 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 27 Sep 2012 14:53:32 +0200 Subject: [PATCH 1/4] org-e-ascii: Add variables to format paragraphs * contrib/lisp/org-e-ascii.el (org-e-ascii-indented-line-width, org-e-ascii-paragraph-spacing): New variables. (org-e-ascii-paragraph): Use a new variable. (org-e-ascii-filter-paragraph-spacing): New function. --- contrib/lisp/org-e-ascii.el | 50 ++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index 42f4bc91e..657f732c5 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -121,6 +121,7 @@ (lambda (s v b) (org-e-ascii-export-to-ascii s v b '(:ascii-charset utf-8)))))) :filters-alist ((:filter-headline . org-e-ascii-filter-headline-blank-lines) + (:filter-parse-tree . org-e-ascii-filter-paragraph-spacing) (:filter-section . org-e-ascii-filter-headline-blank-lines)) :options-alist ((:ascii-charset nil nil org-e-ascii-charset))) @@ -180,6 +181,26 @@ original Org buffer at the same place." (integer :tag "Number of blank lines before contents") (integer :tag "Number of blank lines after contents")))) +(defcustom org-e-ascii-indented-line-width 'auto + "Additional indentation width for the first line in a paragraph. +If the value is an integer, indent the first line of each +paragraph by this number. If it is the symbol `auto' preserve +indentation from original document." + :group 'org-export-e-ascii + :type '(choice + (integer :tag "Number of white spaces characters") + (const :tag "Preserve original width" auto))) + +(defcustom org-e-ascii-paragraph-spacing 'auto + "Number of white lines between paragraphs. +If the value is an integer, add this number of blank lines +between contiguous paragraphs. If is it the symbol `auto', keep +the same number of blank lines as in the original document." + :group 'org-export-e-ascii + :type '(choice + (integer :tag "Number of blank lines") + (const :tag "Preserve original spacing" auto))) + (defcustom org-e-ascii-charset 'ascii "The charset allowed to represent various elements and objects. Possible values are: @@ -1355,9 +1376,12 @@ INFO is a plist holding contextual information." "Transcode a PARAGRAPH element from Org to ASCII. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." - (org-e-ascii--fill-string - contents - (org-e-ascii--current-text-width paragraph info) info)) + (let ((contents (if (not (wholenump org-e-ascii-indented-line-width)) contents + (concat + (make-string org-e-ascii-indented-line-width ? ) + (replace-regexp-in-string "\\`[ \t]+" "" contents))))) + (org-e-ascii--fill-string + contents (org-e-ascii--current-text-width paragraph info) info))) ;;;; Plain List @@ -1726,7 +1750,7 @@ contextual information." org-e-ascii-quote-margin))) -;;; Filter +;;; Filters (defun org-e-ascii-filter-headline-blank-lines (headline back-end info) "Filter controlling number of blank lines after an headline. @@ -1743,6 +1767,24 @@ For any other back-end, HEADLINE is returned as-is." (let ((blanks (make-string (1+ (cdr org-e-ascii-headline-spacing)) ?\n))) (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))) +(defun org-e-ascii-filter-paragraph-spacing (tree back-end info) + "Filter controlling number of blank lines between paragraphs. + +TREE is the parse tree. BACK-END is the symbol specifying +back-end used for export. INFO is a plist used as +a communication channel. + +This function only applies to `e-ascii' back-end. See +`org-e-ascii-paragraph-spacing' for information. + +For any other back-end, HEADLINE is returned as-is." + (when (wholenump org-e-ascii-paragraph-spacing) + (org-element-map + tree 'paragraph + (lambda (p) + (org-element-put-property p :post-blank org-e-ascii-paragraph-spacing)))) + tree) + ;;; Interactive function From 60127b7096e41d16289d77ea9f378b0e16c540de Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 27 Sep 2012 19:13:05 +0200 Subject: [PATCH 2/4] org-e-ascii: Fix docstrings * contrib/lisp/org-e-ascii.el (org-e-ascii-filter-headline-blank-lines, org-e-ascii-filter-paragraph-spacing): Fix docstrings. --- contrib/lisp/org-e-ascii.el | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index 657f732c5..e6bd0dd46 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -1760,9 +1760,7 @@ BACK-END is symbol specifying back-end used for export. INFO is plist containing the communication channel. This function only applies to `e-ascii' back-end. See -`org-e-ascii-headline-spacing' for information. - -For any other back-end, HEADLINE is returned as-is." +`org-e-ascii-headline-spacing' for information." (if (not org-e-ascii-headline-spacing) headline (let ((blanks (make-string (1+ (cdr org-e-ascii-headline-spacing)) ?\n))) (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))) @@ -1775,9 +1773,7 @@ back-end used for export. INFO is a plist used as a communication channel. This function only applies to `e-ascii' back-end. See -`org-e-ascii-paragraph-spacing' for information. - -For any other back-end, HEADLINE is returned as-is." +`org-e-ascii-paragraph-spacing' for information." (when (wholenump org-e-ascii-paragraph-spacing) (org-element-map tree 'paragraph From ee19704a71819add21a8997082dd6667c40b8547 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 27 Sep 2012 19:25:38 +0200 Subject: [PATCH 3/4] org-e-ascii: Fix 1aae9d83bf664753f1a62fcba0c748c17ea06827 * contrib/lisp/org-e-ascii.el (org-e-ascii-filter-paragraph-spacing): Only apply variables to contiguous paragraphs. --- contrib/lisp/org-e-ascii.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index e6bd0dd46..c78bd1a03 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -1778,7 +1778,10 @@ This function only applies to `e-ascii' back-end. See (org-element-map tree 'paragraph (lambda (p) - (org-element-put-property p :post-blank org-e-ascii-paragraph-spacing)))) + (when (eq (org-element-type (org-export-get-next-element p info)) + 'paragraph) + (org-element-put-property + p :post-blank org-e-ascii-paragraph-spacing))))) tree) From 418ec0f5e7be3cda66b05c63d60c6633a244c587 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Thu, 27 Sep 2012 20:36:08 +0200 Subject: [PATCH 4/4] mk/server.mk: (hopefully) correct generation of the package description vector * mk/server.mk: Correct generation of the package description vector. Use empty list instead of nil and add the package type "tar". With these changes a local copy of the package directory is recognized correctly. Add local file variable to the package description files so that the byte compiler does not try to compile them. --- mk/server.mk | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mk/server.mk b/mk/server.mk index ae91dae22..7cdae55db 100644 --- a/mk/server.mk +++ b/mk/server.mk @@ -65,17 +65,19 @@ elpa-dirty: @$(MAKE) GITVERSION=$(GITVERSION:release_%=%)-elpa version autoloads -@$(RM) $(ORGDIR) $(ORGTAR) $(ORGZIP) ln -s . $(ORGDIR) - echo "(define-package \"org\" \"$(PKG_TAG)\" \"$(PKG_DOC)\" $(PKG_REQ))" \ - > org-pkg.el - tar --exclude=Makefile --exclude="org-colview-xemacs.el" --transform='s:\(lisp\|doc\)/::' -cf $(ORGDIR).tar \ + echo "(define-package \"org\"" > org-pkg.el + echo " \"$(PKG_TAG)\" \"$(PKG_DOC)\" ($(PKG_REQ)))" >> org-pkg.el + echo ";; no-byte-compile: t" >> org-pkg.el + tar --exclude=Makefile --exclude="org-colview-xemacs.el" \ + --transform='s:\(lisp\|doc\)/::' -cf $(ORGDIR).tar \ $(foreach dist, $(ORGELPA), $(ORGDIR)/$(dist)) -@$(RM) $(ORGDIR) org-pkg.el elpa-up: info card elpa-dirty archive-contents $(CP) archive-contents $(ORGDIR).tar $(SERVROOT)/pkg/daily/ archive-contents: - echo "(1 (org . [($(PKG_TAG)) nil \"$(PKG_DOC)\"])\n" > $@ \ - " (org-plus-contrib . [($(PKG_TAG)) nil \"$(PKG_DOC)\"]))" >> $@ + echo "(1 (org . [($(PKG_TAG)) ($(PKG_REQ)) \"$(PKG_DOC)\" tar])" > $@ + echo " (org-plus-contrib . [($(PKG_TAG)) ($(PKG_REQ)) \"$(PKG_DOC)\" tar]))" >> $@ elpaplus: cleanall info card elpaplus-dirty elpaplus-dirty elpaplus-up: ORG_ADD_CONTRIB=org-* @@ -84,9 +86,11 @@ elpaplus-dirty: @$(MAKE) GITVERSION=$(GITVERSION:release_%=%)-elpaplus version autoloads -@$(RM) $(ORGDIR) $(ORGTAR) $(ORGZIP) ln -s . $(ORGDIR) - echo "(define-package \"org-plus-contrib\" \"$(PKG_TAG)\" \"$(PKG_DOC)\" $(PKG_REQ))" \ - > org-plus-contrib-pkg.el - tar --exclude=Makefile --exclude="org-colview-xemacs.el" --transform='s:\(lisp\|doc\)/::' -cf $(ORGDIR).tar \ + echo "(define-package \"org-plus-contrib\"" > org-plus-contrib-pkg.el + echo " \"$(PKG_TAG)\" \"$(PKG_DOC)\" ($(PKG_REQ)))" >> org-plus-contrib-pkg.el + echo ";; no-byte-compile: t" >> org-plus-contrib-pkg.el + tar --exclude=Makefile --exclude="org-colview-xemacs.el" \ + --transform='s:\(lisp\|doc\)/::' -cf $(ORGDIR).tar \ $(foreach dist, $(ORGELPAPLUS), $(ORGDIR)/$(dist)) -@$(RM) $(ORGDIR) org-plus-contrib-pkg.el @$(MAKE) cleanlisp