comparison lisp/packages/gnuserv.el @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents c7528f8e288d
children 8619ce7e4c50
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
239 ((fboundp 'x-remap-window) 239 ((fboundp 'x-remap-window)
240 (x-remap-window) 240 (x-remap-window)
241 ;; give window chance to re-display text 241 ;; give window chance to re-display text
242 (accept-process-output)))) 242 (accept-process-output))))
243 243
244 (defun server-tty-find-file (tty termtype file) 244 (defun server-tty-find-file (tty termtype pid file)
245 (let ((device (make-tty-device tty termtype))) 245 (let ((device (make-tty-device tty termtype pid )))
246 (select-frame (make-frame nil device)) 246 (select-frame (make-frame nil device))
247 (if (not file) 247 (if (not file)
248 (switch-to-buffer (get-buffer-create "*scratch*")) 248 (switch-to-buffer (get-buffer-create "*scratch*"))
249 (find-file file)))) 249 (find-file file))))
250 250
342 (message (substitute-command-keys 342 (message (substitute-command-keys
343 (if (and (boundp 'infodock-version) window-system) 343 (if (and (boundp 'infodock-version) window-system)
344 "Type {\\[server-edit]} or select Frame/Delete to finish edit." 344 "Type {\\[server-edit]} or select Frame/Delete to finish edit."
345 "When done with a buffer, type \\[server-edit].")))) 345 "When done with a buffer, type \\[server-edit]."))))
346 346
347 (defun server-tty-edit-files (tty termtype list) 347 (defun server-tty-edit-files (tty termtype pid list)
348 "For each (line-number . file) pair in LIST, edit the file at line-number. 348 "For each (line-number . file) pair in LIST, edit the file at line-number.
349 Save enough information for (server-kill-buffer) to inform the client when 349 Save enough information for (server-kill-buffer) to inform the client when
350 the edit is finished." 350 the edit is finished."
351 (or list (setq list '((1 . nil)))) 351 (or list (setq list '((1 . nil))))
352 (while list 352 (while list
353 (let ((line (car (car list))) 353 (let ((line (car (car list)))
354 (path (cdr (car list)))) 354 (path (cdr (car list))))
355 (server-tty-find-file tty termtype path) 355 (server-tty-find-file tty termtype pid path)
356 (server-make-window-visible) 356 (server-make-window-visible)
357 (let ((old-clients (assq current-client server-clients)) 357 (let ((old-clients (assq current-client server-clients))
358 (buffer (current-buffer))) 358 (buffer (current-buffer)))
359 (goto-line line) 359 (goto-line line)
360 (setq server-buffer-clients 360 (setq server-buffer-clients
447 (delq buffer client) 447 (delq buffer client)
448 ;; If client now has no pending buffers, 448 ;; If client now has no pending buffers,
449 ;; tell it that it is done, and forget it entirely. 449 ;; tell it that it is done, and forget it entirely.
450 (if (cdr client) 450 (if (cdr client)
451 nil 451 nil
452 (server-write-to-client (car client) nil) 452 (if (buffer-name buffer)
453 (setq server-clients (delq client server-clients)))) 453 (save-excursion
454 (set-buffer buffer)
455 (setq server-buffer-clients nil)))
456 ; Order is important here --
457 ; server-kill-buffer tries to notify clients that
458 ; they are done, too, but if we try and notify twice,
459 ; we are h0zed -- Hunter Kelly 3/3/97
460 (setq server-clients (delq client server-clients))
461 (funcall server-done-function buffer)
462 (server-write-to-client (car client) nil)))
454 (setq old-clients (cdr old-clients))) 463 (setq old-clients (cdr old-clients)))
455 (if (buffer-name buffer)
456 (save-excursion
457 (set-buffer buffer)
458 (setq server-buffer-clients nil)))
459 (funcall server-done-function buffer)
460 next-buffer)) 464 next-buffer))
461 465
462 466
463 (defun mh-draft-p (buffer) 467 (defun mh-draft-p (buffer)
464 "Return non-nil if this BUFFER is an mh <draft> file. Since MH deletes 468 "Return non-nil if this BUFFER is an mh <draft> file. Since MH deletes