Mercurial > emacs
comparison lisp/org/ob-screen.el @ 111506:5cb272c831e8
Install org-mode version 7.3
author | Carsten Dominik <carsten.dominik@gmail.com> |
---|---|
date | Thu, 11 Nov 2010 22:10:19 -0600 |
parents | a150e8a14679 |
children | 76c2ff4450eb |
comparison
equal
deleted
inserted
replaced
111505:62aa3653746a | 111506:5cb272c831e8 |
---|---|
3 ;; Copyright (C) 2009, 2010 Free Software Foundation | 3 ;; Copyright (C) 2009, 2010 Free Software Foundation |
4 | 4 |
5 ;; Author: Benjamin Andresen | 5 ;; Author: Benjamin Andresen |
6 ;; Keywords: literate programming, interactive shell | 6 ;; Keywords: literate programming, interactive shell |
7 ;; Homepage: http://orgmode.org | 7 ;; Homepage: http://orgmode.org |
8 ;; Version: 7.01 | 8 ;; Version: 7.3 |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software: you can redistribute it and/or modify | 12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
43 | 43 |
44 (defvar org-babel-default-header-args:screen | 44 (defvar org-babel-default-header-args:screen |
45 '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm")) | 45 '((:results . "silent") (:session . "default") (:cmd . "sh") (:terminal . "xterm")) |
46 "Default arguments to use when running screen source blocks.") | 46 "Default arguments to use when running screen source blocks.") |
47 | 47 |
48 (defun org-babel-expand-body:screen (body params &optional processed-params) | |
49 "Expand BODY according to PARAMS, return the expanded body." body) | |
50 | |
51 (defun org-babel-execute:screen (body params) | 48 (defun org-babel-execute:screen (body params) |
52 "Send a block of code via screen to a terminal using Babel. | 49 "Send a block of code via screen to a terminal using Babel. |
53 \"default\" session is be used when none is specified." | 50 \"default\" session is used when none is specified." |
54 (message "Sending source code block to interactive terminal session...") | 51 (message "Sending source code block to interactive terminal session...") |
55 (save-window-excursion | 52 (save-window-excursion |
56 (let* ((processed-params (org-babel-process-params params)) | 53 (let* ((session (cdr (assoc :session params))) |
57 (session (nth 0 processed-params)) | |
58 (socket (org-babel-screen-session-socketname session))) | 54 (socket (org-babel-screen-session-socketname session))) |
59 (unless socket (org-babel-prep-session:screen session params)) | 55 (unless socket (org-babel-prep-session:screen session params)) |
60 (org-babel-screen-session-execute-string | 56 (org-babel-screen-session-execute-string |
61 session (org-babel-expand-body:screen body params))))) | 57 session (org-babel-expand-body:generic body params))))) |
62 | 58 |
63 (defun org-babel-prep-session:screen (session params) | 59 (defun org-babel-prep-session:screen (session params) |
64 "Prepare SESSION according to the header arguments specified in PARAMS." | 60 "Prepare SESSION according to the header arguments specified in PARAMS." |
65 (let* ((processed-params (org-babel-process-params params)) | 61 (let* ((session (cdr (assoc :session params))) |
66 (session (nth 0 processed-params)) | |
67 (vars (nth 1 processed-params)) | |
68 (socket (org-babel-screen-session-socketname session)) | 62 (socket (org-babel-screen-session-socketname session)) |
69 (vars (org-babel-ref-variables params)) | |
70 (cmd (cdr (assoc :cmd params))) | 63 (cmd (cdr (assoc :cmd params))) |
71 (terminal (cdr (assoc :terminal params))) | 64 (terminal (cdr (assoc :terminal params))) |
72 (process-name (concat "org-babel: terminal (" session ")"))) | 65 (process-name (concat "org-babel: terminal (" session ")"))) |
73 (apply 'start-process process-name "*Messages*" | 66 (apply 'start-process process-name "*Messages*" |
74 terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location | 67 terminal `("-T" ,(concat "org-babel: " session) "-e" ,org-babel-screen-location |