* 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.
This commit is contained in:
parent
cd0351b202
commit
a27cd28f95
8 changed files with 28 additions and 15 deletions
|
@ -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)
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue