summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-10-09 23:28:24 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-10-09 23:28:24 -0400
commita27cd28f9593138b430938854d7613f9029a94a9 (patch)
tree78ec9459774e3ab26acd83b19d5ef555aab6fae3 /lisp
parentcd0351b20288ea6edd7a958317114f029a76c1c1 (diff)
downloademacs-a27cd28f9593138b430938854d7613f9029a94a9.tar.gz
emacs-a27cd28f9593138b430938854d7613f9029a94a9.tar.bz2
emacs-a27cd28f9593138b430938854d7613f9029a94a9.zip
* lisp/select.el (gui-selection-exists-p-alist): New method.
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/menu-bar.el14
-rw-r--r--lisp/select.el11
-rw-r--r--lisp/simple.el4
-rw-r--r--lisp/term/ns-win.el1
-rw-r--r--lisp/term/pc-win.el1
-rw-r--r--lisp/term/w32-win.el1
-rw-r--r--lisp/term/x-win.el1
8 files changed, 28 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 44aa27f7d82..4048f759ae6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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)
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 3c654efb9ba..5ae5da9aff2 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -470,17 +470,14 @@
[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))
@@ -537,9 +534,8 @@
'(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 ()
diff --git a/lisp/select.el b/lisp/select.el
index 65c693eb424..397b98736c6 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -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.
diff --git a/lisp/simple.el b/lisp/simple.el
index 9b59b65b851..9ce33030865 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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).
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 22e99d87968..1b7e0751492 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -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)
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index a7507377bda..7c2b8d6dff0 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -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.
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index 7e32791c179..5266a45eba7 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -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
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index d6848628bf3..4cbcf767c03 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -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