From 3ef041ae3b98dde7300c9be4a28047748903ddc7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 6 Oct 2014 13:47:56 -0400 Subject: [PATCH] * lisp/term/w32-win.el: Move all code from 32-common-fns.el here. (gui-select-text, gui-selection-value): Use w32 handlers in the w32 console as well. * lisp/w32-common-fns.el: Remove. * lisp/loadup.el: Don't load w32-common-fns.el. * w32-fns.elc: Don't require w32-common-fns. * src/lisp.mk (lisp): Remove w32-common-fns.elc. Fixes: debbugs:18629 --- lisp/ChangeLog | 12 ++++-- lisp/loadup.el | 1 - lisp/term/w32-win.el | 65 ++++++++++++++++++++++++++++++-- lisp/w32-common-fns.el | 84 ------------------------------------------ lisp/w32-fns.el | 1 - src/ChangeLog | 21 ++++++----- src/lisp.mk | 1 - 7 files changed, 81 insertions(+), 104 deletions(-) delete mode 100644 lisp/w32-common-fns.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5847802f8fd..8c3a239e662 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,12 +1,16 @@ 2014-10-06 Stefan Monnier + * term/w32-win.el: Move all code from 32-common-fns.el here. + (gui-select-text, gui-selection-value): Use w32 handlers in the w32 + console as well (bug#18629). + * w32-common-fns.el: Remove. + * loadup.el: Don't load w32-common-fns.el. + * w32-fns.elc: Don't require w32-common-fns. + + * icomplete.el: Move Iswitchb autoload here. Much simpler. * obsolete/iswitchb.el (iswitchb-mode): Use normal autoload cookie. Remove redundant obsolescence thingy. - * loadup.el: Don't load obsolete/loaddefs.el. - - * icomplete.el: Move Iswitchb autoload here. Much simpler. - * Makefile.in (obsolete-autoloads): Remove. (AUTOGENEL): Remove obsolete/loaddefs.el. diff --git a/lisp/loadup.el b/lisp/loadup.el index 9c052b284b8..fd34648bb30 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -252,7 +252,6 @@ (load "w32-vars") (load "term/w32-win") (load "disp-table") - (load "w32-common-fns") (when (eq system-type 'windows-nt) (load "w32-fns") (load "ls-lisp") diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 8ef718ad230..7e32791c179 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -376,12 +376,69 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") (gui-method-define window-system-initialization w32 #'w32-initialize-window-system) +;;;; Selections + (declare-function w32-set-clipboard-data "w32select.c" (string &optional ignored)) -(gui-method-define gui-select-text w32 - (lambda (text) - (if gui-select-enable-clipboard - (w32-set-clipboard-data text)))) +(declare-function w32-get-clipboard-data "w32select.c") + +(defun w32--select-text (text) + (if gui-select-enable-clipboard (w32-set-clipboard-data text))) + +(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-select-text w32 #'w32--select-text) +(gui-method-define gui-selection-value w32 #'w32--get-selection-value) + +(when (eq system-type 'windows-nt) + ;; Make copy&pasting in w32's console interact with the system's clipboard! + (gui-method-define gui-select-text t #'w32--select-text) + (gui-method-define gui-selection-value t #'w32--get-selection-value)) + +;;; 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) + (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) + +(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")) (provide 'w32-win) diff --git a/lisp/w32-common-fns.el b/lisp/w32-common-fns.el deleted file mode 100644 index 04037839b94..00000000000 --- a/lisp/w32-common-fns.el +++ /dev/null @@ -1,84 +0,0 @@ -;;; 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 . - -;;; 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) diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index fda51b1532b..2cbeb49d543 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -26,7 +26,6 @@ ;;; Code: (require 'w32-vars) -(require 'w32-common-fns) (defvar explicit-shell-file-name) diff --git a/src/ChangeLog b/src/ChangeLog index facddf3b849..c03b6dad06f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-10-06 Stefan Monnier + + * lisp.mk (lisp): Remove w32-common-fns.elc. + 2014-10-05 Paul Eggert * keyboard.c (Qleft, Qright): Remove duplicate definitions (Bug#9927). @@ -20,10 +24,9 @@ (ns_draw_window_cursor): Adjust y for hbar cursor only if smaller than line height (Bug#17977). - * macfont.m: Fix indentation and import changes from macport - 24.3.94. + * macfont.m: Fix indentation and import changes from macport 24.3.94. (macfont_closest_traits_index): New function. - (macfont_closest_traits_index_p): Renamed from + (macfont_closest_traits_index_p): Rename from macfont_closest_traits_index. (macfont_list): Use macfont_closest_traits_index_p. @@ -40,8 +43,8 @@ 2014-10-04 Martin Rudalics - * buffer.c (scroll_bar_width, scroll_bar_height): Fix - doc-strings. + * buffer.c (scroll_bar_width, scroll_bar_height): + Fix doc-strings. * window.c (Fset_window_scroll_bars): Fix doc-string. (Fwindow_scroll_bars): Have it return what the doc-string says. @@ -144,8 +147,8 @@ values. (my_create_window): Move the calculation of the coordinates of the frame's top-left edge here. Pass them to the input thread via the - second parameter of the WM_EMACS_CREATEWINDOW message. See - http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00892.html + second parameter of the WM_EMACS_CREATEWINDOW message. + See http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00892.html for the details. 2014-09-30 Eli Zaretskii @@ -156,8 +159,8 @@ obey it if the glyph row showing point will be fully visible. Likewise when the window start is in a continuation line. If, after trying everything under the 'force_start' label, point is - still not fully visible, give up and scroll the window. Add - debugging traces. (Bug#18545) + still not fully visible, give up and scroll the window. + Add debugging traces. (Bug#18545) * window.c (Frecenter): Set the window's redisplay flag. diff --git a/src/lisp.mk b/src/lisp.mk index e9783f649be..642e9af225f 100644 --- a/src/lisp.mk +++ b/src/lisp.mk @@ -153,7 +153,6 @@ lisp = \ $(lispsource)/term/w32-win.elc \ $(lispsource)/ls-lisp.elc \ $(lispsource)/disp-table.elc \ - $(lispsource)/w32-common-fns.elc \ $(lispsource)/dos-w32.elc \ $(lispsource)/w32-fns.elc \ $(lispsource)/dos-fns.elc \ -- 2.39.5