diff options
Diffstat (limited to 'lisp/org/org-src.el')
| -rw-r--r-- | lisp/org/org-src.el | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index b8d7c672be9..f870b2c714d 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el | |||
| @@ -348,7 +348,7 @@ the display of windows containing the Org buffer and the code buffer." | |||
| 348 | (condition-case e | 348 | (condition-case e |
| 349 | (funcall lang-f) | 349 | (funcall lang-f) |
| 350 | (error | 350 | (error |
| 351 | (error "Language mode `%s' fails with: %S" lang-f (nth 1 e))))) | 351 | (message "Language mode `%s' fails with: %S" lang-f (nth 1 e))))) |
| 352 | (dolist (pair transmitted-variables) | 352 | (dolist (pair transmitted-variables) |
| 353 | (org-set-local (car pair) (cadr pair))) | 353 | (org-set-local (car pair) (cadr pair))) |
| 354 | ;; Remove protecting commas from visible part of buffer. | 354 | ;; Remove protecting commas from visible part of buffer. |
| @@ -577,14 +577,6 @@ the language, a switch telling if the content should be in a single line." | |||
| 577 | (pos (point)) | 577 | (pos (point)) |
| 578 | re1 re2 single beg end lang lfmt match-re1 ind entry) | 578 | re1 re2 single beg end lang lfmt match-re1 ind entry) |
| 579 | (catch 'exit | 579 | (catch 'exit |
| 580 | (when (org-at-table.el-p) | ||
| 581 | (re-search-backward "^[\t]*[^ \t|\\+]" nil t) | ||
| 582 | (setq beg (1+ (point-at-eol))) | ||
| 583 | (goto-char beg) | ||
| 584 | (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) | ||
| 585 | (progn (goto-char (point-max)) (newline))) | ||
| 586 | (setq end (1- (point-at-bol))) | ||
| 587 | (throw 'exit (list beg end 'table.el nil nil 0))) | ||
| 588 | (while (setq entry (pop re-list)) | 580 | (while (setq entry (pop re-list)) |
| 589 | (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) | 581 | (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) |
| 590 | single (nth 3 entry)) | 582 | single (nth 3 entry)) |
| @@ -615,7 +607,15 @@ the language, a switch telling if the content should be in a single line." | |||
| 615 | (throw 'exit | 607 | (throw 'exit |
| 616 | (list (match-end 0) end | 608 | (list (match-end 0) end |
| 617 | (org-edit-src-get-lang lang) | 609 | (org-edit-src-get-lang lang) |
| 618 | single lfmt ind)))))))))))) | 610 | single lfmt ind))))))))) |
| 611 | (when (org-at-table.el-p) | ||
| 612 | (re-search-backward "^[\t]*[^ \t|\\+]" nil t) | ||
| 613 | (setq beg (1+ (point-at-eol))) | ||
| 614 | (goto-char beg) | ||
| 615 | (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) | ||
| 616 | (progn (goto-char (point-max)) (newline))) | ||
| 617 | (setq end (1- (point-at-bol))) | ||
| 618 | (throw 'exit (list beg end 'table.el nil nil 0)))))) | ||
| 619 | 619 | ||
| 620 | (defun org-edit-src-get-lang (lang) | 620 | (defun org-edit-src-get-lang (lang) |
| 621 | "Extract the src language." | 621 | "Extract the src language." |
| @@ -737,8 +737,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." | |||
| 737 | (unless (or single preserve-indentation (= total-nindent 0)) | 737 | (unless (or single preserve-indentation (= total-nindent 0)) |
| 738 | (setq indent (make-string total-nindent ?\ )) | 738 | (setq indent (make-string total-nindent ?\ )) |
| 739 | (goto-char (point-min)) | 739 | (goto-char (point-min)) |
| 740 | (while (re-search-forward "^" nil t) | 740 | (while (re-search-forward "\\(^\\).+" nil t) |
| 741 | (replace-match indent))) | 741 | (replace-match indent nil nil nil 1))) |
| 742 | (if (org-bound-and-true-p org-edit-src-picture) | 742 | (if (org-bound-and-true-p org-edit-src-picture) |
| 743 | (setq total-nindent (+ total-nindent 2))) | 743 | (setq total-nindent (+ total-nindent 2))) |
| 744 | (setq code (buffer-string)) | 744 | (setq code (buffer-string)) |
| @@ -753,14 +753,14 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." | |||
| 753 | (kill-buffer buffer)) | 753 | (kill-buffer buffer)) |
| 754 | (goto-char beg) | 754 | (goto-char beg) |
| 755 | (when allow-write-back-p | 755 | (when allow-write-back-p |
| 756 | (let ((buffer-undo-list t)) | 756 | (undo-boundary) |
| 757 | (delete-region beg (max beg end)) | 757 | (delete-region beg (max beg end)) |
| 758 | (unless (string-match "\\`[ \t]*\\'" code) | 758 | (unless (string-match "\\`[ \t]*\\'" code) |
| 759 | (insert code)) | 759 | (insert code)) |
| 760 | ;; Make sure the overlay stays in place | 760 | ;; Make sure the overlay stays in place |
| 761 | (when (eq context 'save) (move-overlay ovl beg (point))) | 761 | (when (eq context 'save) (move-overlay ovl beg (point))) |
| 762 | (goto-char beg) | 762 | (goto-char beg) |
| 763 | (if single (just-one-space)))) | 763 | (if single (just-one-space))) |
| 764 | (if (memq t (mapcar (lambda (overlay) | 764 | (if (memq t (mapcar (lambda (overlay) |
| 765 | (eq (overlay-get overlay 'invisible) | 765 | (eq (overlay-get overlay 'invisible) |
| 766 | 'org-hide-block)) | 766 | 'org-hide-block)) |