mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-22 06:18:39 +00:00
org-src.el (org-edit-src-find-region-and-lang): Try to find table.el tables first
* org-src.el (org-edit-src-find-region-and-lang): Try to find table.el tables first. Thanks to Jacobo de Vera for insisting on this.
This commit is contained in:
parent
afc7b7bf4b
commit
a5815f3f5b
|
@ -528,6 +528,14 @@ the language, a switch telling if the content should be in a single line."
|
||||||
(pos (point))
|
(pos (point))
|
||||||
re1 re2 single beg end lang lfmt match-re1 ind entry)
|
re1 re2 single beg end lang lfmt match-re1 ind entry)
|
||||||
(catch 'exit
|
(catch 'exit
|
||||||
|
(when (org-at-table.el-p)
|
||||||
|
(re-search-backward "^[\t]*[^ \t|\\+]" nil t)
|
||||||
|
(setq beg (1+ (point-at-eol)))
|
||||||
|
(goto-char beg)
|
||||||
|
(or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
|
||||||
|
(progn (goto-char (point-max)) (newline)))
|
||||||
|
(setq end (1- (point-at-bol)))
|
||||||
|
(throw 'exit (list beg end 'table.el nil nil 0)))
|
||||||
(while (setq entry (pop re-list))
|
(while (setq entry (pop re-list))
|
||||||
(setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
|
(setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
|
||||||
single (nth 3 entry))
|
single (nth 3 entry))
|
||||||
|
@ -558,16 +566,7 @@ the language, a switch telling if the content should be in a single line."
|
||||||
(throw 'exit
|
(throw 'exit
|
||||||
(list (match-end 0) end
|
(list (match-end 0) end
|
||||||
(org-edit-src-get-lang lang)
|
(org-edit-src-get-lang lang)
|
||||||
single lfmt ind)))))))))
|
single lfmt ind))))))))))))
|
||||||
(when (org-at-table.el-p)
|
|
||||||
(re-search-backward "^[\t]*[^ \t|\\+]" nil t)
|
|
||||||
(setq beg (1+ (point-at-eol)))
|
|
||||||
(goto-char beg)
|
|
||||||
(or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
|
|
||||||
(progn (goto-char (point-max)) (newline)))
|
|
||||||
(setq end (point-at-bol))
|
|
||||||
(setq ind (org-edit-src-get-indentation beg))
|
|
||||||
(throw 'exit (list beg end 'table.el nil nil ind))))))
|
|
||||||
|
|
||||||
(defun org-edit-src-get-lang (lang)
|
(defun org-edit-src-get-lang (lang)
|
||||||
"Extract the src language."
|
"Extract the src language."
|
||||||
|
|
Loading…
Reference in a new issue