ソースを参照

org-src.el (org-src-native-tab-command-maybe): Check that we are in a source code block

* org-src.el (org-src-native-tab-command-maybe): Check that we
are in a source code block.

Consider this content:

#+HEADERS: :var data1=1
#+BEGIN_SRC emacs-lisp :var data2=2
  (message "data1:%S, data2:%S" data1 data2)
#+END_SRC

Before the fix, hitting TAB on #+HEADERS would throw an error.
Bastien Guerry 12 年 前
コミット
9c8f4a53d7
1 ファイル変更2 行追加2 行削除
  1. 2 2
      lisp/org-src.el

+ 2 - 2
lisp/org-src.el

@@ -877,9 +877,9 @@ issued in the language major mode buffer."
 
 (defun org-src-native-tab-command-maybe ()
   "Perform language-specific TAB action.
-Alter code block according to effect of TAB in the language major
-mode."
+Alter code block according to what TAB does in the language major mode."
   (and org-src-tab-acts-natively
+       (org-in-src-block-p)
        (not (equal this-command 'org-shifttab))
        (let ((org-src-strip-leading-and-trailing-blank-lines nil))
 	 (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))))