changeset 83549:8d80de0a1ac6

Fix crash in window.c. * src/window.c (set_window_buffer): Don't call clear_mouse_face on tty frames. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-589
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 03 Dec 2006 15:12:18 +0000
parents c71725faff1a
children 17e0dd217877
files s.diff src/window.c
diffstat 2 files changed, 1 insertions(+), 185 deletions(-) [+]
line wrap: on
line diff
--- a/s.diff	Sun Dec 03 15:03:30 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
---- orig/lisp/server.el
-+++ mod/lisp/server.el
-@@ -83,18 +83,54 @@
-   "Emacs running as a server process."
-   :group 'external)
- 
-+(defcustom server-use-tcp nil
-+  "If non-nil, use TCP sockets instead of local sockets."
-+  :set #'(lambda (sym val)
-+           (unless (featurep 'make-network-process '(:family local))
-+             (setq val t)
-+             (unless load-in-progress
-+               (message "Local sockets unsupported, using TCP sockets")))
-+           (when val (random t))
-+           (set-default sym val))
-+  :group 'server
-+  :type 'boolean
-+  :version "22.1")
-+
-+(defcustom server-host nil
-+  "The name or IP address to use as host address of the server process.
-+If set, the server accepts remote connections; otherwise it is local."
-+  :group 'server
-+  :type '(choice
-+          (string :tag "Name or IP address")
-+          (const :tag "Local" nil))
-+  :version "22.1")
-+(put 'server-host 'risky-local-variable t)
-+
-+(defcustom server-auth-dir "~/.emacs.d/server/"
-+  "Directory for server authentication files."
-+  :group 'server
-+  :type 'directory
-+  :version "22.1")
-+(put 'server-auth-dir 'risky-local-variable t)
-+
-+(defcustom server-raise-frame t
-+  "If non-nil, raise frame when switching to a buffer."
-+  :group 'server
-+  :type 'boolean
-+  :version "22.1")
-+
- (defcustom server-visit-hook nil
--  "*Hook run when visiting a file for the Emacs server."
-+  "Hook run when visiting a file for the Emacs server."
-   :group 'server
-   :type 'hook)
- 
- (defcustom server-switch-hook nil
--  "*Hook run when switching to a buffer for the Emacs server."
-+  "Hook run when switching to a buffer for the Emacs server."
-   :group 'server
-   :type 'hook)
- 
- (defcustom server-done-hook nil
--  "*Hook run when done editing a buffer for the Emacs server."
-+  "Hook run when done editing a buffer for the Emacs server."
-   :group 'server
-   :type 'hook)
- 
-@@ -113,7 +149,7 @@
- (put 'server-buffer-clients 'permanent-local t)
- 
- (defcustom server-window nil
--  "*Specification of the window to use for selecting Emacs server buffers.
-+  "Specification of the window to use for selecting Emacs server buffers.
- If nil, use the selected window.
- If it is a function, it should take one argument (a buffer) and
- display and select it.  A common value is `pop-to-buffer'.
-@@ -132,14 +168,14 @@
- 		 (function :tag "Other function")))
- 
- (defcustom server-temp-file-regexp "^/tmp/Re\\|/draft$"
--  "*Regexp matching names of temporary files.
-+  "Regexp matching names of temporary files.
- These are deleted and reused after each edit by the programs that
- invoke the Emacs server."
-   :group 'server
-   :type 'regexp)
- 
- (defcustom server-kill-new-buffers t
--  "*Whether to kill buffers when done with them.
-+  "Whether to kill buffers when done with them.
- If non-nil, kill a buffer unless it already existed before editing
- it with Emacs server.  If nil, kill only buffers as specified by
- `server-temp-file-regexp'.
-@@ -151,7 +187,7 @@
-   :version "21.1")
- 
- (or (assq 'server-buffer-clients minor-mode-alist)
--    (setq minor-mode-alist (cons '(server-buffer-clients " Server") minor-mode-alist)))
-+    (push '(server-buffer-clients " Server") minor-mode-alist))
- 
- (defvar server-existing-buffer nil
-   "Non-nil means the buffer existed before the server was asked to visit it.
-@@ -390,11 +426,12 @@
-   (setq dir (directory-file-name dir))
-   (let ((attrs (file-attributes dir)))
-     (unless attrs
--      (letf (((default-file-modes) ?\700)) (make-directory dir))
-+      (letf (((default-file-modes) ?\700)) (make-directory dir t))
-       (setq attrs (file-attributes dir)))
-     ;; Check that it's safe for use.
-     (unless (and (eq t (car attrs)) (eq (nth 2 attrs) (user-uid))
--		 (zerop (logand ?\077 (file-modes dir))))
-+                 (or (eq system-type 'windows-nt)
-+                     (zerop (logand ?\077 (file-modes dir)))))
-       (error "The directory %s is unsafe" dir))))
- 
- ;;;###autoload
-@@ -966,10 +1003,10 @@
- 	(let ((version-control nil)
- 	      (buffer-backed-up nil))
- 	  (save-buffer))
--      (if (and (buffer-modified-p)
--	       buffer-file-name
--	       (y-or-n-p (concat "Save file " buffer-file-name "? ")))
--	  (save-buffer)))
-+      (when (and (buffer-modified-p)
-+		 buffer-file-name
-+		 (y-or-n-p (concat "Save file " buffer-file-name "? ")))
-+	(save-buffer)))
-     (server-buffer-done (current-buffer))))
- 
- ;; Ask before killing a server buffer.
-@@ -1027,12 +1064,12 @@
- starts server process and that is all.  Invoked by \\[server-edit]."
-   (interactive "P")
-   (cond
--   ((or arg
--	(not server-process)
--	(memq (process-status server-process) '(signal exit)))
--    (server-mode 1))
--   (server-clients (apply 'server-switch-buffer (server-done)))
--   (t (message "No server editing buffers exist"))))
-+    ((or arg
-+         (not server-process)
-+         (memq (process-status server-process) '(signal exit)))
-+     (server-mode 1))
-+    (server-clients (apply 'server-switch-buffer (server-done)))
-+    (t (message "No server editing buffers exist"))))
- 
- (defun server-switch-buffer (&optional next-buffer killed-one)
-   "Switch to another buffer, preferably one that has a client.
-@@ -1065,21 +1102,19 @@
- 	(let ((win (get-buffer-window next-buffer 0)))
- 	  (if (and win (not server-window))
- 	      ;; The buffer is already displayed: just reuse the window.
--	      (let ((frame (window-frame win)))
--		(if (eq (frame-visible-p frame) 'icon)
--		    (raise-frame frame))
--		(select-window win)
--		(set-buffer next-buffer))
-+              (progn
-+                (select-window win)
-+                (set-buffer next-buffer))
- 	    ;; Otherwise, let's find an appropriate window.
- 	    (cond ((and (windowp server-window)
- 			(window-live-p server-window))
- 		   (select-window server-window))
- 		  ((framep server-window)
--		   (if (not (frame-live-p server-window))
--		       (setq server-window (make-frame)))
-+		   (unless (frame-live-p server-window)
-+		     (setq server-window (make-frame)))
- 		   (select-window (frame-selected-window server-window))))
--	    (if (window-minibuffer-p (selected-window))
--		(select-window (next-window nil 'nomini 0)))
-+	    (when (window-minibuffer-p (selected-window))
-+	      (select-window (next-window nil 'nomini 0)))
- 	    ;; Move to a non-dedicated window, if we have one.
- 	    (when (window-dedicated-p (selected-window))
- 	      (select-window
-@@ -1093,7 +1128,9 @@
- 		(switch-to-buffer next-buffer)
- 	      ;; After all the above, we might still have ended up with
- 	      ;; a minibuffer/dedicated-window (if there's no other).
--	      (error (pop-to-buffer next-buffer)))))))))
-+	      (error (pop-to-buffer next-buffer)))))))
-+    (when server-raise-frame
-+      (select-frame-set-input-focus (window-frame (selected-window))))))
- 
- ;;;###autoload
- (defun server-save-buffers-kill-terminal (proc &optional arg)
--- a/src/window.c	Sun Dec 03 15:03:30 2006 +0000
+++ b/src/window.c	Sun Dec 03 15:12:18 2006 +0000
@@ -3353,7 +3353,7 @@
 
 #ifdef HAVE_WINDOW_SYSTEM
   BLOCK_INPUT;
-  if (f && FRAME_X_OUTPUT (f)
+  if (f && FRAME_WINDOW_P (f) && FRAME_X_OUTPUT (f)
       && (dpyinfo = FRAME_X_DISPLAY_INFO (f))
       && EQ (window, dpyinfo->mouse_face_window))
     clear_mouse_face (dpyinfo);