diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-05-23 11:32:29 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-05-23 11:32:29 -0400 |
commit | 919281ddb2eec5b5503c246dfad902d44aa25644 (patch) | |
tree | 1204a207b7d24c596caed1beeda629c27ba2f90d /lisp/select.el | |
parent | dc4484ec6de13a3d75b52c477a3cde59dc8ed46c (diff) | |
download | emacs-919281ddb2eec5b5503c246dfad902d44aa25644.tar.gz |
Replace gui-method macros with cl-generic with &context
* lisp/frame.el (gui-method--name, gui-method, gui-method-define)
(gui-method-declare, gui-call): Remove.
(frame-creation-function): Use cl-defgeneric.
(make-frame): Adjust callers.
* lisp/menu-bar.el (menu-bar-edit-menu):
Use gui-backend-selection-exists-p.
* lisp/select.el (x-get-clipboard): Use gui-backend-get-selection.
(gui-backend-get-selection): New cl-generic to replace
gui-get-selection method.
(gui-backend-set-selection): New cl-generic to replace
gui-set-selection method.
(gui-selection-owner-p): New cl-generic to replace
gui-selection-owner-p method.
(gui-backend-selection-exists-p): New cl-generic to replace
gui-selection-exists-p method. Adjust all callers.
* lisp/server.el (server-create-window-system-frame): Don't ignore
window-system spec even when unsupported.
* lisp/simple.el (deactivate-mark): Use new gui-backend-* functions.
* lisp/startup.el (handle-args-function, window-system-initialization):
Use cl-defgeneric.
(command-line): Adjust calls accordingly.
* lisp/term/ns-win.el (ns-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/pc-win.el (w16-get-selection-value): Turn into
a gui-backend-get-selection method.
(gui-selection-exists-p, gui-selection-owner-p, gui-set-selection):
Use cl-defmethod on the new functions instead.
(msdos-window-system-initialization): Turn into
a window-system-initialization method.
(frame-creation-function, handle-args-function): Use cl-defmethod.
* lisp/term/w32-win.el (w32-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/x-win.el (x-window-system-initialization): Turn into
a window-system-initialization method.
(handle-args-function, frame-creation-function): Use cl-defmethod.
(gui-set-selection, gui-selection-owner-p, gui-selection-exists-p)
(gui-get-selection): Use cl-defmethod on the new functions instead.
* lisp/term/xterm.el (xterm--set-selection): Turn into
a gui-backend-set-selection method.
* src/nsselect.m (Fns_selection_exists_p): Remove unused arg `terminal'.
(Fns_selection_owner_p): Remove unused arg `terminal'.
(Fns_get_selection): Remove unused args `time_stamp' and `terminal'.
Diffstat (limited to 'lisp/select.el')
-rw-r--r-- | lisp/select.el | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lisp/select.el b/lisp/select.el index f68d3d6c47b..74b48d1d812 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -231,7 +231,7 @@ The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)." (defun x-get-clipboard () "Return text pasted to the clipboard." (declare (obsolete gui-get-selection "25.1")) - (gui-call gui-get-selection 'CLIPBOARD 'STRING)) + (gui-backend-get-selection 'CLIPBOARD 'STRING)) (defun gui-get-primary-selection () "Return the PRIMARY selection, or the best emulation thereof." @@ -248,37 +248,36 @@ The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING)." ;;; Lower-level, backend dependent selection handling. -(gui-method-declare gui-get-selection #'ignore +(cl-defgeneric gui-backend-get-selection (_selection-symbol _target-type) "Return selected text. -Called with 2 arguments: (SELECTION-SYMBOL TARGET-TYPE) SELECTION-SYMBOL is typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. \(Those are literal upper-case symbol names, since that's what X expects.) -TARGET-TYPE is the type of data desired, typically `STRING'.") +TARGET-TYPE is the type of data desired, typically `STRING'." + nil) -(gui-method-declare gui-set-selection #'ignore +(cl-defgeneric gui-backend-set-selection (_selection _value) "Method to assert a selection of type SELECTION and value VALUE. SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. If VALUE is nil and we own the selection SELECTION, disown it instead. Disowning it means there is no such selection. \(Those are literal upper-case symbol names, since that's what X expects.) VALUE is typically a string, or a cons of two markers, but may be -anything that the functions on `selection-converter-alist' know about. +anything that the functions on `selection-converter-alist' know about." + nil) -Called with 2 args: (SELECTION VALUE).") - -(gui-method-declare gui-selection-owner-p #'ignore +(cl-defgeneric gui-backend-selection-owner-p (_selection) "Whether the current Emacs process owns the given X Selection. -Called with one argument: (SELECTION). The arg should be the name of the selection in question, typically one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. -\(Those are literal upper-case symbol names, since that's what X expects.)") +\(Those are literal upper-case symbol names, since that's what X expects.)" + nil) -(gui-method-declare gui-selection-exists-p #'ignore +(cl-defgeneric gui-backend-selection-exists-p (_selection) "Whether there is an owner for the given X Selection. -Called with one argument: (SELECTION). The arg should be the name of the selection in question, typically one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. -\(Those are literal upper-case symbol names, since that's what X expects.)") +\(Those are literal upper-case symbol names, since that's what X expects.)" + nil) (defun gui-get-selection (&optional type data-type) "Return the value of an X Windows selection. @@ -294,8 +293,8 @@ all upper-case names. The most often used ones, in addition to DATA-TYPE is usually `STRING', but can also be one of the symbols in `selection-converter-alist', which see. This argument is ignored on NS, MS-Windows and MS-DOS." - (let ((data (gui-call gui-get-selection (or type 'PRIMARY) - (or data-type 'STRING)))) + (let ((data (gui-backend-get-selection (or type 'PRIMARY) + (or data-type 'STRING)))) (when (and (stringp data) (setq data-type (get-text-property 0 'foreign-selection data))) (let ((coding (or next-selection-coding-system @@ -351,7 +350,7 @@ are not available to other programs." valid)) (signal 'error (list "invalid selection" data))) (or type (setq type 'PRIMARY)) - (gui-call gui-set-selection type data) + (gui-backend-set-selection type data) data) (define-obsolete-function-alias 'x-set-selection 'gui-set-selection "25.1") @@ -511,7 +510,7 @@ two markers or an overlay. Otherwise, it is nil." (apply 'vector all))) (defun xselect-convert-to-delete (selection _type _value) - (gui-call gui-set-selection selection nil) + (gui-backend-set-selection selection nil) ;; A return value of nil means that we do not know how to do this conversion, ;; and replies with an "error". A return value of NULL means that we have ;; done the conversion (and any side-effects) but have no value to return. |