[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/server.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/server.el |
Date: |
Wed, 18 Sep 2002 08:19:58 -0400 |
Index: emacs/lisp/server.el
diff -c emacs/lisp/server.el:1.80 emacs/lisp/server.el:1.81
*** emacs/lisp/server.el:1.80 Tue Sep 17 22:10:18 2002
--- emacs/lisp/server.el Wed Sep 18 08:19:57 2002
***************
*** 147,156 ****
(setq minor-mode-alist (cons '(server-buffer-clients " Server")
minor-mode-alist)))
(defvar server-existing-buffer nil
! "Non-nil means a buffer existed before the Emacs server was asked visit it.
This means that the server should not kill the buffer when you say you
! are done with it in the server. This variable is local in each buffer
! where it is set.")
(make-variable-buffer-local 'server-existing-buffer)
;; If a *server* buffer exists,
--- 147,155 ----
(setq minor-mode-alist (cons '(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.
This means that the server should not kill the buffer when you say you
! are done with it in the server.")
(make-variable-buffer-local 'server-existing-buffer)
;; If a *server* buffer exists,
***************
*** 447,453 ****
(if (and (buffer-modified-p)
buffer-file-name
(y-or-n-p (concat "Save file " buffer-file-name "? ")))
! (save-buffer buffer)))
(server-buffer-done buffer)))))
;; Ask before killing a server buffer.
--- 446,452 ----
(if (and (buffer-modified-p)
buffer-file-name
(y-or-n-p (concat "Save file " buffer-file-name "? ")))
! (save-buffer)))
(server-buffer-done buffer)))))
;; Ask before killing a server buffer.
***************
*** 517,550 ****
;; if we have already killed one temp-file server buffer.
;; This means we should avoid the final "switch to some other buffer"
;; since we've already effectively done that.
! (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)))
! (select-window (frame-selected-window server-window))))
! (if (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 (get-window-with-predicate
! (lambda (w) (not (window-dedicated-p w)))
! 'nomini 'visible (selected-window))))
! (set-window-dedicated-p (selected-window) nil)
! (if next-buffer
! (if (and (bufferp next-buffer)
! (buffer-name next-buffer))
! (switch-to-buffer next-buffer)
! ;; If NEXT-BUFFER is a dead buffer,
! ;; remove the server records for it
;; and try the next surviving server buffer.
! (apply 'server-switch-buffer
! (server-buffer-done next-buffer)))
! (if server-clients
! (server-switch-buffer (nth 1 (car server-clients)) killed-one)
! (if (not killed-one)
! (switch-to-buffer (other-buffer))))))
(global-set-key "\C-x#" 'server-edit)
--- 516,557 ----
;; if we have already killed one temp-file server buffer.
;; This means we should avoid the final "switch to some other buffer"
;; since we've already effectively done that.
! (if (null next-buffer)
! (if server-clients
! (server-switch-buffer (nth 1 (car server-clients)) killed-one)
! (unless (or killed-one
! (window-dedicated-p (selected-window)))
! (switch-to-buffer (other-buffer))))
! (if (not (buffer-name next-buffer))
! ;; If NEXT-BUFFER is a dead buffer, remove the server records for it
;; and try the next surviving server buffer.
! (apply 'server-switch-buffer (server-buffer-done next-buffer))
! ;; OK, we know next-buffer is live, let's display and select it.
! (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))
! ;; 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)))
! (select-window (frame-selected-window server-window))))
! (if (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 (get-window-with-predicate
! (lambda (w) (not (window-dedicated-p w)))
! 'nomini 'visible (selected-window))))
! (set-window-dedicated-p (selected-window) nil)
! (switch-to-buffer next-buffer))))))
(global-set-key "\C-x#" 'server-edit)