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/term/ns-win.el | |
parent | dc4484ec6de13a3d75b52c477a3cde59dc8ed46c (diff) |
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/term/ns-win.el')
-rw-r--r-- | lisp/term/ns-win.el | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index e642ab53447..f603f3e0f6d 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -848,7 +848,8 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; Do the actual Nextstep Windows setup here; the above code just ;; defines functions and variables that we use now. -(defun ns-initialize-window-system (&optional _display) +(cl-defmethod window-system-initialization (&context (window-system (eql ns)) + &optional _display) "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." (cl-assert (not ns-initialized)) @@ -921,10 +922,11 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; Any display name is OK. (add-to-list 'display-format-alist '(".*" . ns)) -(gui-method-define handle-args-function ns #'x-handle-args) -(gui-method-define frame-creation-function ns #'x-create-frame-with-faces) -(gui-method-define window-system-initialization ns - #'ns-initialize-window-system) +(cl-defmethod handle-args-function (args &context (window-system (eql ns))) + (x-handle-args args)) + +(cl-defmethod frame-creation-function (params &context (window-system (eql ns))) + (x-create-frame-with-faces params)) (declare-function ns-own-selection-internal "nsselect.m" (selection value)) (declare-function ns-disown-selection-internal "nsselect.m" (selection)) @@ -935,13 +937,22 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") (declare-function ns-get-selection "nsselect.m" (selection-symbol target-type &optional time-stamp terminal)) -(gui-method-define gui-set-selection ns - (lambda (selection value) - (if value (ns-own-selection-internal selection value) - (ns-disown-selection-internal selection)))) -(gui-method-define gui-selection-owner-p ns #'ns-selection-owner-p) -(gui-method-define gui-selection-exists-p ns #'ns-selection-exists-p) -(gui-method-define gui-get-selection ns #'ns-get-selection) +(cl-defmethod gui-backend-set-selection (selection value + &context (window-system (eql ns))) + (if value (ns-own-selection-internal selection value) + (ns-disown-selection-internal selection))) + +(cl-defmethod gui-backend-selection-owner-p (selection + &context (window-system (eql ns))) + (ns-selection-owner-p selection)) + +(cl-defmethod gui-backend-selection-exists-p (selection + &context (window-system (eql ns))) + (ns-selection-exists-p selection)) + +(cl-defmethod gui-backend-get-selection (selection-symbol target-type + &context (window-system (eql ns))) + (ns-get-selection selection-symbol target-type)) (provide 'ns-win) |