emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is touch-screen.el preloaded?


From: Eli Zaretskii
Subject: Re: Why is touch-screen.el preloaded?
Date: Wed, 29 Nov 2023 15:26:21 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Wed, 29 Nov 2023 19:53:58 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I don't think I understand what you are saying.  Can you perhaps show
> > an example and explain this using that example?
> 
> OK.  calc.el binds touch-screen-display-keyboard to t, preventing window
> creation hooks it installs from removing the virtual keyboard when the
> selected window changes as its calculator windows are created.
> 
>     ;; not hidden by accident.
>     (let ((touch-screen-display-keyboard t))
>       (when (get-buffer-window "*Calc Keypad*")
> 
> This let statement binding a global variable won't take effect if
> byte-compiled on systems where touch-screen.el is not preloaded unless a
> defvar statement is inserted, and much code will omit this statement,
> since their authors will be unaware it might be necessary.  Such code
> will function improperly if compiled on those systems.

But we have this issue in gazillion places in Emacs.  It is the job of
whoever writes such code to make sure there is a defvar.  Otherwise
this is a subtle bug, which will be fixed when reported by someone
from the affected platforms.

A random example:

  (defvar w32-collate-ignore-punctuation) ; Declare for non-w32 builds.

  (defsubst ls-lisp-string-lessp (s1 s2)
    "Return t if string S1 should sort before string S2.
  Case is significant if `ls-lisp-ignore-case' is nil.
  Uses `string-collate-lessp' if `ls-lisp-use-string-collate' is non-nil,
  `compare-strings' otherwise.
  On GNU/Linux systems, if the locale specifies UTF-8 as the codeset,
  the sorting order will place together file names that differ only
  by punctuation characters, like `.emacs' and `emacs'.  To have a
  similar behavior on MS-Windows, customize `ls-lisp-UCA-like-collation'
  to a non-nil value."
    (let ((w32-collate-ignore-punctuation ls-lisp-UCA-like-collation))
      (if ls-lisp-use-string-collate
          (string-collate-lessp s1 s2 nil ls-lisp-ignore-case)
        (let ((u (compare-strings s1 0 nil s2 0 nil ls-lisp-ignore-case)))
          (and (numberp u) (< u 0))))))

So I don't see any grave problem here.  It's nothing new.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]