Mercurial > hg > xemacs-beta
comparison lisp/gnuserv.el @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 727739f917cb |
children | 6330739388db |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | 19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 ;; General Public License for more details. | 21 ;; General Public License for more details. |
22 | 22 |
23 ;; You should have received a copy of the GNU General Public License | 23 ;; You should have received a copy of the GNU General Public License |
24 ;; along with XEmacs; see the file COPYING. If not, write to the | 24 ;; along with XEmacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, 59 Temple Place - Suite 330, | 25 ;; Free Software Foundation, 59 Temple Place - Suite 330, |
26 ;; Boston, MA 02111-1307, USA. | 26 ;; Boston, MA 02111-1307, USA. |
27 | 27 |
28 ;;; Synched up with: Not in FSF. | 28 ;;; Synched up with: Not in FSF. |
29 | 29 |
30 ;;; Commentary: | 30 ;;; Commentary: |
31 | 31 |
32 ;; Gnuserv is run when Emacs needs to operate as a server for other | 32 ;; Gnuserv is run when Emacs needs to operate as a server for other |
33 ;; processes. Specifically, any number of files can be attached for | 33 ;; processes. Specifically, any number of files can be attached for |
34 ;; editing to a running XEmacs process using the `gnuclient' program. | 34 ;; editing to a running XEmacs process using the `gnuclient' program. |
35 | 35 |
36 ;; Use `M-x gnuserv-start' to start the server and `gnuclient files' | 36 ;; Use `M-x gnuserv-start' to start the server and `gnuclient files' |
139 "*Plist of frame properties for creating a gnuserv frame." | 139 "*Plist of frame properties for creating a gnuserv frame." |
140 :type 'plist | 140 :type 'plist |
141 :group 'gnuserv | 141 :group 'gnuserv |
142 :group 'frames) | 142 :group 'frames) |
143 | 143 |
144 (defcustom gnuserv-done-function 'kill-buffer | 144 (defcustom gnuserv-done-function 'kill-buffer |
145 "*Function used to remove a buffer after editing. | 145 "*Function used to remove a buffer after editing. |
146 It is called with one BUFFER argument. Functions such as `kill-buffer' and | 146 It is called with one BUFFER argument. Functions such as `kill-buffer' and |
147 `bury-buffer' are good values. See also `gnuserv-done-temp-file-function'." | 147 `bury-buffer' are good values. See also `gnuserv-done-temp-file-function'." |
148 :type '(radio (function-item kill-buffer) | 148 :type '(radio (function-item kill-buffer) |
149 (function-item bury-buffer) | 149 (function-item bury-buffer) |
237 (id nil) | 237 (id nil) |
238 (buffers nil) | 238 (buffers nil) |
239 (device nil) | 239 (device nil) |
240 (frame nil)) | 240 (frame nil)) |
241 | 241 |
242 (defvar gnuserv-process nil | 242 (defvar gnuserv-process nil |
243 "The current gnuserv process.") | 243 "The current gnuserv process.") |
244 | 244 |
245 (defvar gnuserv-string "" | 245 (defvar gnuserv-string "" |
246 "The last input string from the server.") | 246 "The last input string from the server.") |
247 | 247 |
267 | 267 |
268 | 268 |
269 ;; Sample gnuserv-frame functions | 269 ;; Sample gnuserv-frame functions |
270 | 270 |
271 (defun gnuserv-main-frame-function (type) | 271 (defun gnuserv-main-frame-function (type) |
272 "Returns a sensible value for the main Emacs frame." | 272 "Return a sensible value for the main Emacs frame." |
273 (if (eq type 'x) | 273 (if (eq type 'x) |
274 (car (frame-list)) | 274 (car (frame-list)) |
275 nil)) | 275 nil)) |
276 | 276 |
277 (defun gnuserv-visible-frame-function (type) | 277 (defun gnuserv-visible-frame-function (type) |
278 "Returns a frame if there is a frame that is truly visible, nil otherwise. | 278 "Return a frame if there is a frame that is truly visible, nil otherwise. |
279 This is meant in the X sense, so it will not return frames that are on another | 279 This is meant in the X sense, so it will not return frames that are on another |
280 visual screen. Totally visible frames are preferred. If none found, return nil." | 280 visual screen. Totally visible frames are preferred. If none found, return nil." |
281 (if (eq type 'x) | 281 (if (eq type 'x) |
282 (cond ((car (filtered-frame-list 'frame-totally-visible-p | 282 (cond ((car (filtered-frame-list 'frame-totally-visible-p |
283 (selected-device)))) | 283 (selected-device)))) |
286 (eq t (frame-visible-p frame))) | 286 (eq t (frame-visible-p frame))) |
287 (selected-device))))) | 287 (selected-device))))) |
288 nil)) | 288 nil)) |
289 | 289 |
290 (defun gnuserv-special-frame-function (type) | 290 (defun gnuserv-special-frame-function (type) |
291 "Creates a special frame for Gnuserv and returns it on later invocations." | 291 "Create a special frame for Gnuserv and return it on later invocations." |
292 (unless (frame-live-p gnuserv-special-frame) | 292 (unless (frame-live-p gnuserv-special-frame) |
293 (setq gnuserv-special-frame (make-frame gnuserv-frame-plist))) | 293 (setq gnuserv-special-frame (make-frame gnuserv-frame-plist))) |
294 gnuserv-special-frame) | 294 gnuserv-special-frame) |
295 | 295 |
296 | 296 |
497 | 497 |
498 ;; A helper function; used by others. Try avoiding it whenever | 498 ;; A helper function; used by others. Try avoiding it whenever |
499 ;; possible, because it is slow, and conses a list. Use | 499 ;; possible, because it is slow, and conses a list. Use |
500 ;; `gnuserv-buffer-p' when appropriate, for instance. | 500 ;; `gnuserv-buffer-p' when appropriate, for instance. |
501 (defun gnuserv-buffer-clients (buffer) | 501 (defun gnuserv-buffer-clients (buffer) |
502 "Returns a list of clients to which BUFFER belongs." | 502 "Return a list of clients to which BUFFER belongs." |
503 (let (res) | 503 (let (res) |
504 (dolist (client gnuserv-clients) | 504 (dolist (client gnuserv-clients) |
505 (when (memq buffer (gnuclient-buffers client)) | 505 (when (memq buffer (gnuclient-buffers client)) |
506 (push client res))) | 506 (push client res))) |
507 res)) | 507 res)) |
726 | 726 |
727 ;;;###autoload | 727 ;;;###autoload |
728 (defun gnuserv-start (&optional leave-dead) | 728 (defun gnuserv-start (&optional leave-dead) |
729 "Allow this Emacs process to be a server for client processes. | 729 "Allow this Emacs process to be a server for client processes. |
730 This starts a gnuserv communications subprocess through which | 730 This starts a gnuserv communications subprocess through which |
731 client \"editors\" (gnuclient and gnudoit) can send editing commands to | 731 client \"editors\" (gnuclient and gnudoit) can send editing commands to |
732 this Emacs job. See the gnuserv(1) manual page for more details. | 732 this Emacs job. See the gnuserv(1) manual page for more details. |
733 | 733 |
734 Prefix arg means just kill any existing server communications subprocess." | 734 Prefix arg means just kill any existing server communications subprocess." |
735 (interactive "P") | 735 (interactive "P") |
736 (and gnuserv-process | 736 (and gnuserv-process |