소스 검색

sometimes remove common indentation when trimming

* lisp/ob-C.el (org-babel-C-execute): Remove common indentation when
  trimming.

* lisp/ob-core.el (org-babel-read-result): Remove common indentation
  when trimming.
  (org-babel-update-block-body): Remove common indentation when
  trimming.

* lisp/ob-fortran.el (org-babel-execute:fortran): Remove common
  indentation when trimming.

* lisp/ob-tangle.el (org-babel-process-comment-text): Better default
  to process tangled comments.
Eric Schulte 11 년 전
부모
커밋
39070b7fc7
4개의 변경된 파일11개의 추가작업 그리고 8개의 파일을 삭제
  1. 3 2
      lisp/ob-C.el
  2. 3 2
      lisp/ob-core.el
  3. 3 2
      lisp/ob-fortran.el
  4. 2 2
      lisp/ob-tangle.el

+ 3 - 2
lisp/ob-C.el

@@ -107,8 +107,9 @@ or `org-babel-execute:C++'."
 		     (org-babel-process-file-name tmp-src-file)) ""))))
     (let ((results
            (org-babel-trim
-            (org-babel-eval
-             (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))
+	    (org-remove-indentation
+	     (org-babel-eval
+	      (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
       (org-babel-reassemble-table
        (org-babel-result-cond (cdr (assoc :result-params params))
 	 (org-babel-read results t)

+ 3 - 2
lisp/ob-core.el

@@ -1975,7 +1975,7 @@ following the source block."
      ((org-at-table-p) (org-babel-read-table))
      ((org-at-item-p) (org-babel-read-list))
      ((looking-at org-bracket-link-regexp) (org-babel-read-link))
-     ((looking-at org-block-regexp) (org-babel-trim (match-string 4)))
+     ((looking-at org-block-regexp) (org-remove-indentation (match-string 4)))
      ((or (looking-at "^[ \t]*: ") (looking-at "^[ \t]*:$"))
       (setq result-string
 	    (org-babel-trim
@@ -2307,7 +2307,8 @@ file's directory then expand relative links."
   (if (not (org-babel-where-is-src-block-head))
       (error "Not in a source block")
     (save-match-data
-      (replace-match (concat (org-babel-trim new-body) "\n") nil t nil 5))
+      (replace-match (concat (org-babel-trim (org-remove-indentation new-body))
+			     "\n") nil t nil 5))
     (indent-rigidly (match-beginning 5) (match-end 5) 2)))
 
 (defun org-babel-merge-params (&rest plists)

+ 3 - 2
lisp/ob-fortran.el

@@ -62,8 +62,9 @@
 		     (org-babel-process-file-name tmp-src-file)) ""))))
     (let ((results
            (org-babel-trim
-            (org-babel-eval
-             (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) ""))))
+            (org-remove-indentation
+	     (org-babel-eval
+	      (concat tmp-bin-file (if cmdline (concat " " cmdline) "")) "")))))
       (org-babel-reassemble-table
        (org-babel-result-cond (cdr (assoc :result-params params))
 	 (org-babel-read results)

+ 2 - 2
lisp/ob-tangle.el

@@ -106,11 +106,11 @@ controlled by the :comments header argument."
   :version "24.1"
   :type 'string)
 
-(defcustom org-babel-process-comment-text #'org-babel-trim
+(defcustom org-babel-process-comment-text #'org-remove-indentation
   "Function called to process raw Org-mode text collected to be
 inserted as comments in tangled source-code files.  The function
 should take a single string argument and return a string
-result.  The default value is `org-babel-trim'."
+result.  The default value is `org-remove-indentation'."
   :group 'org-babel
   :version "24.1"
   :type 'function)