Parcourir la source

ob-*.el: Use ̀org-no-properties' instead of `org-babel-clean-text-properties'

* ob.el (org-babel-get-src-block-info)
(org-babel-check-src-block, org-babel-current-result-hash)
(org-babel-parse-src-block-match, org-babel-read-link)
(org-babel-insert-result, org-babel-clean-text-properties):
Use ̀org-no-properties' instead of
`org-babel-clean-text-properties'.
(org-babel-clean-text-properties): Delete redundant function
`org-babel-clean-text-properties'.

* ob-tangle.el (org-babel-tangle-collect-blocks)
(org-babel-tangle-comment-links): Ditto.

* ob-table.el (sbe): Ditto.

* ob-lob.el (org-babel-lob-get-info)
(org-babel-lob-execute): Ditto.

* ob-exp.el (org-babel-exp-non-block-elements): Ditto.
Bastien Guerry il y a 12 ans
Parent
commit
9afc2ac56b
5 fichiers modifiés avec 17 ajouts et 22 suppressions
  1. 1 1
      lisp/ob-exp.el
  2. 2 2
      lisp/ob-lob.el
  3. 1 1
      lisp/ob-table.el
  4. 2 2
      lisp/ob-tangle.el
  5. 11 16
      lisp/ob.el

+ 1 - 1
lisp/ob-exp.el

@@ -194,7 +194,7 @@ this template."
 				      org-babel-default-lob-header-args
 				      (org-babel-params-from-properties)
 				      (org-babel-parse-header-arguments
-				       (org-babel-clean-text-properties
+				       (org-no-properties
 					(concat ":var results="
 						(mapconcat #'identity
 							   (butlast lob-info)

+ 2 - 2
lisp/ob-lob.el

@@ -105,7 +105,7 @@ if so then run the appropriate source block from the Library."
       (beginning-of-line 1)
       (when (looking-at org-babel-lob-one-liner-regexp)
 	(append
-	 (mapcar #'org-babel-clean-text-properties
+	 (mapcar #'org-no-properties
 		 (list
 		  (format "%s%s(%s)%s"
 			  (funcall nonempty 3 12)
@@ -124,7 +124,7 @@ if so then run the appropriate source block from the Library."
 		      org-babel-default-header-args
 		      (org-babel-params-from-properties)
 		      (org-babel-parse-header-arguments
-		       (org-babel-clean-text-properties
+		       (org-no-properties
 			(concat ":var results="
 				(mapconcat #'identity (butlast info) " "))))))
 	 (pre-info (funcall mkinfo pre-params))

+ 1 - 1
lisp/ob-table.el

@@ -99,7 +99,7 @@ as shown in the example below.
 				      (prog1 nil (setq quote t))
 				    (prog1 (if quote
 					       (format "\"%s\"" el)
-					     (org-babel-clean-text-properties el))
+					     (org-no-properties el))
 				      (setq quote nil))))
 				(cdr var)))))
 	     variables)))

+ 2 - 2
lisp/ob-tangle.el

@@ -374,7 +374,7 @@ code blocks by language."
 		   (link ((lambda (link)
 			    (and (string-match org-bracket-link-regexp link)
 				 (match-string 1 link)))
-			  (org-babel-clean-text-properties
+			  (org-no-properties
 			   (org-store-link nil))))
 		   (source-name
 		    (intern (or (nth 4 info)
@@ -441,7 +441,7 @@ code blocks by language."
   (let* ((start-line (org-babel-where-is-src-block-head))
 	 (file (buffer-file-name))
 	 (link (org-link-escape (progn (call-interactively 'org-store-link)
-				       (org-babel-clean-text-properties
+				       (org-no-properties
 					(car (pop org-stored-links))))))
 	 (source-name (nth 4 (or info (org-babel-get-src-block-info 'light))))
 	 (link-data (mapcar (lambda (el)

+ 11 - 16
lisp/ob.el

@@ -254,7 +254,7 @@ Returns a list
 		   (nth 2 info)
 		   (org-babel-parse-header-arguments (match-string 1)))))
 	  (when (looking-at org-babel-src-name-w-name-regexp)
-	    (setq name (org-babel-clean-text-properties (match-string 3)))
+	    (setq name (org-no-properties (match-string 3)))
 	    (when (and (match-string 5) (> (length (match-string 5)) 0))
 	      (setf (nth 2 info) ;; merge functional-syntax vars and header-args
 		    (org-babel-merge-params
@@ -661,7 +661,7 @@ arguments and pop open the results in a preview buffer."
     (dolist (header (mapcar (lambda (arg) (substring (symbol-name (car arg)) 1))
 			    (and (org-babel-where-is-src-block-head)
 				 (org-babel-parse-header-arguments
-				  (org-babel-clean-text-properties
+				  (org-no-properties
 				   (match-string 4))))))
       (dolist (name names)
 	(when (and (not (string= header name))
@@ -1061,7 +1061,7 @@ the current subtree."
 (defun org-babel-current-result-hash ()
   "Return the current in-buffer hash."
   (org-babel-where-is-src-block-result)
-  (org-babel-clean-text-properties (match-string 3)))
+  (org-no-properties (match-string 3)))
 
 (defun org-babel-set-current-result-hash (hash)
   "Set the current in-buffer hash to HASH."
@@ -1223,10 +1223,10 @@ may be specified in the properties of the current outline entry."
 (defun org-babel-parse-src-block-match ()
   "Parse the results from a match of the `org-babel-src-block-regexp'."
   (let* ((block-indentation (length (match-string 1)))
-	 (lang (org-babel-clean-text-properties (match-string 2)))
+	 (lang (org-no-properties (match-string 2)))
          (lang-headers (intern (concat "org-babel-default-header-args:" lang)))
 	 (switches (match-string 3))
-         (body (org-babel-clean-text-properties
+         (body (org-no-properties
 		(let* ((body (match-string 5))
 		       (sub-length (- (length body) 1)))
 		  (if (and (> sub-length 0)
@@ -1248,23 +1248,23 @@ may be specified in the properties of the current outline entry."
            (org-babel-params-from-properties lang)
 	   (if (boundp lang-headers) (eval lang-headers) nil)
 	   (org-babel-parse-header-arguments
-            (org-babel-clean-text-properties (or (match-string 4) ""))))
+            (org-no-properties (or (match-string 4) ""))))
 	  switches
 	  block-indentation)))
 
 (defun org-babel-parse-inline-src-block-match ()
   "Parse the results from a match of the `org-babel-inline-src-block-regexp'."
-  (let* ((lang (org-babel-clean-text-properties (match-string 2)))
+  (let* ((lang (org-no-properties (match-string 2)))
          (lang-headers (intern (concat "org-babel-default-header-args:" lang))))
     (list lang
           (org-babel-strip-protective-commas
-           (org-babel-clean-text-properties (match-string 5)) lang)
+           (org-no-properties (match-string 5)) lang)
           (org-babel-merge-params
            org-babel-default-inline-header-args
            (org-babel-params-from-properties lang)
            (if (boundp lang-headers) (eval lang-headers) nil)
            (org-babel-parse-header-arguments
-            (org-babel-clean-text-properties (or (match-string 4) "")))))))
+            (org-no-properties (or (match-string 4) "")))))))
 
 (defun org-babel-balanced-split (string alts)
   "Split STRING on instances of ALTS.
@@ -1823,7 +1823,7 @@ If the path of the link is a file path it is expanded using
 `expand-file-name'."
   (let* ((case-fold-search t)
          (raw (and (looking-at org-bracket-link-regexp)
-                   (org-babel-clean-text-properties (match-string 1))))
+                   (org-no-properties (match-string 1))))
          (type (and (string-match org-link-types-re raw)
                     (match-string 1 raw))))
     (cond
@@ -1891,7 +1891,7 @@ code ---- the results are extracted in the syntax of the source
           optional LANG argument."
   (if (stringp result)
       (progn
-        (setq result (org-babel-clean-text-properties result))
+        (setq result (org-no-properties result))
         (when (member "file" result-params)
 	  (setq result (org-babel-result-to-file
 			result (when (assoc :file-desc (nth 2 info))
@@ -2363,11 +2363,6 @@ block but are passed literally to the \"example-block\"."
       (funcall nb-add (buffer-substring index (point-max))))
     new-body))
 
-(defun org-babel-clean-text-properties (text)
-  "Strip all properties from text return."
-  (when text
-    (set-text-properties 0 (length text) nil text) text))
-
 (defun org-babel-strip-protective-commas (body &optional lang)
   "Strip protective commas from bodies of source blocks."
   (with-temp-buffer