comparison lisp/packages/gnuserv.el @ 30:ec9a17fef872 r19-15b98

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