Browse Source

Fix tangling bug when major mode for LANGUAGE is not `LANGUAGE-mode'

* lisp/ob-core.el (org-babel-expand-noweb-references):
* lisp/ob-tangle.el (org-babel-tangle): Use `org-src-get-lang-mode' so
as to use proper major mode.

Reported-by: immanuel <immanuel.litzroth@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-08/msg00272.html>
Nicolas Goaziou 1 year ago
parent
commit
df30a056b2
2 changed files with 3 additions and 8 deletions
  1. 2 1
      lisp/ob-core.el
  2. 1 7
      lisp/ob-tangle.el

+ 2 - 1
lisp/ob-core.el

@@ -75,6 +75,7 @@
 (declare-function org-show-context "org" (&optional key))
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
+(declare-function org-src-get-lang-mode "org-src" (lang))
 (declare-function org-table-align "org-table" ())
 (declare-function org-table-end "org-table" (&optional table-type))
 (declare-function org-table-import "org-table" (file arg))
@@ -2763,7 +2764,7 @@ block but are passed literally to the \"example-block\"."
 			      ;; Comment, according to LANG mode,
 			      ;; string S.  Return new string.
 			      (with-temp-buffer
-				(funcall (intern (concat lang "-mode")))
+				(funcall (org-src-get-lang-mode lang))
 				(comment-region (point)
 						(progn (insert s) (point)))
 				(org-trim (buffer-string)))))

+ 1 - 7
lisp/ob-tangle.el

@@ -228,13 +228,7 @@ used to limit the exported source code blocks by language."
 	   (let* ((lang (car by-lang))
 		  (specs (cdr by-lang))
 		  (ext (or (cdr (assoc lang org-babel-tangle-lang-exts)) lang))
-		  (lang-f (intern
-			   (concat
-			    (or (and (cdr (assoc lang org-src-lang-modes))
-				     (symbol-name
-				      (cdr (assoc lang org-src-lang-modes))))
-				lang)
-			    "-mode")))
+		  (lang-f (org-src-get-lang-mode lang))
 		  she-banged)
 	     (mapc
 	      (lambda (spec)