Subject: [PATCH] Remove more XEmacs compat code
From: Stefan Kangas <[email-masked]>
To: [email-masked]
Date: Thu, 26 Sep 2019 19:38:02 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

See attached patches.

Best regards,
Stefan Kangas
From 86fb33d0c7c15e5c553915ec7cf201964c2fd66b Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 14 Sep 2019 15:15:27 +0200
Subject: [PATCH 1/4] Remove XEmacs compat code from term.el

* lisp/term.el (term-mode-map, term-raw-map, term-mouse-paste):
Remove XEmacs compat code.
---
 lisp/term.el | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 66ae470239..43239d9b6c 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -587,10 +587,9 @@ term-mode-map
     (define-key map "\en" 'term-next-input)
     (define-key map "\er" 'term-previous-matching-input)
     (define-key map "\es" 'term-next-matching-input)
-    (unless (featurep 'xemacs)
-      (define-key map [?\A-\M-r]
-	'term-previous-matching-input-from-input)
-      (define-key map [?\A-\M-s] 'term-next-matching-input-from-input))
+    (define-key map [?\A-\M-r]
+      'term-previous-matching-input-from-input)
+    (define-key map [?\A-\M-s] 'term-next-matching-input-from-input)
     (define-key map "\e\C-l" 'term-show-output)
     (define-key map "\C-m" 'term-send-input)
     (define-key map "\C-d" 'term-delchar-or-maybe-eof)
@@ -827,9 +826,7 @@ term-raw-map
 
     ;; Added nearly all the 'gray keys' -mm
 
-    (if (featurep 'xemacs)
-        (define-key map [button2] 'term-mouse-paste)
-      (define-key map [mouse-2] 'term-mouse-paste))
+    (define-key map [mouse-2] 'term-mouse-paste)
     (define-key map [up] 'term-send-up)
     (define-key map [down] 'term-send-down)
     (define-key map [right] 'term-send-right)
@@ -1235,15 +1232,11 @@ term-send-raw-meta
 (defun term-mouse-paste (click)
   "Insert the primary selection at the position clicked on."
   (interactive "e")
-  (if (featurep 'xemacs)
-      (term-send-raw-string
-       (or (condition-case () (x-get-selection) (error ()))
-	   (error "No selection available")))
-    ;; Give temporary modes such as isearch a chance to turn off.
-    (run-hooks 'mouse-leave-buffer-hook)
-    (setq this-command 'yank)
-    (mouse-set-point click)
-    (term-send-raw-string (gui-get-primary-selection))))
+  ;; Give temporary modes such as isearch a chance to turn off.
+  (run-hooks 'mouse-leave-buffer-hook)
+  (setq this-command 'yank)
+  (mouse-set-point click)
+  (term-send-raw-string (gui-get-primary-selection)))
 
 (defun term-paste ()
   "Insert the last stretch of killed text at point."
-- 
2.20.1

From 9425a6fe82014388aa5619005c193ec60267af01 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 14 Sep 2019 15:23:57 +0200
Subject: [PATCH 2/4] Remove XEmacs compat code from winner.el

* lisp/winner.el (winner-active-region, winner-edges)
(winner-window-list, winner-sorted-window-list, winner-win-data)
(winner-make-point-alist): Remove XEmacs compat code.
---
 lisp/winner.el | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/lisp/winner.el b/lisp/winner.el
index ec3b296489..dc8bde5331 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -36,19 +36,9 @@
 
 (defun winner-active-region ()
   (declare (gv-setter (lambda (store)
-                        (if (featurep 'xemacs)
-                            `(if ,store (zmacs-activate-region)
-                               (zmacs-deactivate-region))
-                          `(if ,store (activate-mark) (deactivate-mark))))))
+                        `(if ,store (activate-mark) (deactivate-mark)))))
   (region-active-p))
 
-(defalias 'winner-edges
-  (if (featurep 'xemacs) 'window-pixel-edges 'window-edges))
-(defalias 'winner-window-list
-  (if (featurep 'xemacs)
-      (lambda () (delq (minibuffer-window) (window-list nil 0)))
-    (lambda () (window-list nil 0))))
-
 (require 'ring)
 
 (defgroup winner nil
@@ -82,17 +72,17 @@ winner-boring-buffers-regexp
 
 ;; List the windows according to their edges.
 (defun winner-sorted-window-list ()
-  (sort (winner-window-list)
+  (sort (window-list nil 0)
         (lambda (x y)
-          (cl-loop for a in (winner-edges x)
-                   for b in (winner-edges y)
+          (cl-loop for a in (window-edges x)
+                   for b in (window-edges y)
                    while (= a b)
                    finally return (< a b)))))
 
 (defun winner-win-data ()
   ;; Essential properties of the windows in the selected frame.
   (cl-loop for win in (winner-sorted-window-list)
-           collect (cons (winner-edges win) (window-buffer win))))
+           collect (cons (window-edges win) (window-buffer win))))
 
 ;; This variable is updated with the current window configuration
 ;; every time it changes.
@@ -242,7 +232,7 @@ winner-point-alist
 (defun winner-make-point-alist ()
   (save-current-buffer
     (cl-loop with alist
-             for win in (winner-window-list)
+             for win in (window-list nil 0)
              for entry =
              (or (assq (window-buffer win) alist)
                  (car (push (list (set-buffer (window-buffer win))
-- 
2.20.1

From bd4b0c5dd4b368a5ba1d49e04306eef0ecdd4dc1 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 14 Sep 2019 15:35:09 +0200
Subject: [PATCH 3/4] Remove XEmacs compat code from url-*.el

* lisp/url/url-file.el (url-file-build-filename, url-file)
* lisp/url/url-privacy.el (url-setup-privacy-info): Remove XEmacs
compat code.
(url-device-type): Declare obsolete.
---
 lisp/url/url-file.el    | 14 +-------------
 lisp/url/url-privacy.el |  9 ++++-----
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el
index b953ce7694..41ffb4cd4a 100644
--- a/lisp/url/url-file.el
+++ b/lisp/url/url-file.el
@@ -120,9 +120,6 @@ url-file-build-filename
 	 (cond
 	  ((featurep 'ange-ftp)
 	   (ange-ftp-set-passwd host user pass))
-	  ((when (featurep 'xemacs)
-             (or (featurep 'efs) (featurep 'efs-auto)
-                 (efs-set-passwd host user pass))))
 	  (t
 	   nil)))
 
@@ -202,16 +199,7 @@ url-file
 					     (list #'url-file-asynch-callback
 						   new (current-buffer)
 						   callback cbargs)
-					     t)
-              (when (featurep 'xemacs)
-                (autoload 'efs-copy-file-internal "efs")
-                (efs-copy-file-internal filename (efs-ftp-path filename)
-                                        new (efs-ftp-path new)
-                                        t nil 0
-                                        (list #'url-file-asynch-callback
-                                              new (current-buffer)
-                                              callback cbargs)
-                                        0 nil)))))))
+					     t))))))
     buffer))
 
 (defmacro url-file-create-wrapper (method args)
diff --git a/lisp/url/url-privacy.el b/lisp/url/url-privacy.el
index ef9ff84d56..8f8fbef550 100644
--- a/lisp/url/url-privacy.el
+++ b/lisp/url/url-privacy.el
@@ -24,9 +24,8 @@
 (require 'url-vars)
 
 (defun url-device-type (&optional device)
-  (if (fboundp 'device-type)
-      (device-type device)              ; XEmacs
-    (or window-system 'tty)))
+  (declare (obsolete nil "27.1"))
+  (or window-system 'tty))
 
 ;;;###autoload
 (defun url-setup-privacy-info ()
@@ -42,9 +41,9 @@ url-setup-privacy-info
 	 ;; combinations
 	 ((eq system-type 'windows-nt) "Windows-NT; 32bit")
 	 ((eq system-type 'ms-dos) "MS-DOS; 32bit")
-	 ((memq (url-device-type) '(win32 w32)) "Windows; 32bit")
+	 ((memq (or window-system 'tty) '(win32 w32)) "Windows; 32bit")
 	 (t
-	  (pcase (url-device-type)
+	  (pcase (or window-system 'tty)
 	    ('x "X11")
 	    ('ns "OpenStep")
 	    ('tty "TTY")
-- 
2.20.1

From e4c1e6d33d2ffa0b066baeb716045f85bcb5c6c9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sat, 14 Sep 2019 15:44:54 +0200
Subject: [PATCH 4/4] Remove old commented out XEmacs compat code from
 syntax.el

* lisp/emacs-lisp/syntax.el: Remove ancient commented out XEmacs
compat code.  This code has been commented out since 2001.
---
 lisp/emacs-lisp/syntax.el | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index 6464e2a52d..3861b160cc 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -638,21 +638,6 @@ syntax-ppss-debug
       (setq pt (car x)))
     min-diffs))
 
-;; XEmacs compatibility functions
-
-;; (defun buffer-syntactic-context (&optional buffer)
-;;   "Syntactic context at point in BUFFER.
-;; Either of `string', `comment' or nil.
-;; This is an XEmacs compatibility function."
-;;   (with-current-buffer (or buffer (current-buffer))
-;;     (syntax-ppss-context (syntax-ppss))))
-
-;; (defun buffer-syntactic-context-depth (&optional buffer)
-;;   "Syntactic parenthesis depth at point in BUFFER.
-;; This is an XEmacs compatibility function."
-;;   (with-current-buffer (or buffer (current-buffer))
-;;     (syntax-ppss-depth (syntax-ppss))))
-
 (provide 'syntax)
 
 ;;; syntax.el ends here
-- 
2.20.1