Mercurial > emacs
annotate lisp/eshell/em-script.el @ 83167:69ebc75cb461
Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
* lisp/frame.el (make-frame-on-display): Update doc.
(make-frame): Handle display-id parameter. Update doc.
(frames-on-display-list): Update for display ids.
(framep-on-display): Ditto.
(suspend-frame): Use display-name, not frame-tty-name.
(selected-display): New function.
* lisp/server.el (server-delete-client): Use delete-display, not delete-tty.
(server-tty-live-p, server-handle-delete-tty): Removed.
(server-handle-delete-frame): Delete tty clients, if needed.
(server-process-filter): Set the display parameter, and use it when appropriate.
(server-handle-suspend-tty): Use the display parameter.
(server-start, server-unload-hook): Removed obsolete delete-tty hook.
* lisp/talk.el (talk): Always use talk-add-display.
(talk-add-tty-frame, talk-handle-delete-tty): Removed.
(talk-handle-delete-frame): New function.
(talk-add-display): Open a new frame only if parameter was not a frame.
* src/dispextern.h (get_display, Fdisplay_tty_type): New prototypes.
(Fframe_tty_type): Removed.
* src/dispnew.c (init_display): Use Fdisplay_tty_type, not Fframe_tty_type.
* src/frame.c (Qdisplay_id, Qdisplay_live_p): New symbols.
(make_terminal_frame): Get display as a parameter.
(Fmake_terminal_frame): Get/create display here; pass it to
make_terminal_frame.
(Fframe_display): New function.
(Fdelete_frame): Stop if the hook deleted the frame.
(syms_of_frame): Register new stuff.
* src/frame.h (Qdisplay_id, Qdisplay_live_p, make_terminal_frame):
Updated prototypes.
* src/keyboard.c (interrupt_signal): Updated comment.
* src/term.c (Vdelete_tty_after_functions): Removed variable.
(Qframe_tty_name, Qframe_tty_type): Removed.
(next_display_id): New var.
(tty_ring_bell): Don't do anything on suspended frames.
(Ftty_display_color_p, Ftty_display_color_cells): Doc update.
(get_display): New function.
(get_tty_display): Use it.
(get_named_tty_display): Ignore suspended displays.
(Fframe_tty_name): Renamed to Fdisplay_name. Handle all kinds of
displays.
(Fframe_tty_type): Renamed to Fdisplay_tty_type.
(init_initial_display): Set display name.
(term_init): Allow more displays on the same device. Set display name.
(Fdelete_tty): Removed.
(delete_tty): Don't run hooks.
(create_display): Set display id.
(delete_display): Free display name.
(Fdelete_display, Fdisplay_live_p, Fdisplay_list): New functions.
(Fsuspend_tty): Call hook with display id. Doc update.
(Fresume_tty): Refuse to resume when there is already an active display
on the same device. Call hook with display id. Doc update.
(syms_of_term): Reflect above changes.
* src/termhooks.h (struct display): Added `id' and `name' members.
(DISPLAY_ACTIVE_P): New macro.
* src/xfns.c (check_x_display_info): Handle display ids.
(Fx_create_frame): Try to get display from `display-id' parameter.
* src/xterm.c (x_term_init): Set display name.
(x_delete_display): Handle the case when `font_table' is NULL.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-207
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 04 Jul 2004 04:48:55 +0000 |
parents | 695cf19ef79e |
children | 18a818a2ee7c 375f2633d815 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37661
diff
changeset
|
1 ;;; em-script.el --- Eshell script files |
29876 | 2 |
29934
34b1ab9d583d
Change spelling of the Free Software Foundation.
Gerd Moellmann <gerd@gnu.org>
parents:
29876
diff
changeset
|
3 ;; Copyright (C) 1999, 2000 Free Software Foundation |
29876 | 4 |
32526 | 5 ;; Author: John Wiegley <johnw@gnu.org> |
6 | |
29876 | 7 ;; This file is part of GNU Emacs. |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 (provide 'em-script) | |
25 | |
26 (eval-when-compile (require 'esh-maint)) | |
27 | |
48578 | 28 (require 'eshell) |
29 | |
29876 | 30 (defgroup eshell-script nil |
31 "This module allows for the execution of files containing Eshell | |
32 commands, as a script file." | |
33 :tag "Running script files." | |
34 :group 'eshell-module) | |
35 | |
36 ;;; Commentary: | |
37 | |
38 ;;; User Variables: | |
39 | |
40 (defcustom eshell-script-load-hook '(eshell-script-initialize) | |
41 "*A list of functions to call when loading `eshell-script'." | |
42 :type 'hook | |
43 :group 'eshell-script) | |
44 | |
45 (defcustom eshell-login-script (concat eshell-directory-name "login") | |
46 "*If non-nil, a file to invoke when starting up Eshell interactively. | |
47 This file should be a file containing Eshell commands, where comment | |
48 lines begin with '#'." | |
49 :type 'file | |
50 :group 'eshell-script) | |
51 | |
52 (defcustom eshell-rc-script (concat eshell-directory-name "profile") | |
53 "*If non-nil, a file to invoke whenever Eshell is started. | |
54 This includes when running `eshell-command'." | |
55 :type 'file | |
56 :group 'eshell-script) | |
57 | |
58 ;;; Functions: | |
59 | |
60 (defun eshell-script-initialize () | |
61 "Initialize the script parsing code." | |
62 (make-local-variable 'eshell-interpreter-alist) | |
63 (setq eshell-interpreter-alist | |
64 (cons '((lambda (file) | |
65 (string= (file-name-nondirectory file) | |
66 "eshell")) . eshell/source) | |
67 eshell-interpreter-alist)) | |
33020 | 68 (make-local-variable 'eshell-complex-commands) |
69 (setq eshell-complex-commands | |
70 (append '("source" ".") eshell-complex-commands)) | |
29876 | 71 ;; these two variables are changed through usage, but we don't want |
72 ;; to ruin it for other modules | |
73 (let (eshell-inside-quote-regexp | |
74 eshell-outside-quote-regexp) | |
75 (and (not eshell-non-interactive-p) | |
76 eshell-login-script | |
77 (file-readable-p eshell-login-script) | |
78 (eshell-do-eval | |
79 (list 'eshell-commands | |
80 (catch 'eshell-replace-command | |
81 (eshell-source-file eshell-login-script))) t)) | |
82 (and eshell-rc-script | |
83 (file-readable-p eshell-rc-script) | |
84 (eshell-do-eval | |
85 (list 'eshell-commands | |
86 (catch 'eshell-replace-command | |
87 (eshell-source-file eshell-rc-script))) t)))) | |
88 | |
89 (defun eshell-source-file (file &optional args subcommand-p) | |
90 "Execute a series of Eshell commands in FILE, passing ARGS. | |
91 Comments begin with '#'." | |
92 (interactive "f") | |
93 (let ((orig (point)) | |
94 (here (point-max)) | |
95 (inhibit-point-motion-hooks t) | |
96 after-change-functions) | |
97 (goto-char (point-max)) | |
98 (insert-file-contents file) | |
99 (goto-char (point-max)) | |
100 (throw 'eshell-replace-command | |
101 (prog1 | |
102 (list 'let | |
103 (list (list 'eshell-command-name (list 'quote file)) | |
104 (list 'eshell-command-arguments | |
105 (list 'quote args))) | |
106 (let ((cmd (eshell-parse-command (cons here (point))))) | |
107 (if subcommand-p | |
108 (setq cmd (list 'eshell-as-subcommand cmd))) | |
109 cmd)) | |
110 (delete-region here (point)) | |
111 (goto-char orig))))) | |
112 | |
113 (defun eshell/source (&rest args) | |
114 "Source a file in a subshell environment." | |
115 (eshell-eval-using-options | |
116 "source" args | |
117 '((?h "help" nil nil "show this usage screen") | |
118 :show-usage | |
119 :usage "FILE [ARGS] | |
120 Invoke the Eshell commands in FILE in a subshell, binding ARGS to $1, | |
121 $2, etc.") | |
122 (eshell-source-file (car args) (cdr args) t))) | |
123 | |
37661
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
124 (put 'eshell/source 'eshell-no-numeric-conversions t) |
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
125 |
29876 | 126 (defun eshell/. (&rest args) |
127 "Source a file in the current environment." | |
128 (eshell-eval-using-options | |
129 "." args | |
130 '((?h "help" nil nil "show this usage screen") | |
131 :show-usage | |
132 :usage "FILE [ARGS] | |
133 Invoke the Eshell commands in FILE within the current shell | |
134 environment, binding ARGS to $1, $2, etc.") | |
135 (eshell-source-file (car args) (cdr args)))) | |
136 | |
37661
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
137 (put 'eshell/. 'eshell-no-numeric-conversions t) |
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
138 |
29876 | 139 ;;; Code: |
140 | |
52401 | 141 ;;; arch-tag: a346439d-5ba8-4faf-ac2b-3aacfeaa4647 |
29876 | 142 ;;; em-script.el ends here |