2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4
;; MODULE : edit-session.scm
5
;; DESCRIPTION : editing routines for sessions
6
;; COPYRIGHT : (C) 2001 Joris van der Hoeven
8
;; This software falls under the GNU general public license and comes WITHOUT
9
;; ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for details.
10
;; If you don't have this file, write to the Free Software Foundation, Inc.,
11
;; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
(texmacs-module (texmacs edit edit-session)
17
toggle-session-math-input
18
session-multiline-input? toggle-session-multiline-input
19
session-return session-shift-return))
21
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25
(tm-define (toggle-session-math-input)
26
(:synopsis "Toggle mathematical input in sessions.")
27
(:check-mark "v" session-math-input?)
28
(session-use-math-input (not (session-math-input?))))
30
(define session-multiline-input #f)
31
(define (session-multiline-input?) session-multiline-input)
33
(tm-define (toggle-session-multiline-input)
34
(:synopsis "Toggle multi-line input in sessions.")
35
(:check-mark "v" session-multiline-input?)
36
(set! session-multiline-input (not session-multiline-input)))
38
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39
;; The return key in session input
40
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42
(define (session-get-input-string)
43
(let* ((p (search-upwards "input"))
44
(input (tree->object (tm-subtree (rcons p 2))))
45
(s (verbatim-serialize (get-env "prog-language") input)))
46
(substring s 0 (- (string-length s) 1))))
48
(define (session-process-input)
49
(let ((lan (get-env "prog-language"))
50
(ses (get-env "prog-session")))
51
(if (plugin-supports-input-done? lan)
52
(let* ((s (escape-quotes (session-get-input-string)))
53
(cmd (string-append "(input-done? \"" s "\")"))
54
(r (tree->object (connection-cmd lan ses cmd))))
60
(tm-define (session-return)
61
(:synopsis "Pressing return in session input.")
62
(if (session-multiline-input?)
64
(session-process-input)))
66
(tm-define (session-shift-return)
67
(:synopsis "Pressing shift-return in session input.")
68
(if (session-multiline-input?)
69
(session-process-input)