emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 8e9ff8b: Remove XEmacs compat code from calc


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 8e9ff8b: Remove XEmacs compat code from calc
Date: Wed, 19 Jun 2019 16:56:43 -0400 (EDT)

branch: master
commit 8e9ff8b115bda364f30654589160fb702a511e9c
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Remove XEmacs compat code from calc
    
    * lisp/calc/calc.el (calc-read-key-sequence)
    (calcDigit-start, calc-read-key, calc-unread-command)
    (calc-clear-unread-commands):
    * lisp/calc/calc-misc.el (calc-dispatch-help):
    * lisp/calc/calc-help.el (calc-help-for-help)
    (calc-describe-key):
    * lisp/calc/calc-ext.el (calc-fancy-prefix, calc-user-key-map):
    Remove XEmacs compat code.
---
 lisp/calc/calc-ext.el  |  8 +++----
 lisp/calc/calc-help.el | 12 +++++-----
 lisp/calc/calc-misc.el |  6 ++---
 lisp/calc/calc.el      | 62 ++++++++++++++------------------------------------
 4 files changed, 29 insertions(+), 59 deletions(-)

diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 1456fb2..4cc6b22 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -1487,14 +1487,14 @@ calc-kill calc-kill-region calc-yank))))
         (not calc-is-keypad-press)
         (if (boundp 'overriding-terminal-local-map)
             (setq overriding-terminal-local-map calc-fancy-prefix-map)
-          (let ((event (calc-read-key t)))
-            (if (eq (setq last-command-event (car event)) ?\C-u)
+          (let ((event (read-event)))
+            (if (eq (setq last-command-event event) ?\C-u)
                 (universal-argument)
               (if (or (not (integerp last-command-event))
                       (and (>= last-command-event 0) (< last-command-event ? )
                            (not (memq last-command-event '(?\e)))))
                   (calc-wrapper))  ; clear flags if not a Calc command.
-               (setq last-command-event (cdr event))
+               (setq last-command-event event)
               (if (or (not (integerp last-command-event))
                       (eq last-command-event ?-))
                   (calc-unread-command)
@@ -1915,8 +1915,6 @@ calc-kill calc-kill-region calc-yank))))
 ;;; User menu.
 
 (defun calc-user-key-map ()
-  (if (featurep 'xemacs)
-      (error "User-defined keys are not supported in XEmacs"))
   (let ((res (cdr (lookup-key calc-mode-map "z"))))
     (if (eq (car (car res)) 27)
        (cdr res)
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index d9e8fe7..3b8bfda 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -77,14 +77,14 @@ C-w  Describe how there is no warranty for Calc."
          (select-window (get-buffer-window "*Help*"))
          (while (progn
                   (message "Calc Help options: Help, Info, ...  press SPC, DEL 
to scroll, C-g to cancel")
-                  (memq (car (setq key (calc-read-key t)))
+                  (memq (setq key (read-event))
                         '(?  ?\C-h ?\C-? ?\C-v ?\M-v)))
            (condition-case err
-               (if (memq (car key) '(?  ?\C-v))
+               (if (memq key '(? ?\C-v))
                    (scroll-up)
                  (scroll-down))
              (error (beep)))))
-       (calc-unread-command (cdr key))
+       (calc-unread-command key)
        (calc-help-prefix nil))
     (let ((calc-dispatch-help t))
       (calc-help-prefix arg))))
@@ -255,8 +255,8 @@ C-w  Describe how there is no warranty for Calc."
                           msg
                           (if (equal notes "") ""
                             (format "  (?=notes %s)" notes)))
-                 (let ((key (calc-read-key t)))
-                   (if (eq (car key) ??)
+                 (let ((key (read-event)))
+                   (if (eq key ??)
                        (if (equal notes "")
                            (message "No notes for this command")
                          (while (string-match "," notes)
@@ -280,7 +280,7 @@ C-w  Describe how there is no warranty for Calc."
                                (princ (buffer-substring pt (point))))
                              (setq notes (cdr notes)))
                            (help-print-return-message)))
-                     (calc-unread-command (cdr key)))))
+                     (calc-unread-command key))))
              (if (or (null defn) (integerp defn))
                  (message "%s is undefined" desc)
                (message "%s runs the command %s"
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el
index aedb687..5fd8d07 100644
--- a/lisp/calc/calc-misc.el
+++ b/lisp/calc/calc-misc.el
@@ -116,14 +116,14 @@ Calc user interface as before (either C-x * C or C-x * K; 
initially C-x * C).
                  (while (progn
                           (message "Calc options: Calc, Keypad, ...  %s"
                                    "press SPC, DEL to scroll, C-g to cancel")
-                          (memq (car (setq key (calc-read-key t)))
+                          (memq (setq key (read-event))
                                 '(?  ?\C-h ?\C-? ?\C-v ?\M-v)))
                    (condition-case err
-                       (if (memq (car key) '(?  ?\C-v))
+                       (if (memq key '(?  ?\C-v))
                            (scroll-up)
                          (scroll-down))
                      (error (beep))))
-                     (calc-unread-command (cdr key))))))
+                     (calc-unread-command key)))))
        (calc-do-dispatch nil))
     (let ((calc-dispatch-help t))
       (calc-do-dispatch arg))))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 1496a74..2136a09 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1113,15 +1113,7 @@ Used by `calc-user-invocation'.")
        (ignore-errors
           (define-key calc-digit-map x 'calcDigit-backspace)
           (define-key calc-mode-map x 'calc-pop)
-          (define-key calc-mode-map
-            (if (and (vectorp x) (featurep 'xemacs))
-                (if (= (length x) 1)
-                    (vector (if (consp (aref x 0))
-                                (cons 'meta (aref x 0))
-                              (list 'meta (aref x 0))))
-                  "\e\C-d")
-              (vconcat "\e" x))
-            'calc-pop-above)))
+          (define-key calc-mode-map (vconcat "\e" x) 'calc-pop-above)))
       (if calc-scan-for-dels
          (append (where-is-internal 'delete-backward-char global-map)
                  (where-is-internal 'backward-delete-char global-map)
@@ -1230,9 +1222,9 @@ Used by `calc-user-invocation'.")
   (let ((glob (current-global-map))
        (loc (current-local-map)))
     (or (input-pending-p) (message "%s" prompt))
-    (let ((key (calc-read-key t))
+    (let ((key (read-event))
          (input-method-function nil))
-      (calc-unread-command (cdr key))
+      (calc-unread-command key)
       (unwind-protect
          (progn
            (use-global-map map)
@@ -2333,21 +2325,14 @@ the United States."
            (calc-prev-char nil)
            (calc-prev-prev-char nil)
            (calc-buffer (current-buffer))
-           (buf (if (featurep 'xemacs)
-                    (catch 'calc-foo
-                      (catch 'execute-kbd-macro
-                        (throw 'calc-foo
-                               (read-from-minibuffer
-                                "Calc: " "" calc-digit-map)))
-                      (error "XEmacs requires RET after %s"
-                             "digit entry in kbd macro"))
-                  (let ((old-esc (lookup-key global-map "\e")))
-                    (unwind-protect
-                        (progn
-                          (define-key global-map "\e" nil)
-                          (read-from-minibuffer
-                            "Calc: " (calc-digit-start-entry) calc-digit-map))
-                      (define-key global-map "\e" old-esc))))))
+           (buf
+            (let ((old-esc (lookup-key global-map "\e")))
+              (unwind-protect
+                  (progn
+                    (define-key global-map "\e" nil)
+                    (read-from-minibuffer
+                      "Calc: " (calc-digit-start-entry) calc-digit-map))
+                (define-key global-map "\e" old-esc)))))
        (or calc-digit-value (setq calc-digit-value (math-read-number buf)))
        (if (stringp calc-digit-value)
           (calc-alg-entry calc-digit-value)
@@ -3883,29 +3868,16 @@ See Info node `(calc)Defining Functions'."
   (require 'calc-ext)
   (math-do-defmath func args body))
 
-;;; Functions needed for Lucid Emacs support.
-
-(defun calc-read-key (&optional optkey)
-  (cond ((featurep 'xemacs)
-        (let ((event (next-command-event)))
-          (let ((key (event-to-character event t t)))
-            (or key optkey (error "Expected a plain keystroke"))
-            (cons key event))))
-       (t
-        (let ((key (read-event)))
-          (cons key key)))))
+(defun calc-read-key (&optional _optkey)
+  (declare (obsolete read-event "27.1"))
+  (let ((key (read-event)))
+    (cons key key)))
 
 (defun calc-unread-command (&optional input)
-  (if (featurep 'xemacs)
-      (setq unread-command-event
-           (if (integerp input) (character-to-event input)
-             (or input last-command-event)))
-    (push (or input last-command-event) unread-command-events)))
+  (push (or input last-command-event) unread-command-events))
 
 (defun calc-clear-unread-commands ()
-  (if (featurep 'xemacs)
-      (setq unread-command-event nil)
-    (setq unread-command-events nil)))
+  (setq unread-command-events nil))
 
 (defcalcmodevar math-2-word-size
   (math-read-number-simple "4294967296")



reply via email to

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