X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/2124ec92ffa31ba0a2e7b177f8de2dd6e27ded6d..9805f81dda38cd541ba8043f44e720e06adf6492:/lisp/org/org-src.el diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index dd56b12021..ac574ed4dd 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -1,13 +1,12 @@ ;;; org-src.el --- Source code examples in Org ;; -;; Copyright (C) 2004-2011 Free Software Foundation, Inc. +;; Copyright (C) 2004-2012 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik -;; Bastien Guerry +;; Bastien Guerry ;; Dan Davison ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; ;; This file is part of GNU Emacs. ;; @@ -42,7 +41,7 @@ (declare-function org-at-table.el-p "org" ()) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-switch-to-buffer-other-window "org" (&rest args)) -(declare-function org-pop-to-buffer-same-window +(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (defcustom org-edit-src-region-extra nil @@ -154,7 +153,7 @@ but which mess up the display of a snippet in Org exported files.") (defcustom org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql) - ("calc" . fundamental) ("C" . c)) + ("calc" . fundamental) ("C" . c) ("cpp" . c++)) "Alist mapping languages to their major mode. The key is the language name, the value is the string that should be inserted as the name of the major mode. For many languages this is @@ -216,7 +215,7 @@ buffer." (case-fold-search t) (info (org-edit-src-find-region-and-lang)) (full-info (org-babel-get-src-block-info)) - (org-mode-p (or (org-mode-p) (derived-mode-p 'org-mode))) + (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive (beg (make-marker)) (end (make-marker)) (allow-write-back-p (null code)) @@ -307,7 +306,7 @@ buffer." (error "Language mode `%s' fails with: %S" lang-f (nth 1 e))))) (dolist (pair transmitted-variables) (org-set-local (car pair) (cadr pair))) - (when org-mode-p + (when (eq major-mode 'org-mode) (goto-char (point-min)) (while (re-search-forward "^," nil t) (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) @@ -399,7 +398,7 @@ the fragment in the Org-mode buffer." (case-fold-search t) (msg (substitute-command-keys "Edit, then exit with C-c ' (C-c and single quote)")) - (org-mode-p (org-mode-p)) + (org-mode-p (eq major-mode 'org-mode)) (beg (make-marker)) (end (make-marker)) (preserve-indentation org-src-preserve-indentation) @@ -618,7 +617,7 @@ the language, a switch telling if the content should be in a single line." (when (org-bound-and-true-p org-edit-src-from-org-mode) (goto-char (point-min)) (while (re-search-forward - (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) + (if (eq major-mode 'org-mode) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t) (if (eq (org-current-line) line) (setq delta (1+ delta))) (replace-match ",\\1"))) (when (org-bound-and-true-p org-edit-src-picture) @@ -717,6 +716,7 @@ the language, a switch telling if the content should be in a single line." (with-current-buffer (marker-buffer beg-marker) (goto-char (marker-position beg-marker)) ,@body)))) +(def-edebug-spec org-src-do-at-code-block (body)) (defun org-src-do-key-sequence-at-code-block (&optional key) "Execute key sequence at code block in the source Org buffer. @@ -813,5 +813,4 @@ LANG is a string, and the returned major mode is a symbol." (provide 'org-src) - ;;; org-src.el ends here