1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-18 10:16:51 +00:00
emacs/lisp/w32-common-fns.el
Stefan Monnier d6f8fef3fc New gui-selection-value consolidating x-selection-value.
* lisp/select.el (gui-selection-value-alist): New method.
(gui-selection-value): New function.
(x-selection-value): Make it an obsolete alias.
* lisp/simple.el (interprogram-paste-function): Default to gui-selection-value.
* lisp/w32-common-fns.el (w32-get-selection-value): Simplify.
(x-selection-value): Remove alias.
(interprogram-paste-function): Don't set.
(gui-selection-value): Define for w32.
* lisp/term/x-win.el (gui-selection-value): Define for x.
(x--selection-value): Rename from x--selection-value.
(interprogram-paste-function): Don't set.
* lisp/term/pc-win.el (w16-get-selection-value): Simplify.
(msdos-initialize-window-system): Don't set interprogram-paste-function.
(gui-selection-value): Define for pc.
* lisp/term/ns-win.el (x-selection-value): Remove.
(gui-selection-value): Define for ns, instead.
* lisp/term/common-win.el (x-setup-function-keys): Don't set
interprogram-paste-function.
* lisp/obsolete/mouse-sel.el (mouse-sel-get-selection-function):
Use gui-selection-value.
2014-10-02 21:39:49 -04:00

85 lines
3.1 KiB
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; w32-common-fns.el --- Lisp routines for Windows and Cygwin-w32
;; Copyright (C) 1994, 2001-2014 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;;
;;; This file contains functions that are used by both native NT Emacs
;;; and Cygwin Emacs compiled to use the native Windows widget
;;; library.
(declare-function x-server-version "w32fns.c" (&optional terminal))
(defun w32-version ()
"Return the MS-Windows version numbers.
The value is a list of three integers: the major and minor version
numbers, and the build number."
(x-server-version))
(defun w32-using-nt ()
"Return non-nil if running on a Windows NT descendant.
That includes all Windows systems except for 9X/Me."
(getenv "SystemRoot"))
(declare-function w32-get-clipboard-data "w32select.c")
(declare-function w32-set-clipboard-data "w32select.c")
(declare-function x-server-version "w32fns.c" (&optional display))
;;; Fix interface to (X-specific) mouse.el
(gui-method-define gui-own-selection w32
(lambda (type value)
(put 'x-selections (or type 'PRIMARY) data)))
(gui-method-define gui-disown-selection w32
(lambda (type &optional _time-object _frame)
(put 'x-selections (or type 'PRIMARY) nil)))
(gui-method-define gui-get-selection w32
(lambda (&optional type _data-type)
(get 'x-selections (or type 'PRIMARY))))
;; gui-selection-owner-p is used in simple.el
(gui-method-define gui-selection-owner-p w32
(lambda (selection)
(and (memq selection '(nil PRIMARY SECONDARY))
(get 'x-selections (or selection 'PRIMARY)))))
;; The "Windows" keys on newer keyboards bring up the Start menu
;; whether you want it or not - make Emacs ignore these keystrokes
;; rather than beep.
(global-set-key [lwindow] 'ignore)
(global-set-key [rwindow] 'ignore)
(defvar w32-charset-info-alist) ; w32font.c
;;;; Selections
(defun w32-get-selection-value ()
"Return the value of the current selection.
Consult the selection. Treat empty strings as if they were unset."
(if gui-select-enable-clipboard
;; Don't die if x-get-selection signals an error.
(with-demoted-errors "w32-get-clipboard-data:%S"
(w32-get-clipboard-data))))
;; Arrange for the kill and yank functions to set and check the clipboard.
(gui-method-define gui-selection-value w32 #'w32-get-selection-value)
(provide 'w32-common-fns)