# HG changeset patch # User Dan Nicolaescu # Date 1193714255 0 # Node ID 2ca0af23d79d9ae2e7c4b7ea65113ef1152f0a09 # Parent b63016d25aa641f13c41c08561e580deffcfcea0 * emulation/edt.el (edt-emacs19-p, edt-x-emacs19-p) (edt-gnu-emacs19-p): Remove. (edt-emacs-variant, edt-window-system): Use feature 'emacs. (edt-xserver, edt-page-backward, edt-beginning-of-line) (edt-end-of-line-forward, edt-end-of-line-backward) (edt-one-word-forward, edt-one-word-backward, edt-character) (edt-line-forward, edt-next-line, edt-previous-line, edt-top) (edt-find-forward, edt-find-backward, edt-find-next-forward) (edt-find-next-backward, edt-reset, edt-advance, edt-backup) (edt-define-key, edt-bottom-check, edt-sentence-forward) (edt-sentence-backward, edt-paragraph-forward) (edt-paragraph-backward, edt-restore-key, edt-window-top) (edt-window-bottom, edt-scroll-window-forward-line) (edt-scroll-window-backward-line, edt-line-to-bottom-of-window) (edt-line-to-top-of-window, edt-paragraph-backward) (edt-restore-key, edt-window-top, edt-window-bottom) (edt-scroll-window-forward-line) (edt-scroll-window-backward-line, edt-line-to-bottom-of-window) (edt-line-to-middle-of-window, edt-goto-percentage) (edt-display-the-time, edt-remember, edt-split-window) (edt-emulation-on, edt-emulation-off) (edt-default-emulation-setup, edt-user-emulation-setup) (edt-select-default-global-map, edt-select-user-global-map): Replace uses of edt-x-emacs19-p and edt-gnu-emacs19-p with feature tests. * textmodes/reftex-index.el (reftex-index-selection-or-word): Use feature test instead of boundp test so it can be resolved at compile time. * net/newsticker.el (replace-regexp-in-string): Only define for XEmacs. diff -r b63016d25aa6 -r 2ca0af23d79d lisp/ChangeLog --- a/lisp/ChangeLog Tue Oct 30 02:08:49 2007 +0000 +++ b/lisp/ChangeLog Tue Oct 30 03:17:35 2007 +0000 @@ -1,3 +1,38 @@ +2007-10-30 Dan Nicolaescu + + * emulation/edt.el (edt-emacs19-p, edt-x-emacs19-p) + (edt-gnu-emacs19-p): Remove. + (edt-emacs-variant, edt-window-system): Use feature 'emacs. + (edt-xserver, edt-page-backward, edt-beginning-of-line) + (edt-end-of-line-forward, edt-end-of-line-backward) + (edt-one-word-forward, edt-one-word-backward, edt-character) + (edt-line-forward, edt-next-line, edt-previous-line, edt-top) + (edt-find-forward, edt-find-backward, edt-find-next-forward) + (edt-find-next-backward, edt-reset, edt-advance, edt-backup) + (edt-define-key, edt-bottom-check, edt-sentence-forward) + (edt-sentence-backward, edt-paragraph-forward) + (edt-paragraph-backward, edt-restore-key, edt-window-top) + (edt-window-bottom, edt-scroll-window-forward-line) + (edt-scroll-window-backward-line, edt-line-to-bottom-of-window) + (edt-line-to-top-of-window, edt-paragraph-backward) + (edt-restore-key, edt-window-top, edt-window-bottom) + (edt-scroll-window-forward-line) + (edt-scroll-window-backward-line, edt-line-to-bottom-of-window) + (edt-line-to-middle-of-window, edt-goto-percentage) + (edt-display-the-time, edt-remember, edt-split-window) + (edt-emulation-on, edt-emulation-off) + (edt-default-emulation-setup, edt-user-emulation-setup) + (edt-select-default-global-map, edt-select-user-global-map): + Replace uses of edt-x-emacs19-p and edt-gnu-emacs19-p with feature + tests. + + * textmodes/reftex-index.el (reftex-index-selection-or-word): Use + feature test instead of boundp test so it can be resolved at + compile time. + + * net/newsticker.el (replace-regexp-in-string): Only define for + XEmacs. + 2007-10-30 Stefan Monnier * abbrev.el: Rename `count' and `system-flag' to :count and :system. diff -r b63016d25aa6 -r 2ca0af23d79d lisp/emulation/edt.el --- a/lisp/emulation/edt.el Tue Oct 30 02:08:49 2007 +0000 +++ b/lisp/emulation/edt.el Tue Oct 30 03:17:35 2007 +0000 @@ -321,24 +321,14 @@ ;;; ;;; o edt-emulation-on o edt-load-keys ;;; -(defconst edt-emacs19-p (not (string-lessp emacs-version "19")) - "Non-nil if we are running GNU Emacs or XEmacs version 19, or higher.") - -(defconst edt-x-emacs19-p - (and edt-emacs19-p (featurep 'xemacs)) - "Non-nil if we are running XEmacs version 19, or higher.") - -(defconst edt-gnu-emacs19-p (and edt-emacs19-p (not edt-x-emacs19-p)) - "Non-nil if we are running GNU Emacs version 19, or higher.") - -(defconst edt-emacs-variant (if edt-gnu-emacs19-p "gnu" "xemacs") +(defconst edt-emacs-variant (if (featurep 'emacs) "gnu" "xemacs") "Indicates Emacs variant: GNU Emacs or XEmacs \(aka Lucid Emacs\).") -(defconst edt-window-system (if edt-gnu-emacs19-p window-system (console-type)) +(defconst edt-window-system (if (featurep 'emacs) window-system (console-type)) "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).") (defconst edt-xserver (if (eq edt-window-system 'x) - (if edt-x-emacs19-p + (if (featurep 'xemacs) ;; The Cygwin window manager has a `/' in its ;; name, which breaks the generated file name of ;; the custom key map file. Replace `/' with a @@ -409,7 +399,7 @@ (progn (backward-page num) (edt-line-to-top-of-window) - (if edt-x-emacs19-p (setq zmacs-region-stays t))))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))))) (defun edt-page (num) "Move in current direction to next page delimiter. @@ -470,7 +460,7 @@ (setq num (1- num)) (forward-line (* -1 num)))) (edt-top-check beg num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; @@ -486,7 +476,7 @@ (forward-char) (end-of-line num) (edt-bottom-check beg num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-end-of-line-backward (num) @@ -497,7 +487,7 @@ (let ((beg (edt-current-line))) (end-of-line (1- num)) (edt-top-check beg num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-end-of-line (num) @@ -542,7 +532,7 @@ (eq ?\ (char-syntax (following-char))) (not (memq (following-char) edt-word-entities))) (forward-char)))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-one-word-backward () "Move backward to first character of previous word." @@ -566,7 +556,7 @@ (not (eq ?\ (char-syntax (preceding-char)))) (not (memq (preceding-char) edt-word-entities))) (backward-char))))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-word-forward (num) "Move forward to first character of next word. @@ -606,7 +596,7 @@ (if (equal edt-direction-string edt-forward-string) (forward-char num) (backward-char num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; LINE @@ -629,7 +619,7 @@ (let ((beg (edt-current-line))) (forward-line num) (edt-bottom-check beg num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-line (num) "Move in current direction to next beginning of line mark. @@ -651,7 +641,7 @@ (let ((beg (edt-current-line))) (forward-line num) (edt-bottom-check beg num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-previous-line (num) "Move cursor up one line. @@ -661,7 +651,7 @@ (let ((beg (edt-current-line))) (forward-line (- num)) (edt-top-check beg num)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; @@ -672,7 +662,7 @@ "Move cursor to the beginning of buffer." (interactive) (goto-char (point-min)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; BOTTOM @@ -718,7 +708,7 @@ (recenter (- left bottom-up-margin)))) (t (and (> (point) bottom) (recenter bottom-margin))))))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-find-backward (&optional find) "Find first occurrence of a string in the backward direction and save it. @@ -743,7 +733,7 @@ (if (search-backward edt-find-last-text) (edt-set-match)) (and (< (point) top) (recenter (min beg top-margin)))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-find () "Find first occurrence of string in current direction and save it." @@ -789,7 +779,7 @@ (progn (backward-char 1) (error "Search failed: \"%s\"" edt-find-last-text)))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-find-next-backward () "Find next occurrence of a string in backward direction." @@ -813,7 +803,7 @@ (progn (edt-set-match) (and (< (point) top) (recenter (min beg top-margin)))))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-find-next () "Find next occurrence of a string in current direction." @@ -891,7 +881,7 @@ (defun edt-reset () "Cancel text selection." (interactive) - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (deactivate-mark) (zmacs-deactivate-region))) @@ -1108,7 +1098,7 @@ (if (string-equal " *Minibuf" (substring (buffer-name) 0 (min (length (buffer-name)) 9))) (exit-minibuffer)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; @@ -1124,7 +1114,7 @@ (if (string-equal " *Minibuf" (substring (buffer-name) 0 (min (length (buffer-name)) 9))) (exit-minibuffer)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; @@ -1174,12 +1164,12 @@ The current key definition is saved in `edt-last-replaced-key-definition'. Use `edt-restore-key' to restore last replaced key definition." (interactive) - (if edt-x-emacs19-p (setq zmacs-region-stays t)) + (if (featurep 'xemacs) (setq zmacs-region-stays t)) (let (edt-function edt-key-definition) (setq edt-key-definition (read-key-sequence "Press the key to be defined: ")) - (if (if edt-gnu-emacs19-p + (if (if (featurep 'emacs) (string-equal "\C-m" edt-key-definition) (string-equal "\C-m" (events-to-keys edt-key-definition))) (message "Key not defined") @@ -1259,7 +1249,7 @@ ;; subtract 1 from height because it includes mode line (difference (- height margin 1))) (cond ((> beg difference) (recenter beg)) - ((and edt-x-emacs19-p (> (+ beg lines 1) difference)) + ((and (featurep 'xemacs) (> (+ beg lines 1) difference)) (recenter (- margin))) ((> (+ beg lines) difference) (recenter (- margin)))))) @@ -1363,7 +1353,7 @@ (recenter (- left bottom-up-margin)))) (t (and (> (point) bottom) (recenter bottom-margin))))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-sentence-backward (num) "Move backward to next sentence beginning. @@ -1389,7 +1379,7 @@ (error "End of buffer")) (backward-sentence num)) (and (< (point) top) (recenter (min beg top-margin)))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-sentence (num) "Move in current direction to next sentence. @@ -1434,7 +1424,7 @@ (recenter (- left bottom-up-margin)))) (t (and (> (point) bottom) (recenter bottom-margin))))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-paragraph-backward (num) "Move backward to beginning of paragraph. @@ -1459,7 +1449,7 @@ (start-of-paragraph-text) (setq num (1- num))) (and (< (point) top) (recenter (min beg top-margin)))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-paragraph (num) "Move in current direction to next paragraph. @@ -1477,20 +1467,20 @@ "Restore last replaced key definition. Definition is stored in `edt-last-replaced-key-definition'." (interactive) - (if edt-x-emacs19-p (setq zmacs-region-stays t)) + (if (featurep 'xemacs) (setq zmacs-region-stays t)) (if edt-last-replaced-key-definition (progn (let (edt-key-definition) (set 'edt-key-definition (read-key-sequence "Press the key to be restored: ")) - (if (if edt-gnu-emacs19-p + (if (if (featurep 'emacs) (string-equal "\C-m" edt-key-definition) (string-equal "\C-m" (events-to-keys edt-key-definition))) (message "Key not restored") (progn (define-key (current-global-map) edt-key-definition edt-last-replaced-key-definition) - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (message "Key definition for %s has been restored." edt-key-definition) (message "Key definition for %s has been restored." @@ -1507,7 +1497,7 @@ (let ((start-column (current-column))) (move-to-window-line 0) (move-to-column start-column)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; WINDOW BOTTOM @@ -1519,7 +1509,7 @@ (let ((start-column (current-column))) (move-to-window-line (- (window-height) 2)) (move-to-column start-column)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; SCROLL WINDOW LINE @@ -1529,13 +1519,13 @@ "Move window forward one line leaving cursor at position in window." (interactive) (scroll-up 1) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-scroll-window-backward-line () "Move window backward one line leaving cursor at position in window." (interactive) (scroll-down 1) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) (defun edt-scroll-line () "Move window one line in current direction." @@ -1582,7 +1572,7 @@ "Move the current line to the bottom of the window." (interactive) (recenter -1) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; LINE TO TOP OF WINDOW @@ -1592,7 +1582,7 @@ "Move the current line to the top of the window." (interactive) (recenter 0) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; LINE TO MIDDLE OF WINDOW @@ -1602,7 +1592,7 @@ "Move window so line with cursor is in the middle of the window." (interactive) (recenter '(4)) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; GOTO PERCENTAGE @@ -1615,7 +1605,7 @@ (if (or (> num 100) (< num 0)) (error "Percentage %d out of range 0 < percent < 100" num) (goto-char (/ (* (point-max) num) 100))) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; FILL REGION @@ -1785,7 +1775,7 @@ (defun edt-display-the-time () "Display the current time." (interactive) - (if edt-x-emacs19-p (setq zmacs-region-stays t)) + (if (featurep 'xemacs) (setq zmacs-region-stays t)) (message "%s" (current-time-string))) ;;; @@ -1813,7 +1803,7 @@ (let (edt-key-definition) (set 'edt-key-definition (read-key-sequence "Enter key for binding: ")) - (if (if edt-gnu-emacs19-p + (if (if (featurep 'emacs) (string-equal "\C-m" edt-key-definition) (string-equal "\C-m" (events-to-keys edt-key-definition))) (message "Key sequence not remembered") @@ -1866,7 +1856,7 @@ (interactive) (split-window) (other-window 1) - (if edt-x-emacs19-p (setq zmacs-region-stays t))) + (if (featurep 'xemacs) (setq zmacs-region-stays t))) ;;; ;;; COPY RECTANGLE @@ -2152,7 +2142,7 @@ (setq edt-term term)))) (edt-load-keys nil)) ;; Make highlighting of selected text work properly for EDT commands. - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (progn (setq edt-orig-transient-mark-mode transient-mark-mode) (add-hook 'activate-mark-hook @@ -2188,7 +2178,7 @@ (setq edt-select-mode-current nil) (edt-reset) (force-mode-line-update t) - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (setq transient-mark-mode edt-orig-transient-mark-mode)) (message "Original key bindings restored; EDT Emulation disabled")) @@ -2203,7 +2193,7 @@ ;; disturbing the original bindings in global-map. (fset 'edt-default-ESC-prefix (copy-keymap 'ESC-prefix)) (setq edt-default-global-map (copy-keymap (current-global-map))) - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix) (define-key edt-default-global-map [escape] 'edt-default-ESC-prefix)) (define-prefix-command 'edt-default-gold-map) @@ -2239,7 +2229,7 @@ ;; Setup user EDT global map by copying default EDT global map bindings. (fset 'edt-user-ESC-prefix (copy-keymap 'edt-default-ESC-prefix)) (setq edt-user-global-map (copy-keymap edt-default-global-map)) - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix) (define-key edt-user-global-map [escape] 'edt-user-ESC-prefix)) ;; If terminal has additional function keys, the user's initialization @@ -2253,7 +2243,7 @@ (defun edt-select-default-global-map() "Select default EDT emulation key bindings." (interactive) - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (transient-mark-mode 1)) (use-global-map edt-default-global-map) (if (not edt-keep-current-page-delimiter) @@ -2271,7 +2261,7 @@ (interactive) (if edt-user-map-configured (progn - (if edt-gnu-emacs19-p + (if (featurep 'emacs) (transient-mark-mode 1)) (use-global-map edt-user-global-map) (if (not edt-keep-current-page-delimiter) diff -r b63016d25aa6 -r 2ca0af23d79d lisp/net/newsticker.el --- a/lisp/net/newsticker.el Tue Oct 30 02:08:49 2007 +0000 +++ b/lisp/net/newsticker.el Tue Oct 30 03:17:35 2007 +0000 @@ -1199,10 +1199,11 @@ (unless (fboundp 'match-string-no-properties) (defalias 'match-string-no-properties 'match-string)) -(unless (fboundp 'replace-regexp-in-string) - (defun replace-regexp-in-string (re rp st) - (save-match-data ;; apparently XEmacs needs save-match-data - (replace-in-string st re rp)))) +(when (featurep 'xemacs) + (unless (fboundp 'replace-regexp-in-string) + (defun replace-regexp-in-string (re rp st) + (save-match-data ;; apparently XEmacs needs save-match-data + (replace-in-string st re rp))))) ;; copied from subr.el (unless (fboundp 'add-to-invisibility-spec) diff -r b63016d25aa6 -r 2ca0af23d79d lisp/textmodes/reftex-index.el --- a/lisp/textmodes/reftex-index.el Tue Oct 30 02:08:49 2007 +0000 +++ b/lisp/textmodes/reftex-index.el Tue Oct 30 03:17:35 2007 +0000 @@ -52,7 +52,7 @@ (interactive "P") (let* ((use-default (not (equal arg '(16)))) ; check for double prefix ;; check if we have an active selection - (active (if (boundp 'zmacs-regions) + (active (if (featurep 'xemacs) (and zmacs-regions (region-exists-p)) ; XEmacs (and transient-mark-mode mark-active))) ; Emacs (beg (if active