aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-06-20 01:44:19 +0200
committerLars Ingebrigtsen2019-06-20 12:51:39 +0200
commit9f4cced5db01b256dfcb78a8fa90f388ec32a840 (patch)
tree0e2cbd1e864af0754371afaefd2841cf6e9ae084
parent45a0ce0905e495ae93b39e75cedb34ac95c6ea71 (diff)
downloademacs-9f4cced5db01b256dfcb78a8fa90f388ec32a840.tar.gz
emacs-9f4cced5db01b256dfcb78a8fa90f388ec32a840.zip
Remove XEmacs compat code from erc
* lisp/erc/erc-button.el (button, erc-button-keymap) (erc-button-setup, erc-button-add-button): Remove XEmacs compat code. * lisp/erc/erc-compat.el (erc-replace-match-subexpression-in-string): * lisp/erc/erc-log.el (erc-log-file-coding-system): * lisp/erc/erc-menu.el (menu): * lisp/erc/erc-stamp.el (erc-timestamp-use-align-to): * lisp/erc/erc-track.el (erc-modified-channels-object, track) (erc-track-mouse-face): * lisp/erc/erc.el (erc-update-undo-list) (erc-quit-reason-various, erc-part-reason-various, erc-cmd-SV) (erc-input-message, erc-get-channel-mode-from-keypress) (erc-update-mode-line-buffer):
-rw-r--r--lisp/erc/erc-button.el25
-rw-r--r--lisp/erc/erc-compat.el6
-rw-r--r--lisp/erc/erc-log.el4
-rw-r--r--lisp/erc/erc-menu.el20
-rw-r--r--lisp/erc/erc-stamp.el6
-rw-r--r--lisp/erc/erc-track.el52
-rw-r--r--lisp/erc/erc.el32
7 files changed, 31 insertions, 114 deletions
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index c8aa887a652..c2702081daf 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -59,11 +59,7 @@
59 ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons) 59 ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons)
60 (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons) 60 (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons)
61 (remove-hook 'erc-complete-functions 'erc-button-next-function) 61 (remove-hook 'erc-complete-functions 'erc-button-next-function)
62 (remove-hook 'erc-mode-hook 'erc-button-setup) 62 (remove-hook 'erc-mode-hook 'erc-button-setup)))
63 (when (featurep 'xemacs)
64 (dolist (buffer (erc-buffer-list))
65 (with-current-buffer buffer
66 (kill-local-variable 'widget-button-face))))))
67 63
68;;; Variables 64;;; Variables
69 65
@@ -218,9 +214,7 @@ PAR is a number of a regexp grouping whose text will be passed to
218(defvar erc-button-keymap 214(defvar erc-button-keymap
219 (let ((map (make-sparse-keymap))) 215 (let ((map (make-sparse-keymap)))
220 (define-key map (kbd "RET") 'erc-button-press-button) 216 (define-key map (kbd "RET") 'erc-button-press-button)
221 (if (featurep 'xemacs) 217 (define-key map (kbd "<mouse-2>") 'erc-button-click-button)
222 (define-key map (kbd "<button2>") 'erc-button-click-button)
223 (define-key map (kbd "<mouse-2>") 'erc-button-click-button))
224 (define-key map (kbd "TAB") 'erc-button-next) 218 (define-key map (kbd "TAB") 'erc-button-next)
225 (define-key map (kbd "<backtab>") 'erc-button-previous) 219 (define-key map (kbd "<backtab>") 'erc-button-previous)
226 (define-key map [follow-link] 'mouse-face) 220 (define-key map [follow-link] 'mouse-face)
@@ -255,8 +249,6 @@ global-level ERC button keys yet.")
255(defun erc-button-setup () 249(defun erc-button-setup ()
256 "Add ERC mode-level button movement keys. This is only done once." 250 "Add ERC mode-level button movement keys. This is only done once."
257 ;; Make XEmacs use `erc-button-face'. 251 ;; Make XEmacs use `erc-button-face'.
258 (when (featurep 'xemacs)
259 (set (make-local-variable 'widget-button-face) nil))
260 ;; Add keys. 252 ;; Add keys.
261 (unless erc-button-keys-added 253 (unless erc-button-keys-added
262 (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous) 254 (define-key erc-mode-map (kbd "<backtab>") 'erc-button-previous)
@@ -374,18 +366,7 @@ REGEXP is the regular expression which matched for this button."
374 (list 'erc-callback fun) 366 (list 'erc-callback fun)
375 (list 'keymap erc-button-keymap) 367 (list 'keymap erc-button-keymap)
376 (list 'rear-nonsticky t) 368 (list 'rear-nonsticky t)
377 (and data (list 'erc-data data)))) 369 (and data (list 'erc-data data)))))
378 (when (featurep 'xemacs)
379 (widget-convert-button 'link from to :action 'erc-button-press-button
380 :suppress-face t
381 ;; Make XEmacs use our faces.
382 :button-face (if nick-p
383 erc-button-nickname-face
384 erc-button-face)
385 ;; Make XEmacs behave with mouse-clicks, for
386 ;; some reason, widget stuff overrides the
387 ;; 'keymap text-property.
388 :mouse-down-action 'erc-button-click-button)))
389 370
390(defun erc-button-add-face (from to face) 371(defun erc-button-add-face (from to face)
391 "Add FACE to the region between FROM and TO." 372 "Add FACE to the region between FROM and TO."
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index e724e367ab1..aae0f09a2c5 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -71,17 +71,13 @@ See `erc-encoding-coding-alist'."
71are placed. 71are placed.
72Note that this should end with a directory separator.") 72Note that this should end with a directory separator.")
73 73
74;; XEmacs's `replace-match' does not replace matching subexpressions in strings.
75(defun erc-replace-match-subexpression-in-string 74(defun erc-replace-match-subexpression-in-string
76 (newtext string match subexp start &optional fixedcase literal) 75 (newtext string match subexp start &optional fixedcase literal)
77 "Replace the subexpression SUBEXP of the last match in STRING with NEWTEXT. 76 "Replace the subexpression SUBEXP of the last match in STRING with NEWTEXT.
78MATCH is the text which matched the subexpression (see `match-string'). 77MATCH is the text which matched the subexpression (see `match-string').
79START is the beginning position of the last match (see `match-beginning'). 78START is the beginning position of the last match (see `match-beginning').
80See `replace-match' for explanations of FIXEDCASE and LITERAL." 79See `replace-match' for explanations of FIXEDCASE and LITERAL."
81 (cond ((featurep 'xemacs) 80 (replace-match newtext fixedcase literal string subexp))
82 (string-match match string start)
83 (replace-match newtext fixedcase literal string))
84 (t (replace-match newtext fixedcase literal string subexp))))
85 81
86(defalias 'erc-with-selected-window 'with-selected-window) 82(defalias 'erc-with-selected-window 'with-selected-window)
87(defalias 'erc-cancel-timer 'cancel-timer) 83(defalias 'erc-cancel-timer 'cancel-timer)
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 4153f5c57bd..1c046fe20cb 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -195,9 +195,7 @@ If you set this to nil, you may want to enable both
195 :group 'erc-log 195 :group 'erc-log
196 :type 'boolean) 196 :type 'boolean)
197 197
198(defcustom erc-log-file-coding-system (if (featurep 'xemacs) 198(defcustom erc-log-file-coding-system 'emacs-mule
199 'binary
200 'emacs-mule)
201 "The coding system ERC should use for writing log files. 199 "The coding system ERC should use for writing log files.
202 200
203This should ideally, be a \"catch-all\" coding system, like 201This should ideally, be a \"catch-all\" coding system, like
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index 8173829797b..17e36984ea6 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -115,22 +115,10 @@ ERC menu yet.")
115 ;; activates it immediately 115 ;; activates it immediately
116 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition) 116 (easy-menu-define erc-menu erc-mode-map "ERC menu" erc-menu-definition)
117 (setq erc-menu-defined t)) 117 (setq erc-menu-defined t))
118 (if (featurep 'xemacs) 118 (erc-menu-add))
119 (progn 119 ((erc-menu-remove)
120 ;; the menu isn't automatically added to the menu bar in 120 ;; `easy-menu-remove' is a no-op in Emacs 22
121 ;; XEmacs 121 (message "You might have to restart Emacs to remove the ERC menu")))
122 (add-hook 'erc-mode-hook 'erc-menu-add)
123 (dolist (buffer (erc-buffer-list))
124 (with-current-buffer buffer (erc-menu-add))))
125 (erc-menu-add)))
126 ((if (featurep 'xemacs)
127 (progn
128 (remove-hook 'erc-mode-hook 'erc-menu-add)
129 (dolist (buffer (erc-buffer-list))
130 (with-current-buffer buffer (erc-menu-remove))))
131 (erc-menu-remove)
132 ;; `easy-menu-remove' is a no-op in Emacs 22
133 (message "You might have to restart Emacs to remove the ERC menu"))))
134 122
135;; silence byte-compiler warning 123;; silence byte-compiler warning
136(defvar erc-menu) 124(defvar erc-menu)
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 860fdbb77ce..b48803452a2 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -227,14 +227,10 @@ the correct column."
227 (integer :tag "Column number") 227 (integer :tag "Column number")
228 (const :tag "Unspecified" nil))) 228 (const :tag "Unspecified" nil)))
229 229
230(defcustom erc-timestamp-use-align-to (and (not (featurep 'xemacs)) 230(defcustom erc-timestamp-use-align-to (eq window-system 'x)
231 (>= emacs-major-version 22)
232 (eq window-system 'x))
233 "If non-nil, use the :align-to display property to align the stamp. 231 "If non-nil, use the :align-to display property to align the stamp.
234This gives better results when variable-width characters (like 232This gives better results when variable-width characters (like
235Asian language characters and math symbols) precede a timestamp. 233Asian language characters and math symbols) precede a timestamp.
236Unfortunately, it only works in Emacs 22 and when using the X
237Window System.
238 234
239A side effect of enabling this is that there will only be one 235A side effect of enabling this is that there will only be one
240space before a right timestamp in any saved logs." 236space before a right timestamp in any saved logs."
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index e51e6056fb9..53a59207839 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -267,22 +267,12 @@ nil - don't add to mode line."
267(defun erc-modified-channels-object (strings) 267(defun erc-modified-channels-object (strings)
268 "Generate a new `erc-modified-channels-object' based on STRINGS." 268 "Generate a new `erc-modified-channels-object' based on STRINGS."
269 (if strings 269 (if strings
270 (if (featurep 'xemacs) 270 (concat (if (eq erc-track-position-in-mode-line 'after-modes)
271 (let ((e-m-c-s '("["))) 271 "[" " [")
272 (push (cons (extent-at 0 (car strings)) (car strings)) 272 (mapconcat 'identity (nreverse strings) ",")
273 e-m-c-s) 273 (if (eq erc-track-position-in-mode-line 'before-modes)
274 (dolist (string (cdr strings)) 274 "] " "]"))
275 (push "," e-m-c-s) 275 ""))
276 (push (cons (extent-at 0 string) string)
277 e-m-c-s))
278 (push "] " e-m-c-s)
279 (reverse e-m-c-s))
280 (concat (if (eq erc-track-position-in-mode-line 'after-modes)
281 "[" " [")
282 (mapconcat 'identity (nreverse strings) ",")
283 (if (eq erc-track-position-in-mode-line 'before-modes)
284 "] " "]")))
285 (if (featurep 'xemacs) '() "")))
286 276
287(defvar erc-modified-channels-object (erc-modified-channels-object nil) 277(defvar erc-modified-channels-object (erc-modified-channels-object nil)
288 "Internal object used for displaying modified channels in the mode line.") 278 "Internal object used for displaying modified channels in the mode line.")
@@ -546,20 +536,13 @@ keybindings will not do anything useful."
546 ((when (boundp 'erc-track-when-inactive) 536 ((when (boundp 'erc-track-when-inactive)
547 (if erc-track-when-inactive 537 (if erc-track-when-inactive
548 (progn 538 (progn
549 (if (featurep 'xemacs) 539 (add-hook 'window-configuration-change-hook 'erc-user-is-active)
550 (defadvice switch-to-buffer (after erc-update-when-inactive
551 (&rest args) activate)
552 (erc-user-is-active))
553 (add-hook 'window-configuration-change-hook 'erc-user-is-active))
554 (add-hook 'erc-send-completed-hook 'erc-user-is-active) 540 (add-hook 'erc-send-completed-hook 'erc-user-is-active)
555 (add-hook 'erc-server-001-functions 'erc-user-is-active)) 541 (add-hook 'erc-server-001-functions 'erc-user-is-active))
556 (erc-track-add-to-mode-line erc-track-position-in-mode-line) 542 (erc-track-add-to-mode-line erc-track-position-in-mode-line)
557 (erc-update-mode-line) 543 (erc-update-mode-line)
558 (if (featurep 'xemacs) 544 (add-hook 'window-configuration-change-hook
559 (defadvice switch-to-buffer (after erc-update (&rest args) activate) 545 'erc-window-configuration-change)
560 (erc-modified-channels-update))
561 (add-hook 'window-configuration-change-hook
562 'erc-window-configuration-change))
563 (add-hook 'erc-insert-post-hook 'erc-track-modified-channels) 546 (add-hook 'erc-insert-post-hook 'erc-track-modified-channels)
564 (add-hook 'erc-disconnected-hook 'erc-modified-channels-update)) 547 (add-hook 'erc-disconnected-hook 'erc-modified-channels-update))
565 ;; enable the tracking keybindings 548 ;; enable the tracking keybindings
@@ -570,18 +553,13 @@ keybindings will not do anything useful."
570 (erc-track-remove-from-mode-line) 553 (erc-track-remove-from-mode-line)
571 (if erc-track-when-inactive 554 (if erc-track-when-inactive
572 (progn 555 (progn
573 (if (featurep 'xemacs) 556 (remove-hook 'window-configuration-change-hook
574 (ad-disable-advice 'switch-to-buffer 'after 557 'erc-user-is-active)
575 'erc-update-when-inactive)
576 (remove-hook 'window-configuration-change-hook
577 'erc-user-is-active))
578 (remove-hook 'erc-send-completed-hook 'erc-user-is-active) 558 (remove-hook 'erc-send-completed-hook 'erc-user-is-active)
579 (remove-hook 'erc-server-001-functions 'erc-user-is-active) 559 (remove-hook 'erc-server-001-functions 'erc-user-is-active)
580 (remove-hook 'erc-timer-hook 'erc-user-is-active)) 560 (remove-hook 'erc-timer-hook 'erc-user-is-active))
581 (if (featurep 'xemacs) 561 (remove-hook 'window-configuration-change-hook
582 (ad-disable-advice 'switch-to-buffer 'after 'erc-update) 562 'erc-window-configuration-change)
583 (remove-hook 'window-configuration-change-hook
584 'erc-window-configuration-change))
585 (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update) 563 (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update)
586 (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)) 564 (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels))
587 ;; disable the tracking keybindings 565 ;; disable the tracking keybindings
@@ -671,9 +649,7 @@ ARGS are ignored."
671 (when removed-channel 649 (when removed-channel
672 (erc-modified-channels-display))))) 650 (erc-modified-channels-display)))))
673 651
674(defvar erc-track-mouse-face (if (featurep 'xemacs) 652(defvar erc-track-mouse-face 'mode-line-highlight
675 'modeline-mousable
676 'mode-line-highlight)
677 "The face to use when mouse is over channel names in the mode line.") 653 "The face to use when mouse is over channel names in the mode line.")
678 654
679(defun erc-make-mode-line-buffer-name (string buffer &optional faces count) 655(defun erc-make-mode-line-buffer-name (string buffer &optional faces count)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 0419f3d7df6..f5c9decc3a2 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2443,11 +2443,7 @@ If STRING is nil, the function does nothing."
2443 ((null (car elt)) ; (nil PROPERTY VALUE BEG . END) 2443 ((null (car elt)) ; (nil PROPERTY VALUE BEG . END)
2444 (let ((cons (nthcdr 3 elt))) 2444 (let ((cons (nthcdr 3 elt)))
2445 (cl-incf (car cons) shift) 2445 (cl-incf (car cons) shift)
2446 (cl-incf (cdr cons) shift))) 2446 (cl-incf (cdr cons) shift))))
2447 ((and (featurep 'xemacs)
2448 (extentp (car elt))) ; (EXTENT START END)
2449 (cl-incf (nth 1 elt) shift)
2450 (cl-incf (nth 2 elt) shift)))
2451 (setq list (cdr list)))))) 2447 (setq list (cdr list))))))
2452 2448
2453(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*" 2449(defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
@@ -3498,7 +3494,6 @@ If S is non-nil, it will be used as the quit reason."
3498 3494
3499(defun erc-quit-reason-various (s) 3495(defun erc-quit-reason-various (s)
3500 "Choose a quit reason based on S (a string)." 3496 "Choose a quit reason based on S (a string)."
3501 (when (featurep 'xemacs) (require 'poe))
3502 (let ((res (car (assoc-default (or s "") 3497 (let ((res (car (assoc-default (or s "")
3503 erc-quit-reason-various-alist 'string-match)))) 3498 erc-quit-reason-various-alist 'string-match))))
3504 (cond 3499 (cond
@@ -3526,7 +3521,6 @@ If S is non-nil, it will be used as the quit reason."
3526 3521
3527(defun erc-part-reason-various (s) 3522(defun erc-part-reason-various (s)
3528 "Choose a part reason based on S (a string)." 3523 "Choose a part reason based on S (a string)."
3529 (when (featurep 'xemacs) (require 'poe))
3530 (let ((res (car (assoc-default (or s "") 3524 (let ((res (car (assoc-default (or s "")
3531 erc-part-reason-various-alist 'string-match)))) 3525 erc-part-reason-various-alist 'string-match))))
3532 (cond 3526 (cond
@@ -3627,8 +3621,7 @@ the message given by REASON."
3627 3621
3628(defun erc-cmd-SV () 3622(defun erc-cmd-SV ()
3629 "Say the current ERC and Emacs version into channel." 3623 "Say the current ERC and Emacs version into channel."
3630 (erc-send-message (format "I'm using ERC with %s %s (%s%s)%s." 3624 (erc-send-message (format "I'm using ERC with GNU Emacs %s (%s%s)%s."
3631 (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
3632 emacs-version 3625 emacs-version
3633 system-configuration 3626 system-configuration
3634 (concat 3627 (concat
@@ -3969,9 +3962,7 @@ If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
3969 (let ((minibuffer-allow-text-properties t) 3962 (let ((minibuffer-allow-text-properties t)
3970 (read-map minibuffer-local-map)) 3963 (read-map minibuffer-local-map))
3971 (insert (read-from-minibuffer "Message: " 3964 (insert (read-from-minibuffer "Message: "
3972 (string (if (featurep 'xemacs) 3965 (string last-command-event)
3973 last-command-char
3974 last-command-event))
3975 read-map)) 3966 read-map))
3976 (erc-send-current-line))) 3967 (erc-send-current-line)))
3977 3968
@@ -5766,8 +5757,6 @@ If \"l\" is pressed, `erc-set-channel-limit' gets called.
5766If \"k\" is pressed, `erc-set-channel-key' gets called. 5757If \"k\" is pressed, `erc-set-channel-key' gets called.
5767Anything else will be sent to `erc-toggle-channel-mode'." 5758Anything else will be sent to `erc-toggle-channel-mode'."
5768 (interactive "kChannel mode (RET to set more than one): ") 5759 (interactive "kChannel mode (RET to set more than one): ")
5769 (when (featurep 'xemacs)
5770 (setq key (char-to-string (event-to-character (aref key 0)))))
5771 (cond ((equal key "\C-g") 5760 (cond ((equal key "\C-g")
5772 (keyboard-quit)) 5761 (keyboard-quit))
5773 ((equal key "\C-m") 5762 ((equal key "\C-m")
@@ -6411,14 +6400,9 @@ if `erc-away' is non-nil."
6411 (funcall erc-header-line-face-method)) 6400 (funcall erc-header-line-face-method))
6412 (t 6401 (t
6413 'erc-header-line)))) 6402 'erc-header-line))))
6414 (cond ((featurep 'xemacs) 6403 (setq mode-line-buffer-identification
6415 (setq modeline-buffer-identification 6404 (list (format-spec erc-mode-line-format spec)))
6416 (list (format-spec erc-mode-line-format spec))) 6405 (setq mode-line-process (list process-status))
6417 (setq modeline-process (list process-status)))
6418 (t
6419 (setq mode-line-buffer-identification
6420 (list (format-spec erc-mode-line-format spec)))
6421 (setq mode-line-process (list process-status))))
6422 (when (boundp 'header-line-format) 6406 (when (boundp 'header-line-format)
6423 (let ((header (if erc-header-line-format 6407 (let ((header (if erc-header-line-format
6424 (format-spec erc-header-line-format spec) 6408 (format-spec erc-header-line-format spec)
@@ -6446,9 +6430,7 @@ if `erc-away' is non-nil."
6446 (if face 6430 (if face
6447 (erc-propertize header 'face face) 6431 (erc-propertize header 'face face)
6448 header))))))) 6432 header)))))))
6449 (if (featurep 'xemacs) 6433 (force-mode-line-update)))
6450 (redraw-modeline)
6451 (force-mode-line-update))))
6452 6434
6453(defun erc-update-mode-line (&optional buffer) 6435(defun erc-update-mode-line (&optional buffer)
6454 "Update the mode line in BUFFER. 6436 "Update the mode line in BUFFER.