From 2e5b3dede103bba0071144ec7b7fc250471c1463 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 28 Aug 2014 11:07:24 +0200 Subject: [PATCH 1/4] org-element: Interpret headlines according to `org-odd-levels-only' * lisp/org-element.el (org-element-headline-interpreter): Take into consideration `org-odd-levels-only' value. Small refactoring. * testing/lisp/test-org-element.el (test-org-element/headline-interpreter): Add test. --- lisp/org-element.el | 60 +++++++++++++++++--------------- testing/lisp/test-org-element.el | 7 +++- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 7a42138c2..76c93ceac 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -870,38 +870,40 @@ CONTENTS is the contents of the element." (org-element-property :tags headline)) (org-element-property :tags headline)))) (and tag-list - (format ":%s:" (mapconcat 'identity tag-list ":"))))) + (format ":%s:" (mapconcat #'identity tag-list ":"))))) (commentedp (org-element-property :commentedp headline)) (quotedp (org-element-property :quotedp headline)) (pre-blank (or (org-element-property :pre-blank headline) 0)) - (heading (concat (make-string (org-reduced-level level) ?*) - (and todo (concat " " todo)) - (and quotedp (concat " " org-quote-string)) - (and commentedp (concat " " org-comment-string)) - (and priority - (format " [#%s]" (char-to-string priority))) - (cond ((and org-footnote-section - (org-element-property - :footnote-section-p headline)) - (concat " " org-footnote-section)) - (title (concat " " title)))))) - (concat heading - ;; Align tags. - (when tags - (cond - ((zerop org-tags-column) (format " %s" tags)) - ((< org-tags-column 0) - (concat - (make-string - (max (- (+ org-tags-column (length heading) (length tags))) 1) - ? ) - tags)) - (t - (concat - (make-string (max (- org-tags-column (length heading)) 1) ? ) - tags)))) - (make-string (1+ pre-blank) 10) - contents))) + (heading + (concat (make-string (if org-odd-levels-only (1- (* level 2)) level) + ?*) + (and todo (concat " " todo)) + (and quotedp (concat " " org-quote-string)) + (and commentedp (concat " " org-comment-string)) + (and priority (format " [#%s]" (char-to-string priority))) + " " + (if (and org-footnote-section + (org-element-property :footnote-section-p headline)) + org-footnote-section + title)))) + (concat + heading + ;; Align tags. + (when tags + (cond + ((zerop org-tags-column) (format " %s" tags)) + ((< org-tags-column 0) + (concat + (make-string + (max (- (+ org-tags-column (length heading) (length tags))) 1) + ?\s) + tags)) + (t + (concat + (make-string (max (- org-tags-column (length heading)) 1) ?\s) + tags)))) + (make-string (1+ pre-blank) ?\n) + contents))) ;;;; Inlinetask diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index b18895087..12cd2bd4e 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -2209,7 +2209,12 @@ Outside list" (should (equal (org-test-parse-and-interpret "* Headline\n\n\nText after two blank lines.") - "* Headline\n\n\nText after two blank lines.\n"))) + "* Headline\n\n\nText after two blank lines.\n")) + ;; 8. Preserve `org-odd-levels-only' state. + (should + (equal "* H\n*** H2\n" + (let ((org-odd-levels-only t)) + (org-test-parse-and-interpret "* H\n*** H2"))))) (ert-deftest test-org-element/inlinetask-interpreter () "Test inlinetask interpretation." From 92aeca04b2b94c96a678f17648907e8dc0806aba Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 28 Aug 2014 11:23:50 +0200 Subject: [PATCH 2/4] ox-icalendar: Small fix * lisp/ox-icalendar.el (org-icalendar-export-current-agenda): Add missing properties. Also fix typo for body-only argument. --- lisp/ox-icalendar.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index 7ebee3582..52b274d42 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -903,7 +903,7 @@ This function assumes major mode for current buffer is (buffer-substring (point) (progn (outline-next-heading) (point))))))))) (forward-line))))) - 'icalendar file))) + 'icalendar t '(:ascii-charset utf-8 :ascii-links-to-notes nil)))) (with-temp-file file (insert (org-icalendar--vcalendar From e4e80bfa3377d4b07d58452be14ab1b314fac5fc Mon Sep 17 00:00:00 2001 From: Ernesto Durante Date: Mon, 25 Aug 2014 17:27:24 +0200 Subject: [PATCH 3/4] org-babel-eval: compilation-mode to deal with errors in (C/C++/D) --- lisp/ob-eval.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el index 057590f0c..9fbbb42f5 100644 --- a/lisp/ob-eval.el +++ b/lisp/ob-eval.el @@ -57,6 +57,12 @@ STDERR with `org-babel-eval-error-notify'." (progn (with-current-buffer err-buff (org-babel-eval-error-notify exit-code (buffer-string))) + (save-excursion + (when (get-buffer org-babel-error-buffer-name) + (with-current-buffer org-babel-error-buffer-name + (compilation-mode) + ;;compilation-mode enforces read-only + (read-only-mode 0)))) nil) (buffer-string))))) From ccf52269aa670ef6f46012bafdec90aee953282b Mon Sep 17 00:00:00 2001 From: Ernesto Durante Date: Mon, 25 Aug 2014 18:16:01 +0200 Subject: [PATCH 4/4] ob-C: fix missing function org-babel-expand-body:cpp --- lisp/ob-C.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/ob-C.el b/lisp/ob-C.el index 2e146d401..076276e88 100644 --- a/lisp/ob-C.el +++ b/lisp/ob-C.el @@ -82,6 +82,11 @@ is currently being evaluated.") This function calls `org-babel-execute:C++'." (org-babel-execute:C++ body params)) +(defun org-babel-expand-body:cpp (body params) + "Expand a block of C++ code with org-babel according to it's +header arguments." + (org-babel-expand-body:C++ body params)) + (defun org-babel-execute:C++ (body params) "Execute a block of C++ code with org-babel. This function is called by `org-babel-execute-src-block'."