I set org-mode Babel to open rhtml block with web-mode.
(add-to-list 'org-src-lang-modes '("rhtml" . web))
And I have configure company-robe for completing for Rails code in
(defadvice company-robe (before web-mode-set-up-ac-sources activate) "Set `robe-mode' based on current language before running `company-robe'." (if (equal major-mode 'web-mode) (let ((web-mode-cur-language (web-mode-language-at-pos))) (if (string= web-mode-cur-language "erb") (unless robe-mode (robe-mode)) (if robe-mode (robe-mode -1)) ))))
The upper advice work correctly in normal file
But web-mode can't recognize engine correctly in Org-mode babel block.
When I run
(web-mode-language-at-pos), it shows
The author of web-mode suggest me to use
Here the original question I asked in web-mode issues: https://github.com/fxbois/web-mode/issues/678
My problem is the org edited src buffer's major-mode is
web-mode, but I want to set
erb. The only identity in src block is this:
#+BEGIN_SRC rhtml #+END_SRC
I checked out Org-mode source code, found some functions relative with this.
org-src-construct-edit-buffer-name (org-buffer-name lang)
org-babel-get-src-block-info(it should return a list: (language body header-arguments-alist switches name indent block-head) )
I tried to run
(nth 0 (org-babel-get-src-block-info)) in opened src buffer which is opened by
But only get