]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/select.el (gui-selection-exists-p-alist): New method.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 10 Oct 2014 03:28:24 +0000 (23:28 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 10 Oct 2014 03:28:24 +0000 (23:28 -0400)
* lisp/menu-bar.el (menu-bar-edit-menu, clipboard-yank):
* lisp/simple.el (deactivate-mark): Use it.
* lisp/term/x-win.el (gui-selection-exists-p):
* lisp/term/w32-win.el (gui-selection-exists-p):
* lisp/term/pc-win.el (gui-selection-exists-p):
* lisp/term/ns-win.el (gui-selection-exists-p): Provide a backend instance.

lisp/ChangeLog
lisp/menu-bar.el
lisp/select.el
lisp/simple.el
lisp/term/ns-win.el
lisp/term/pc-win.el
lisp/term/w32-win.el
lisp/term/x-win.el

index 44aa27f7d8258b6c6a2d47fa956e323bff38b111..4048f759ae634f70c09db7b4cc1f616fd18481dc 100644 (file)
@@ -1,3 +1,13 @@
+2014-10-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * select.el (gui-selection-exists-p-alist): New method.
+       * menu-bar.el (menu-bar-edit-menu, clipboard-yank):
+       * simple.el (deactivate-mark): Use it.
+       * term/x-win.el (gui-selection-exists-p):
+       * term/w32-win.el (gui-selection-exists-p):
+       * term/pc-win.el (gui-selection-exists-p):
+       * term/ns-win.el (gui-selection-exists-p): Provide a backend instance.
+
 2014-10-10  Glenn Morris  <rgm@gnu.org>
 
        * info.el (Info-fontify-maximum-menu-size): Bump to 400k.  (Bug#16227)
index 3c654efb9ba4cdcc95ca322c642bdb52394b0f12..5ae5da9aff2ac3295f1f90cdb9b6c045f4925889 100644 (file)
                        [paste-from-menu])
       ;; ns-win.el said: Change text to be more consistent with
       ;; surrounding menu items `paste', etc."
-      `(menu-item ,(if (featurep 'ns) "Select and Paste"
-                     "Paste from Kill Menu") yank-menu
+      `(menu-item ,(if (featurep 'ns) "Select and Paste" "Paste from Kill Menu")
+                  yank-menu
                   :enable (and (cdr yank-menu) (not buffer-read-only))
                   :help "Choose a string from the kill ring and paste it"))
     (bindings--define-key menu [paste]
       '(menu-item "Paste" yank
                   :enable (and (or
-                                ;; Emacs compiled --without-x (or --with-ns)
-                                ;; doesn't have x-selection-exists-p.
-                                (and (fboundp 'x-selection-exists-p)
-                                     (x-selection-exists-p 'CLIPBOARD))
+                                (gui-call gui-selection-exists-p 'CLIPBOARD)
                                 (if (featurep 'ns) ; like paste-from-menu
                                     (cdr yank-menu)
                                   kill-ring))
      '(and mark-active (not buffer-read-only)))
 (put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
 (put 'clipboard-yank 'menu-enable
-     '(and (or (not (fboundp 'x-selection-exists-p))
-              (x-selection-exists-p)
-              (x-selection-exists-p 'CLIPBOARD))
+     '(and (or (gui-call gui-selection-exists-p 'PRIMARY)
+              (gui-call gui-selection-exists-p 'CLIPBOARD))
           (not buffer-read-only)))
 
 (defun clipboard-yank ()
index 65c693eb4248aa29f18664a779ccf89bc5406101..397b98736c63fade828ef80a2d172460bd2c7dcb 100644 (file)
@@ -235,9 +235,14 @@ Called with one argument: (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.)
-For convenience, the symbol nil is the same as `PRIMARY',
-and t is the same as `SECONDARY'.")
+(Those are literal upper-case symbol names, since that's what X expects.)")
+
+(gui-method-declare gui-selection-exists-p #'ignore
+  "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.)")
 
 (defun gui-set-selection (type data)
   "Make an X selection of type TYPE and value DATA.
index 9b59b65b851f55b79c097807627135445684183a..9ce33030865efe19eddef54bb1a0dadb59e0e006 100644 (file)
@@ -4497,8 +4497,6 @@ a mistake; see the documentation of `set-mark'."
     (signal 'mark-inactive nil)))
 
 ;; Behind display-selections-p.
-(declare-function x-selection-exists-p "xselect.c"
-                  (&optional selection terminal))
 
 (defun deactivate-mark (&optional force)
   "Deactivate the mark.
@@ -4529,7 +4527,7 @@ run `deactivate-mark-hook'."
            ;; deactivation should not clobber it (Bug#11772).
            ((and (/= (region-beginning) (region-end))
                  (or (gui-call gui-selection-owner-p 'PRIMARY)
-                     (null (gui-selection-exists-p 'PRIMARY))))
+                     (null (gui-call gui-selection-exists-p 'PRIMARY))))
             (gui-set-selection 'PRIMARY
                                 (funcall region-extract-function nil)))))
     (when mark-active (force-mode-line-update)) ;Refresh toolbar (bug#16382).
index 22e99d879686c1097a4491ab3b4a0fdf64c9f965..1b7e0751492e709cd24d2b00bc5b4ac011bb8628 100644 (file)
@@ -961,6 +961,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 (gui-method-define gui-own-selection ns #'ns-own-selection-internal)
 (gui-method-define gui-disown-selection ns #'ns-disown-selection-internal)
 (gui-method-define gui-selection-owner-p ns #'ns-selection-owner-p)
+(gui-method-define gui-selection-exists-p ns #'x-selection-exists-p)
 (gui-method-define gui-get-selection ns #'x-get-selection-internal) ;FIXME:name!
 
 (provide 'ns-win)
index a7507377bda485907a5c481a4951fd57fbffd9d9..7c2b8d6dff0a976e370ccccadfa0e50aee7c9a7c 100644 (file)
@@ -228,6 +228,7 @@ Consult the selection.  Treat empty strings as if they were unset."
         (w16-get-clipboard-data))))
 
 ;; gui-selection-owner-p is used in simple.el.
+(gui-method-define gui-selection-exists-p pc #'x-selection-exists-p)
 (gui-method-define gui-selection-owner-p pc #'w16-selection-owner-p)
 (defun w16-selection-owner-p (_selection)
   ;; FIXME: Other systems don't obey gui-select-enable-clipboard here.
index 7e32791c1796e044fd849b13b0cd042826b1fca1..5266a45eba7d8b11f45e9f6f718923dd6be07119 100644 (file)
@@ -420,6 +420,7 @@ Consult the selection.  Treat empty strings as if they were unset."
                    (lambda (selection)
                      (and (memq selection '(nil PRIMARY SECONDARY))
                           (get 'x-selections (or selection 'PRIMARY)))))
+(gui-method-define gui-selection-exists-p w32 #'x-selection-exists-p)
 
 ;; The "Windows" keys on newer keyboards bring up the Start menu
 ;; whether you want it or not - make Emacs ignore these keystrokes
index d6848628bf308b9e1c26aa69de80073a42de52f1..4cbcf767c033875c23f7fdfffd3859c0d6cdd9ff 100644 (file)
@@ -1473,6 +1473,7 @@ This returns an error if any Emacs frames are X frames."
 (gui-method-define gui-own-selection x #'x-own-selection-internal)
 (gui-method-define gui-disown-selection x #'x-disown-selection-internal)
 (gui-method-define gui-selection-owner-p x #'x-selection-owner-p)
+(gui-method-define gui-selection-exists-p x #'x-selection-exists-p)
 (gui-method-define gui-get-selection x #'x-get-selection-internal)
 
 ;; Initiate drag and drop