Article View: gnu.emacs.bug
Article #927bug and fix in server.el
From: Loren James Rittle
Date: Wed, 06 Jan 1993 10:18
Date: Wed, 06 Jan 1993 10:18
91 lines
4222 bytes
4222 bytes
Dear GNU Emacs maintainer:
I have tracked down a bug in server.el (18.56 & 18.58 and most
likely, earlier releases as well).
The problem:
If two or more emacsclient's send in requests to server at about
the same time, it is possible that server.el will receive more
than one client's line of input at a time from server (IMHO from
looking at all the pieces, this can happen any time server.el
gets behind in processing requests from server). The process
filter in server.el didn't handle this case at all. The result
was a mess and a confused server.el.
I am so glad that I obtained all the source to the text editor I
use daily. I happily provide the source diff needed to fix this
problem.
Regards,
Loren J. Rittle
The bug fix diffs:
*** /usr/local/lib/emacs/lisp/server.el Mon Sep 2 19:28:21 1991
--- server.el Wed Jan 6 15:21:03 1993
***************
*** 2,6 ****
;; Copyright (C) 1986, 1987, 1990 Free Software Foundation, Inc.
;; Author William Sommerfeld, wesommer@athena.mit.edu.
! ;; Changes by peck@sun.com and by rms.
;; This file is part of GNU Emacs.
--- 2,6 ----
;; Copyright (C) 1986, 1987, 1990 Free Software Foundation, Inc.
;; Author William Sommerfeld, wesommer@athena.mit.edu.
! ;; Changes by peck@sun.com and by rms and by rittle@comm.mot.com.
;; This file is part of GNU Emacs.
***************
*** 133,143 ****
(server-log string)
(setq string (concat server-previous-string string))
! (if (not (and (eq ?\n (aref string (1- (length string))))
! (eq 0 (string-match "Client: " string))))
! ;; If input is not complete, save it for later.
(setq server-previous-string string)
! ;; If it is complete, process it now, and discard what was saved.
! (setq string (substring string (match-end 0)))
(setq server-previous-string "")
(let ((client (list (substring string 0 (string-match " " string))))
(files nil)
--- 133,145 ----
(server-log string)
(setq string (concat server-previous-string string))
! ;; Setup server-previous-string in case we fall through while loop.
(setq server-previous-string string)
! (while (eq 0 (string-match "Client: \\(.*\n\\)" string))
! ;; While a complete record is available:
! ;; process it, and discard it from the input string.
! (if (eq (length string) (1+ (match-end 0)))
(setq server-previous-string "")
+ (setq server-previous-string (substring string (match-end 0))))
+ (setq string (substring string (match-beginning 1) (match-end 1)))
(let ((client (list (substring string 0 (string-match " " string))))
(files nil)
***************
*** 157,163 ****
;; CLIENT is now a list (CLIENTNUM BUFFERS...)
(setq server-clients (cons client server-clients))
(switch-to-buffer (nth 1 client))
(message (substitute-command-keys
! "When done with a buffer, type \\[server-edit].")))))
(defun server-visit-files (files client)
--- 159,173 ----
;; CLIENT is now a list (CLIENTNUM BUFFERS...)
(setq server-clients (cons client server-clients))
+ ;; local addition to allow emacs to open a new window for our client,
+ ;; if needed. Considered to be needed, if name not *scratch*.
+ ;(if (not (string-equal "*scratch*" (buffer-name (window-buffer))))
+ ; (split-window-vertically))
(switch-to-buffer (nth 1 client))
(message (substitute-command-keys
! "When done with a buffer, type \\[server-edit]."))
! ;; local addition to allow emacs to pop to front when a client first
! ;; accesses it. NOTE: x-pop-window is a local addition to emacs.
! ;(x-pop-window)
! (setq string server-previous-string))))
(defun server-visit-files (files client)
Technical Details
Message-ID:
<9301062218.AA06220@supra.comm.mot.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!comm.mot.com!rittleShow Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!comm.mot.com!rittle From: rittle@comm.mot.com (Loren James Rittle) Subject: bug and fix in server.el Message-ID: <9301062218.AA06220@supra.comm.mot.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 6 Jan 1993 10:18:41 GMT Approved: bug-gnu-emacs@prep.ai.mit.edu Lines: 92