annotate lisp/cedet/ede/shell.el @ 112013:f11676feb984

Fix up last change. * lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform): Fix up use of print-number-table. * src/print.c (PRINT_NUMBER_OBJECT, PRINT_NUMBER_STATUS): Remove. (print_preprocess): Fix handling of uninterned symbols in last change.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 22 Dec 2010 19:00:12 -0500
parents b150a06c6999
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105652
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; ede/shell.el --- A shell controlled by EDE.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2 ;;
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105842
diff changeset
3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
105652
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 ;;
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; (at your option) any later version.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;;; Commentary:
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; Run commands through a specialized EDE shell buffer. Commands will
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; be run as shell commands so users can type in their own thing in
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; the shells for testing purposes.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;;
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; Each thing that EDE wants to use will create a shell to interact with it.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;;; Code:
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (require 'ede)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 (declare-function comint-send-input "comint")
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 (defmethod ede-shell-run-something ((target ede-target) command)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 "Create a shell to run stuff for TARGET.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 COMMAND is a text string representing the thing to be run."
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (let* ((buff (ede-shell-buffer target))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (cp (ede-target-parent target))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (dd (oref cp :directory)))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;; Show the new buffer.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (when (not (get-buffer-window buff))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (switch-to-buffer-other-window buff t))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 ;; Force a shell into the buffer.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (shell buff)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (while (eq (point-min) (point))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 (accept-process-output))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ;; Change the default directory
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (if (not (string= (file-name-as-directory (expand-file-name default-directory))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 (file-name-as-directory (expand-file-name dd))))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; Go there.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (setq command (concat (concat "cd " dd ";" command))))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 ;; Run the command itself.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 (ede-shell-run-command command)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 ))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 (defun ede-shell-run-command (command)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 "Run the COMMAND in the current shell-buffer."
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 (require 'comint)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 ;; go to end
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 (goto-char (point-max))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 ;; Insert the stuff.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 (goto-char (point-max))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 (insert command)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ;; Send the command.
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (comint-send-input)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 )
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 (defmethod ede-shell-buffer ((target ede-target))
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 "Get the buffer for running shell commands for TARGET."
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 (let ((name (ede-name target)))
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
73 (get-buffer-create (format "*EDE Shell %s*" name))))
105652
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 (provide 'ede/shell)
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ;; Local variables:
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 ;; generated-autoload-file: "loaddefs.el"
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 ;; generated-autoload-load-name: "ede/shell"
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ;; End:
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81
105754
2313ef258869 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105652
diff changeset
82 ;; arch-tag: 71bb9dc4-ad1c-4ba3-a95e-531a90500ca9
105652
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 ;;; ede/shell.el ends here