* src/eval.c (Fbind_symbol): New function.
[bpt/emacs.git] / lisp / server.el
index 64224d2..681d93d 100644 (file)
@@ -1,10 +1,10 @@
 ;;; server.el --- Lisp code for GNU Emacs running as server process -*- lexical-binding: t -*-
 
-;; Copyright (C) 1986-1987, 1992, 1994-2013 Free Software Foundation,
+;; Copyright (C) 1986-1987, 1992, 1994-2014 Free Software Foundation,
 ;; Inc.
 
 ;; Author: William Sommerfeld <wesommer@athena.mit.edu>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: processes
 
 ;; Changes by peck@sun.com and by rms.
   "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.
 
-DO NOT give this a non-nil value unless you know what you are
-doing!  On unsecured networks, accepting remote connections is
-very dangerous, because server-client communication (including
-session authentication) is not encrypted."
+DO NOT give this a non-nil value unless you know what you are doing!
+On unsecured networks, accepting remote connections is very dangerous,
+because server-client communication (including session authentication)
+is not encrypted."
   :group 'server
   :type '(choice
           (string :tag "Name or IP address")
@@ -154,7 +154,7 @@ long-lived shared key will decrease security (especially since
 the key is transmitted as plain-text).
 
 In some situations however, it can be difficult to share randomly
-generated passwords with remote hosts (eg. no shared directory),
+generated passwords with remote hosts (e.g., no shared directory),
 so you can set the key with this variable and then copy the
 server file to the remote host (with possible changes to IP
 address and/or port if that applies).
@@ -642,8 +642,6 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
        (cl-letf (((default-file-modes) ?\700))
          (add-hook 'suspend-tty-functions 'server-handle-suspend-tty)
          (add-hook 'delete-frame-functions 'server-handle-delete-frame)
-         (add-hook 'kill-buffer-query-functions
-                    'server-kill-buffer-query-function)
          (add-hook 'kill-emacs-query-functions
                     'server-kill-emacs-query-function)
          (add-hook 'kill-emacs-hook 'server-force-stop) ;Cleanup upon exit.
@@ -1472,22 +1470,6 @@ specifically for the clients and did not exist before their request for it."
        (save-buffer)))
     (server-buffer-done (current-buffer))))
 
-;; Ask before killing a server buffer.
-;; It was suggested to release its client instead,
-;; but I think that is dangerous--the client would proceed
-;; using whatever is on disk in that file. -- rms.
-(defun server-kill-buffer-query-function ()
-  "Ask before killing a server buffer."
-  (or (not server-buffer-clients)
-      (let ((res t))
-       (dolist (proc server-buffer-clients)
-          (when (and (memq proc server-clients)
-                     (eq (process-status proc) 'open))
-            (setq res nil)))
-         res)
-      (yes-or-no-p (format "Buffer `%s' still has clients; kill it? "
-                          (buffer-name (current-buffer))))))
-
 (defun server-kill-emacs-query-function ()
   "Ask before exiting Emacs if it has live clients."
   (or (not server-clients)
@@ -1557,7 +1539,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
                (setq next-buffer (car (process-get proc 'buffers))))
              (setq rest (cdr rest)))))
        (and next-buffer (server-switch-buffer next-buffer killed-one))
-       (unless (or next-buffer killed-one (window-dedicated-p (selected-window)))
+       (unless (or next-buffer killed-one (window-dedicated-p))
          ;; (switch-to-buffer (other-buffer))
          (message "No server buffers remain to edit")))
     (if (not (buffer-live-p next-buffer))
@@ -1584,16 +1566,16 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
                   (unless (frame-live-p server-window)
                     (setq server-window (make-frame)))
                   (select-window (frame-selected-window server-window))))
-           (when (window-minibuffer-p (selected-window))
+           (when (window-minibuffer-p)
              (select-window (next-window nil 'nomini 0)))
            ;; Move to a non-dedicated window, if we have one.
-           (when (window-dedicated-p (selected-window))
+           (when (window-dedicated-p)
              (select-window
               (get-window-with-predicate
                (lambda (w)
                  (and (not (window-dedicated-p w))
                       (equal (frame-terminal (window-frame w))
-                             (frame-terminal (selected-frame)))))
+                             (frame-terminal))))
                'nomini 'visible (selected-window))))
            (condition-case nil
                (switch-to-buffer next-buffer)
@@ -1601,7 +1583,7 @@ be a cons cell (LINENUMBER . COLUMNNUMBER)."
              ;; a minibuffer/dedicated-window (if there's no other).
              (error (pop-to-buffer next-buffer)))))))
     (when server-raise-frame
-      (select-frame-set-input-focus (window-frame (selected-window))))))
+      (select-frame-set-input-focus (window-frame)))))
 
 ;;;###autoload
 (defun server-save-buffers-kill-terminal (arg)
@@ -1611,7 +1593,7 @@ With ARG non-nil, silently save all file-visiting buffers, then kill.
 
 If emacsclient was started with a list of filenames to edit, then
 only these files will be asked to be saved."
-  (let ((proc (frame-parameter (selected-frame) 'client)))
+  (let ((proc (frame-parameter nil 'client)))
     (cond ((eq proc 'nowait)
           ;; Nowait frames have no client buffer list.
           (if (cdr (frame-list))
@@ -1634,7 +1616,7 @@ only these files will be asked to be saved."
 (define-key ctl-x-map "#" 'server-edit)
 
 (defun server-unload-function ()
-  "Unload the server library."
+  "Unload the Server library."
   (server-mode -1)
   (substitute-key-definition 'server-edit nil ctl-x-map)
   (save-current-buffer
@@ -1648,7 +1630,7 @@ only these files will be asked to be saved."
   "Contact the Emacs server named SERVER and evaluate FORM there.
 Returns the result of the evaluation, or signals an error if it
 cannot contact the specified server.  For example:
-  \(server-eval-at \"server\" '(emacs-pid))
+  (server-eval-at \"server\" '(emacs-pid))
 returns the process ID of the Emacs instance running \"server\"."
   (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir))
         (server-file (expand-file-name server server-dir))