From a8b36b953e3dc4d50dbfe430d5c579f7b1fd71e7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 1 Oct 2014 18:13:11 -0400 Subject: Consolidate x-select-text. * lisp/frame.el (gui-method, gui-method-define, gui-method-declare) (gui-call): New macros. (gui-method--name): New function. (frame-creation-function-alist): Use gui-method-declare. (make-frame): Use gui-method. * lisp/select.el (gui-select-enable-clipboard): Rename from x-select-enable-clipboard and move here. (x-select-enable-clipboard): Define as obsolete alias. (gui-last-selected-text): New var, to replace x-last-selected-text. (gui-select-text): New GUI method. (gui-select-text): New function. (x-select-text): Define as obsolete alias. * lisp/term/common-win.el (x-select-enable-clipboard, x-select-text): Move to select.el. * lisp/simple.el (interprogram-cut-function): Change default to x-select-text. (interprogram-paste-function): Change default to `ignore'. * lisp/w32-common-fns.el (interprogram-cut-function): Don't modify. * lisp/term/x-win.el (interprogram-cut-function): Don't modify. (gui-select-text): Add method for x. * lisp/term/w32-win.el (gui-select-text): Add method for w32. * lisp/term/pc-win.el (x-last-selected-text): Remove, use gui-last-selected-text instead. (msdos-initialize-window-system): Don't set interprogram-cut-function. (gui-select-text): Add method for pc. * lisp/term/ns-win.el (ns-last-selected-text): Remove, use gui-last-selected-text instead. (gui-select-text): Add method for ns. (x-setup-function-keys): Don't change interprogram-cut-function. * lisp/loadup.el ("startup"): Load after "frame". * lisp/subr.el (package--builtin-versions, package--description-file): Move from startup.el. * lisp/startup.el (package--builtin-versions, package--description-file): Move to subr.el. (handle-args-function-alist, window-system-initialization-alist): Use gui-method-declare. (command-line): Use gui-method. * src/xselect.c (selection-converter-alist): Fix docstring. --- lisp/startup.el | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'lisp/startup.el') diff --git a/lisp/startup.el b/lisp/startup.el index c46200a050d..a0bcd1fcaba 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -421,21 +421,6 @@ Warning Warning!!! Pure space overflow !!!Warning Warning :type 'directory :initialize 'custom-initialize-delay) -(defvar package--builtin-versions - ;; Mostly populated by loaddefs.el via autoload-builtin-package-versions. - (purecopy `((emacs . ,(version-to-list emacs-version)))) - "Alist giving the version of each versioned builtin package. -I.e. each element of the list is of the form (NAME . VERSION) where -NAME is the package name as a symbol, and VERSION is its version -as a list.") - -(defun package--description-file (dir) - (concat (let ((subdir (file-name-nondirectory - (directory-file-name dir)))) - (if (string-match "\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)" subdir) - (match-string 1 subdir) subdir)) - "-pkg.el")) - (defun normal-top-level-add-subdirs-to-load-path () "Add all subdirectories of `default-directory' to `load-path'. More precisely, this uses only the subdirectories whose names @@ -719,17 +704,17 @@ It is the default value of the variable `top-level'." (defconst tool-bar-images-pixel-height 24 "Height in pixels of images in the tool-bar.") -(defvar handle-args-function-alist '((nil . tty-handle-args)) - "Functions for processing window-system dependent command-line arguments. +(gui-method-declare handle-args-function #'tty-handle-args + "Method for processing window-system dependent command-line arguments. Window system startup files should add their own function to this -alist, which should parse the command line arguments. Those +method, which should parse the command line arguments. Those pertaining to the window system should be processed and removed from the returned command line.") -(defvar window-system-initialization-alist '((nil . ignore)) - "Alist of window-system initialization functions. -Window-system startup files should add their own initialization -function to this list. The function should take no arguments, +(gui-method-declare window-system-initialization #'ignore + "Method for window-system initialization. +Window-system startup files should add their own implementation +to this method. The function should take no arguments, and initialize the window system environment to prepare for opening the first frame (e.g. open a connection to an X server).") @@ -965,8 +950,7 @@ please check its value") ;; Process window-system specific command line parameters. (setq command-line-args (funcall - (or (cdr (assq initial-window-system handle-args-function-alist)) - (error "Unsupported window system `%s'" initial-window-system)) + (gui-method handle-args-function (or initial-window-system t)) command-line-args)) ;; Initialize the window system. (Open connection, etc.) (funcall @@ -1311,9 +1295,10 @@ the `--debug-init' option to view a complete error backtrace." (format "Your `load-path' seems to contain your `.emacs.d' directory: %s\n\ This is likely to cause problems...\n\ -Consider using a subdirectory instead, e.g.: %s" dir -(expand-file-name "lisp" user-emacs-directory)) - :warning)))) +Consider using a subdirectory instead, e.g.: %s" + dir (expand-file-name + "lisp" user-emacs-directory)) + :warning)))) ;; If -batch, terminate after processing the command options. (if noninteractive (kill-emacs t)) -- cgit v1.2.1