;ELC ;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:51:58 2003 ;;; from file /home/pot/gnu/emacs-pretest.new/lisp/server.el ;;; in Emacs version 21.3 ;;; with bytecomp version 2.85.4.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`server.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-declare-group 'server nil "Emacs running as a server process." :group 'external) #@41 *The program to use as the edit server. (custom-declare-variable 'server-program '(expand-file-name "emacsserver" exec-directory) '(#$ . -703) :group 'server :type 'string) #@67 *List of hooks to call when visiting a file for the Emacs server. (custom-declare-variable 'server-visit-hook 'nil '(#$ . -882) :group 'server :type '(repeat function)) #@73 *List of hooks to call when switching to a buffer for the Emacs server. (custom-declare-variable 'server-switch-hook 'nil '(#$ . -1057) :group 'server :type '(repeat function)) #@73 *List of hooks to call when done editing a buffer for the Emacs server. (custom-declare-variable 'server-done-hook 'nil '(#$ . -1240) :group 'server :type '(repeat function)) #@28 The current server process (defvar server-process nil (#$ . 1421)) (byte-code "\301B\302\301!\204\f\303\301\207" [current-load-list server-previous-string boundp ""] 2) #@225 List of current server clients. Each element is (CLIENTID BUFFERS...) where CLIENTID is a string that can be given to the server process to identify a client. When a buffer is marked as "done", it is removed from this list. (defvar server-clients nil (#$ . 1601)) #@70 List of client ids for clients requesting editing of current buffer. (defvar server-buffer-clients nil (#$ . 1871)) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local server-buffer-clients put permanent-local t] 4) #@140 *The window to use for selecting Emacs server buffers. If nil, use the selected window. If it is a frame, use the frame's selected window. (defvar server-window nil (#$ . -2118)) #@148 *Regexp which should match filenames of temporary files which are deleted and reused after each edit by the programs that invoke the Emacs server. (custom-declare-variable 'server-temp-file-regexp '"^/tmp/Re\\|/draft$" '(#$ . -2304) :group 'server :type 'regexp) #@353 *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'. Please note that only buffers are killed that still have a client, i.e. buffers visited which "emacsclient --no-wait" are never killed in this way. (custom-declare-variable 'server-kill-new-buffers 't '(#$ . -2574) :group 'server :type 'boolean :version "21.1") (byte-code "\301\236\204\n\302B\301\207" [minor-mode-alist server-buffer-clients (server-buffer-clients " Server")] 2) #@63 Non-nil means a server buffer existed before visiting a file. (defvar server-existing-buffer nil (#$ . 3169)) (make-variable-buffer-local 'server-existing-buffer) (defalias 'server-log #[(string) "\301\302!\205\212\302q\210db\210\303 \304\261\210n\206\305 )\207" [string get-buffer "*server*" current-time-string " " newline] 3]) (defalias 'server-sentinel #[(proc msg) "\301!\302=\203\303\304\305!!\207\301!\306=\205\303\304\307!!\207" [proc process-status exit server-log message "Server subprocess exited" signal "Server subprocess killed"] 3]) #@371 Allow this Emacs process to be a server for client processes. This starts a server communications subprocess through which client "editors" can send your editing commands to this Emacs job. To use the server, set up the program `emacsclient' in the Emacs distribution as your standard "editor". Prefix arg means just kill any existing server communications subprocess. (defalias 'server-start #[(&optional leave-dead) "\203\306\307\"\210\307\310\311\217\210\312 \313\314 \"\307\315\316\217\210\307\317\320\217\210\n\2034 \321\nO\307\322\323\217\210\307\324\325\217\210)*\f\203F\f@A@\326 !\210)\2025\"?\205t\203V\327\330\331!!\210\307#\332\333\307$#)\306\334\"\210\335\336\"\210\337\340\211#\210\341!\207" [server-process sysname dot-index shortname server-clients buffer set-process-sentinel nil (delete-process server-process) ((error)) system-name string-match "\\." (byte-code "\301\302\303\"!\207" [sysname delete-file format "~/.emacs-server-%s"] 4) ((error)) (byte-code "\301\302\303\304 #!\207" [sysname delete-file format "/tmp/esrv%d-%s" user-uid] 5) ((error)) 0 (byte-code "\301\302\303\"!\207" [shortname delete-file format "~/.emacs-server-%s"] 4) ((error)) (byte-code "\301\302\303\304 #!\207" [shortname delete-file format "/tmp/esrv%d-%s" user-uid] 5) ((error)) server-buffer-done server-log message "Restarting server" start-process "server" server-sentinel set-process-filter server-process-filter set-process-coding-system raw-text process-kill-without-query leave-dead process-connection-type server-program] 4 (#$ . 3736) "P"]) (defalias 'server-process-filter #[(proc string) "\306!\210 P\307\310\"\203\311\211\224O\n\205 \206\f\312\211\211\313\311+,-./0\311\225\312O\307\3140\"\203J\315\3160\311\225\312O\"\210\202z\307\3170\"\203z0\311\225\312O\2110\311\307\3200\"OC.0\311\225\312O0\307\3210\"\20370\311\224\311\225SO\311120\311\225\312O0\307\3222\"\203\230\323-\2023\307\3242\"\203\254\3252\313\312O!+\2023\307\3262\"\203\310\325\327\3132\"!+\325\327\3302\"!\2023\3312!2\307\33221#\203\311\224T121H\2113\333U\203\366\334\335\323\2112$2\2023\336U\203 \334\337\323\2112$2\202\334\320\323\2112$2)\202\316/\203#\3402/\"22+ E,B,\313+\311*\202m\341,.-#\210.A\204]\3424\343\344.@\"\"\210\306\343\345.@\"!\210\202z-\204i.5B5\346.A@!\210\347\350!\210\315\351\352!!\210.\202\211\207" [string server-previous-string default-enable-multibyte-characters file-name-coding-system default-file-name-coding-system columnno server-log string-match "\n" 0 nil 1 "^Error: " message "Server error: %s" "^Client: " " " "[^ ]+ " "\\`-nowait" t "\\`\\+[0-9]+\\'" string-to-int "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" match-string 2 command-line-normalize-file-name "&." 38 replace-match "&" 45 "-" decode-coding-string server-visit-files send-string format "Close: %s Done\n" "Close empty client: %s Done\n" server-switch-buffer run-hooks server-switch-hook substitute-command-keys "When done with a buffer, type \\[server-edit]" lineno files nowait client coding-system request pos arg nextchar server-process server-clients] 8]) #@270 Finds FILES and returns the list CLIENT with the buffers nconc'd. FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER). NOWAIT non-nil means this client is not waiting for the results, so don't mark these buffers specially, just visit them normally. (defalias 'server-visit-files #[(files client &optional nowait) "\306\307p\310\216 \203\221 @@\311\f!\f B\203Uq\203U\312\f!\203;\313!\2033\314!\203H\315\307\306\"\210\202H\316\317\f\320Q!\203H\321\f!\210\307\322 @A@!\210\202x\323\f!q\210\322 @A@!\210\324 @8\211\325V\203s\326S!\210)\327\330!\210*\204\206@Bp\nB A\211\204\f)\n\244+\207" [obuf last-nonmenu-event client-record files filen file-name-history nil t ((set-buffer obuf)) get-file-buffer file-exists-p verify-visited-file-modtime buffer-modified-p revert-buffer y-or-n-p "File no longer exists: " ", write buffer to file? " write-file goto-line find-file-noselect 2 0 move-to-column run-hooks server-visit-hook server-existing-buffer column-number nowait client server-buffer-clients] 5 (#$ . 6907)]) #@290 Mark BUFFER as "done" for its client(s). This buries the buffer, then returns a list of the form (NEXT-BUFFER KILLED). NEXT-BUFFER is another server buffer, as a suggestion for what to select next, or nil. KILLED is t if we killed BUFFER (typically, because it was visiting a temp file). (defalias 'server-buffer-done #[(buffer &optional for-killing) "\306!\307=\310\211\311 \n\203\212\n@ \204#>A@\312\"\210\211\203S\313@!\203J\314@!\204J\312@\"\210A\211\2042)A\204\202\203| \204g\315\316!\210\310\317\320\321@\"\"\210\322\320\321@\"!\210\312 \")\nA\211\204\313!\203\364\314!\203\364\311\212q\210\310\323\324!\210)\314!\204\264\311\202\363\204\363\f\204\331\203\331rq\210 )\204\331\311\325!\210\326!\210\f\204\363\327!\203\356\326!\210\311\202\363\325!\210) \f-D\207" [server-process server-clients old-clients first killed next-buffer process-status run nil t delq bufferp buffer-name sit-for 1 send-string format "Close: %s Done\n" server-log run-hooks server-done-hook bury-buffer kill-buffer server-temp-file-p running client buffer tail server-kill-buffer-running server-buffer-clients for-killing server-kill-new-buffers server-existing-buffer] 6 (#$ . 7983)]) #@258 Return non-nil if BUFFER contains a file considered temporary. These are files whose names suggest they are repeatedly reused to pass information to another program. The variable `server-temp-file-regexp' controls which filenames are considered temporary. (defalias 'server-temp-file-p #[(buffer) "\302!\205\f\303 \302!\"\207" [buffer server-temp-file-regexp buffer-file-name string-match] 4 (#$ . 9260)]) #@310 Offer to save current buffer, mark it as "done" for clients. This buries the buffer, then returns a list of the form (NEXT-BUFFER KILLED). NEXT-BUFFER is another server buffer, as a suggestion for what to select next, or nil. KILLED is t if we killed BUFFER (typically, because it was visiting a temp file). (defalias 'server-done #[nil "p \2050\305!\203\306\211\307 \210*\202-\310 \203-\f\203-\311\312\f\313Q!\203-\307!\210\314!)\207" [buffer server-buffer-clients buffer-backed-up version-control buffer-file-name server-temp-file-p nil save-buffer buffer-modified-p y-or-n-p "Save file " "? " server-buffer-done] 4 (#$ . 9677)]) (defalias 'server-kill-buffer-query-function #[nil "?\206 \301\302\303\304p!\"!\207" [server-buffer-clients yes-or-no-p format "Buffer `%s' still has clients; kill it? " buffer-name] 5]) (add-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function) (defalias 'server-kill-emacs-query-function #[nil "\303 \203\304\305\306\305\307 @A\"\">\203\304 A\211\204\n?\206'\310\311!*\207" [server-clients tail live-client nil t mapcar stringp buffer-name yes-or-no-p "Server buffers still have clients; exit anyway? "] 7]) (add-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function) #@72 Non-nil while `server-kill-buffer' or `server-buffer-done' is running. (defvar server-kill-buffer-running nil (#$ . 10942)) (add-hook 'kill-buffer-hook 'server-kill-buffer) (defalias 'server-kill-buffer #[nil "\206 \205\303\n\205\304p\303\")\207" [server-kill-buffer-running server-buffer-clients server-process t server-buffer-done] 3]) #@695 Switch to next server editing buffer; say "Done" for current buffer. If a server buffer is current, it is marked "done" and optionally saved. When all of a client's buffers are marked as "done", the client is notified. Temporary files such as MH files are always saved and backed up, no questions asked. (The variable `make-backup-files', if nil, still inhibits a backup; you can set it locally in a particular buffer to prevent a backup for it.) The variable `server-temp-file-regexp' controls which filenames are considered temporary. If invoked with a prefix argument, or if there is no server process running, starts server process and that is all. Invoked by \[server-edit]. (defalias 'server-edit #[(&optional arg) "\204 \203\302 !\303>\203\304\305!\207\306\307\310 \"\207" [arg server-process process-status (signal exit) server-start nil apply server-switch-buffer server-done] 3 (#$ . 11295) "P"]) #@126 Switch to another buffer, preferably one that has a client. Arg NEXT-BUFFER is a suggestion; if it is a live buffer, use it. (defalias 'server-switch-buffer #[(&optional next-buffer killed-one) "\304!\203\305!\203\306!\210\202(\307!\203(\310!\204\"\311 \306\312!!\210\313\314 !\2037\306\315\316\317\320#!\210\321\314 !\203H\306\322\323\317\324\314 $!\210\325\314 \316\"\210 \203i\326 !\203b\327 !\203b\330 !\207\331\332\333 !\"\207\n\203u\332\n@A@ \"\207 ?\205~\330\334 !\207" [server-window next-buffer server-clients killed-one windowp window-live-p select-window framep frame-live-p make-frame frame-selected-window window-minibuffer-p selected-window next-window nil nomini 0 window-dedicated-p get-window-with-predicate #[(w) "\301!?\207" [w window-dedicated-p] 2] visible set-window-dedicated-p bufferp buffer-name switch-to-buffer apply server-switch-buffer server-buffer-done other-buffer] 6 (#$ . 12230)]) (byte-code "\300\301\302\"\210\303\304!\207" [global-set-key "#" server-edit provide server] 3)