From 59c0f820ba21c0a1b8b7493eb86a0516a12b175d Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 14 Dec 2012 18:38:37 +0100 Subject: [PATCH 2/3] Require ob instead of ob-core. --- lisp/ob-exp.el | 2 +- lisp/ob-table.el | 2 +- lisp/org-src.el | 73 ++++++++++++++++++++++++++++---------------------------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index a71717b..03f2f5f 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -23,7 +23,7 @@ ;; along with GNU Emacs. If not, see . ;;; Code: -(require 'ob-core) +(require 'ob) (eval-when-compile (require 'cl)) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index b7cd106..242ddf0 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -50,7 +50,7 @@ ;; #+TBLFM: $2='(sbe 'fibbd (n $1)) ;;; Code: -(require 'ob-core) +(require 'ob) (defun org-babel-table-truncate-at-newline (string) "Replace newline character with ellipses. diff --git a/lisp/org-src.el b/lisp/org-src.el index 6937c59..1b38aa2 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -32,8 +32,7 @@ (require 'org-macs) (require 'org-compat) -(require 'ob-keys) -(require 'ob-comint) +(require 'ob) (eval-when-compile (require 'cl)) @@ -201,39 +200,41 @@ There is a mode hook, and keybindings for `org-edit-src-exit' and `org-edit-src-save'") (defun org-edit-src-code (&optional context code edit-buffer-name) - "Edit the source CODE block at point. -The code is copied to a separate buffer and the appropriate mode -is turned on. When done, exit with \\[org-edit-src-exit]. This will -remove the original code in the Org buffer, and replace it with the -edited version. An optional argument CONTEXT is used by \\[org-edit-src-save] -when calling this function. See `org-src-window-setup' to configure -the display of windows containing the Org buffer and the code buffer." + "Edit the source CODE example at point. +The example is copied to a separate buffer, and that buffer is +switched to the correct language mode. When done, exit with +\\[org-edit-src-exit]. This will remove the original code in the +Org buffer, and replace it with the edited version. An optional +argument CONTEXT is used by \\[org-edit-src-save] when calling +this function. See `org-src-window-setup' to configure the +display of windows containing the Org buffer and the code +buffer." (interactive) - (if (not (org-in-src-block-p)) - (user-error "Not in a source code block") - (unless (eq context 'save) - (setq org-edit-src-saved-temp-window-config (current-window-configuration))) - (let* ((mark (and (org-region-active-p) (mark))) - (case-fold-search t) - (info - ;; If the src region consists in no lines, we insert a blank - ;; line. - (let* ((temp (org-edit-src-find-region-and-lang)) - (beg (nth 0 temp)) - (end (nth 1 temp))) - (if (>= end beg) temp - (goto-char beg) - (insert "\n") - (org-edit-src-find-region-and-lang)))) - (full-info (org-babel-get-src-block-info 'light)) - (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive - (beg (make-marker)) - ;; Move marker with inserted text for case when src block is - ;; just one empty line, i.e. beg == end. - (end (copy-marker (make-marker) t)) - (allow-write-back-p (null code)) - block-nindent total-nindent ovl lang lang-f single lfmt buffer msg - begline markline markcol line col transmitted-variables) + (unless (eq context 'save) + (setq org-edit-src-saved-temp-window-config (current-window-configuration))) + (let* ((mark (and (org-region-active-p) (mark))) + (case-fold-search t) + (info + ;; If the src region consists in no lines, we insert a blank + ;; line. + (let* ((temp (org-edit-src-find-region-and-lang)) + (beg (nth 0 temp)) + (end (nth 1 temp))) + (if (>= end beg) temp + (goto-char beg) + (insert "\n") + (org-edit-src-find-region-and-lang)))) + (full-info (org-babel-get-src-block-info 'light)) + (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive + (beg (make-marker)) + ;; Move marker with inserted text for case when src block is + ;; just one empty line, i.e. beg == end. + (end (copy-marker nil t)) + (allow-write-back-p (null code)) + block-nindent total-nindent ovl lang lang-f single lfmt buffer msg + begline markline markcol line col transmitted-variables) + (if (not info) + nil (setq beg (move-marker beg (nth 0 info)) end (move-marker end (nth 1 info)) msg (if allow-write-back-p @@ -242,7 +243,7 @@ the display of windows containing the Org buffer and the code buffer." "Exit with C-c ' (C-c and single quote)") code (or code (buffer-substring-no-properties beg end)) lang (or (cdr (assoc (nth 2 info) org-src-lang-modes)) - (nth 2 info)) + (nth 2 info)) lang (if (symbolp lang) (symbol-name lang) lang) single (nth 3 info) block-nindent (nth 5 info) @@ -741,8 +742,6 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." (interactive) (org-src-in-org-buffer (save-buffer))) -(declare-function org-babel-tangle "ob-tangle" (&optional only-this-block target-file lang)) - (defun org-src-tangle (arg) "Tangle the parent buffer." (interactive) -- 1.8.0.1