Mercurial > emacs
annotate lisp/pcmpl-cvs.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 | a32551e9db34 375f2633d815 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
29959
diff
changeset
|
1 ;;; pcmpl-cvs.el --- functions for dealing with cvs completions |
29959 | 2 |
46081
e0672852f9dd
Added my name as the maintainer of this file.
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2002 Free Software Foundation |
e0672852f9dd
Added my name as the maintainer of this file.
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
4 |
e0672852f9dd
Added my name as the maintainer of this file.
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
5 ;; Author: John Wiegley <johnw@gnu.org> |
29959 | 6 |
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 ;;; Commentary: | |
25 | |
26 ;; These functions provide completion rules for the `cvs' tool. | |
27 | |
28 ;;; Code: | |
29 | |
30 (provide 'pcmpl-cvs) | |
31 | |
32 (require 'pcomplete) | |
33 (require 'executable) | |
34 | |
35 (defgroup pcmpl-cvs nil | |
36 "Functions for dealing with CVS completions" | |
37 :group 'pcomplete) | |
38 | |
39 ;; User Variables: | |
40 | |
41 (defcustom pcmpl-cvs-binary (or (executable-find "cvs") "cvs") | |
42 "*The full path of the 'cvs' binary." | |
43 :type 'file | |
44 :group 'pcmpl-cvs) | |
45 | |
46 ;; Functions: | |
47 | |
48 ;;;###autoload | |
49 (defun pcomplete/cvs () | |
50 "Completion rules for the `cvs' command." | |
51 (let ((pcomplete-help "(cvs)Invoking CVS")) | |
52 (pcomplete-opt "HQqrwlntvfab/T/e*d/z?s") | |
53 (pcomplete-here* (pcmpl-cvs-commands)) | |
54 (cond ((pcomplete-test "add") | |
55 (setq pcomplete-help "(cvs)Adding files") | |
56 (pcomplete-opt "k?m?") | |
57 (while (pcomplete-here (pcmpl-cvs-entries '(??))))) | |
58 ((pcomplete-test "remove") | |
59 (setq pcomplete-help "(cvs)Removing files") | |
60 (pcomplete-opt "flR") | |
61 (while (pcomplete-here (pcmpl-cvs-entries '(?U))))) | |
62 ((pcomplete-test "init") | |
63 (setq pcomplete-help "(cvs)Creating a repository")) | |
64 ((pcomplete-test '("login" "logout")) | |
65 (setq pcomplete-help "(cvs)Password authentication client")) | |
66 ((pcomplete-test "import") | |
67 (setq pcomplete-help "(cvs)import") | |
68 (pcomplete-opt "dk?I(pcmpl-cvs-entries '(??))b?m?W?")) | |
69 ((pcomplete-test "checkout") | |
70 (setq pcomplete-help "(cvs)checkout") | |
71 (pcomplete-opt "ANPRcflnpsr?D?d/k?j?") | |
72 (pcomplete-here (pcmpl-cvs-modules))) | |
73 ((pcomplete-test "rtag") | |
74 (setq pcomplete-help "(cvs)Creating a branch") | |
75 (pcomplete-opt "aflRndbr?DF") | |
76 (pcomplete-here (pcmpl-cvs-modules))) | |
77 ((pcomplete-test "release") | |
78 (setq pcomplete-help "(cvs)release") | |
79 (pcomplete-opt "d") | |
80 (while (pcomplete-here (pcomplete-dirs)))) | |
81 ((pcomplete-test "export") | |
82 (setq pcomplete-help "(cvs)export") | |
83 (pcomplete-opt "NflRnr?D?d/k?") | |
84 (pcomplete-here (pcmpl-cvs-modules))) | |
85 ((pcomplete-test "commit") | |
86 (setq pcomplete-help "(cvs)commit files") | |
87 (pcomplete-opt "nRlfF.m?r(pcmpl-cvs-tags '(?M ?R ?A))") | |
88 (while (pcomplete-here (pcmpl-cvs-entries '(?M ?R ?A))))) | |
89 ((pcomplete-test "diff") | |
90 (setq pcomplete-help "(cvs)Viewing differences") | |
91 (let ((opt-index pcomplete-index) | |
92 saw-backdate) | |
93 (pcomplete-opt "lRD?Nr(pcmpl-cvs-tags)") | |
94 (while (< opt-index pcomplete-index) | |
95 (if (pcomplete-match "^-[Dr]" (- pcomplete-index opt-index)) | |
96 (setq saw-backdate t opt-index pcomplete-index) | |
97 (setq opt-index (1+ opt-index)))) | |
98 (while (pcomplete-here | |
99 (pcmpl-cvs-entries (unless saw-backdate '(?M))))))) | |
100 ((pcomplete-test "unedit") | |
101 (setq pcomplete-help "(cvs)Editing files") | |
102 (pcomplete-opt "lR") | |
103 (while (pcomplete-here (pcmpl-cvs-entries '(?M ?R ?A))))) | |
104 ((pcomplete-test "update") | |
105 (setq pcomplete-help "(cvs)update") | |
106 (pcomplete-opt | |
107 (concat "APdflRpk?r(pcmpl-cvs-tags '(?U ?P))D?" | |
108 "j(pcmpl-cvs-tags '(?U ?P))" | |
109 "I(pcmpl-cvs-entries '(??))W?")) | |
110 (while (pcomplete-here (pcmpl-cvs-entries '(?U ?P))))) | |
111 (t | |
112 (while (pcomplete-here (pcmpl-cvs-entries))))))) | |
113 | |
114 (defun pcmpl-cvs-commands () | |
115 "Return a list of available CVS commands." | |
116 (with-temp-buffer | |
117 (call-process pcmpl-cvs-binary nil t nil "--help-commands") | |
118 (goto-char (point-min)) | |
119 (let (cmds) | |
120 (while (re-search-forward "^\\s-+\\([a-z]+\\)" nil t) | |
121 (setq cmds (cons (match-string 1) cmds))) | |
122 (pcomplete-uniqify-list cmds)))) | |
123 | |
124 (defun pcmpl-cvs-modules () | |
125 "Return a list of available modules under CVS." | |
126 (with-temp-buffer | |
127 (call-process pcmpl-cvs-binary nil t nil "checkout" "-c") | |
128 (goto-char (point-min)) | |
129 (let (entries) | |
130 (while (re-search-forward "\\(\\S-+\\)$" nil t) | |
131 (setq entries (cons (match-string 1) entries))) | |
132 (pcomplete-uniqify-list entries)))) | |
133 | |
134 (defun pcmpl-cvs-tags (&optional opers) | |
135 "Return all the tags which could apply to the files related to OPERS." | |
136 (let ((entries (pcmpl-cvs-entries opers)) | |
137 tags) | |
138 (with-temp-buffer | |
139 (apply 'call-process pcmpl-cvs-binary nil t nil | |
140 "status" "-v" entries) | |
141 (goto-char (point-min)) | |
142 (while (re-search-forward "Existing Tags:" nil t) | |
143 (forward-line) | |
144 (while (not (looking-at "^$")) | |
145 (unless (looking-at "^\\s-+\\(\\S-+\\)\\s-+") | |
146 (error "Error in output from `cvs status -v'")) | |
147 (setq tags (cons (match-string 1) tags)) | |
148 (forward-line)))) | |
149 (pcomplete-uniqify-list tags))) | |
150 | |
151 (defun pcmpl-cvs-entries (&optional opers) | |
152 "Return the Entries for the current directory. | |
153 If OPERS is a list of characters, return entries for which that | |
154 operation character applies, as displayed by 'cvs -n update'." | |
155 (let* ((arg (pcomplete-arg)) | |
156 (dir (file-name-as-directory | |
157 (or (file-name-directory arg) ""))) | |
158 (nondir (or (file-name-nondirectory arg) "")) | |
159 entries) | |
160 (if opers | |
161 (with-temp-buffer | |
162 (and dir (cd dir)) | |
163 (call-process pcmpl-cvs-binary nil t nil | |
164 "-q" "-n" "-f" "update"); "-l") | |
165 (goto-char (point-min)) | |
166 (while (re-search-forward "^\\(.\\) \\(.+\\)$" nil t) | |
167 (if (memq (string-to-char (match-string 1)) opers) | |
168 (setq entries (cons (match-string 2) entries))))) | |
169 (with-temp-buffer | |
170 (insert-file-contents (concat dir "CVS/Entries")) | |
171 (goto-char (point-min)) | |
172 (while (not (eobp)) | |
173 (let* ((line (buffer-substring (line-beginning-position) | |
174 (line-end-position))) | |
175 (fields (split-string line "/")) | |
176 text) | |
177 (if (eq (aref line 0) ?/) | |
178 (setq fields (cons "" fields))) | |
179 (setq text (nth 1 fields)) | |
180 (when text | |
181 (if (string= (nth 0 fields) "D") | |
182 (setq text (file-name-as-directory text))) | |
183 (setq entries (cons text entries)))) | |
184 (forward-line)))) | |
185 (setq pcomplete-stub nondir) | |
186 (pcomplete-uniqify-list entries))) | |
187 | |
52401 | 188 ;;; arch-tag: d2aeac43-4bf5-4509-a496-74b863c6642b |
29959 | 189 ;;; pcmpl-cvs.el ends here |