From d8a00879309a3bf62f6ffcae103aa3bdba776ee9 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 6 Dec 2023 10:34:41 +0800 Subject: [PATCH] Cease preloading touch-screen.el outside X and Android * lisp/calc/calc.el (touch-screen-display-keyboard): * lisp/minibuffer.el (clear-minibuffer-message): * lisp/term.el (touch-screen-display-keyboard): Declare touch-screen-display-keyboard before binding or setting it. * lisp/loadup.el: Don't autoload touch-screen.el outside X and Android. * lisp/touch-screen.el: Autoload functions called from commands responding to touch screen events. --- lisp/calc/calc.el | 2 ++ lisp/loadup.el | 6 ++---- lisp/minibuffer.el | 2 +- lisp/term.el | 2 ++ lisp/touch-screen.el | 3 +++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 41aeb17c252..50623218701 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1285,6 +1285,8 @@ the trail buffer." (setq calc-trail-buffer nil) t)))) +(defvar touch-screen-display-keyboard) + (defun calc-mode () "Calculator major mode. diff --git a/lisp/loadup.el b/lisp/loadup.el index d447523dc42..ef4203917d4 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -298,12 +298,9 @@ (if (featurep 'dynamic-setting) (load "dynamic-setting")) -;; touch-screen.el is tiny and is used liberally throughout the button -;; code etc, so it may as well be preloaded everywhere. -(load "touch-screen") - (if (featurep 'x) (progn + (load "touch-screen") (load "x-dnd") (load "term/common-win") (load "term/x-win"))) @@ -316,6 +313,7 @@ (if (featurep 'android) (progn (load "ls-lisp") + (load "touch-screen") (load "term/common-win") (load "term/android-win"))) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 03b64198bcf..2ddaf0af120 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -975,7 +975,7 @@ Intended to be called via `clear-message-function'." ;; progress, because a preview message might currently be displayed ;; in the echo area. FIXME: find some way to place this in ;; touch-screen.el. - (if (and touch-screen-preview-select + (if (and (bound-and-true-p touch-screen-preview-select) (eq (nth 3 touch-screen-current-tool) 'drag)) 'dont-clear-message ;; Return nil telling the caller that the message diff --git a/lisp/term.el b/lisp/term.el index b2875e4a17f..81746e0c20d 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1085,6 +1085,8 @@ underlying shell." (setq term-ansi-current-invisible nil) (setq term-ansi-current-bg-color 0)) +(defvar touch-screen-display-keyboard) + (define-derived-mode term-mode fundamental-mode "Term" "Major mode for interacting with an inferior interpreter. The interpreter name is same as buffer name, sans the asterisks. diff --git a/lisp/touch-screen.el b/lisp/touch-screen.el index 56adb75cefc..be08ae1d3c8 100644 --- a/lisp/touch-screen.el +++ b/lisp/touch-screen.el @@ -1913,6 +1913,7 @@ if POSN is on a link or a button, or `mouse-1' otherwise." ;; Exports. These functions are intended for use externally. +;;;###autoload (defun touch-screen-track-tap (event &optional update data threshold) "Track a single tap starting from EVENT. EVENT should be a `touchscreen-begin' event. @@ -1970,6 +1971,7 @@ otherwise, return t once the `touchscreen-end' event arrives." (eq (caadr event) (caadr new-event)))) (t (throw 'finish nil)))))))) +;;;###autoload (defun touch-screen-track-drag (event update &optional data) "Track a single drag starting from EVENT. EVENT should be a `touchscreen-begin' event. @@ -2017,6 +2019,7 @@ touch point in EVENT did not move significantly, and t otherwise." ;;; Event handling exports. These functions are intended for use by ;;; Lisp commands bound to touch screen gesture events. +;;;###autoload (defun touch-screen-inhibit-drag () "Inhibit subsequent `touchscreen-drag' events from being sent. Prevent `touchscreen-drag' and translated mouse events from being -- 2.39.2