From 5843126b45d053c3d153c4157230462094a7e505 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 24 Sep 2010 07:25:37 +0000 Subject: [PATCH] Remove Emacs 21 stuff. gmm-utils.el (gmm-tool-bar-from-list): Always use tool-bar-local-item and tool-bar-local-item-from-menu. gnus-agent.el (gnus-agent-make-mode-line-string): Always use mode-line-highlight face for Emacs. gnus-art.el (toplevel): Don't bind recursive-load-depth-limit while loading gnus-sum.elc; don't autoload canlock-verify. gnus-art.el (gnus-article-jump-to-part): Use read-number. gnus-art.el (gnus-insert-mime-button, gnus-insert-mime-security-button): Remove Emacs pre-21 compatible code for help-echo. gnus-art.el (gnus-article-next-page-1): No need to adjust the number of lines. gnus-art.el (gnus-article-describe-bindings): Always use help-buffer. gnus-audio.el (gnus-audio-inline-sound): Comment fix. gnus-cus.el (gnus-custom-mode): Comment fix. gnus-group.el (gnus-group-update-tool-bar): Comment fix. gnus-sum.el (gnus-remove-overlays): Doc fix. gnus-util.el (gnus-select-frame-set-input-focus): Remove Emacs 21 compatible code. --- lisp/gnus/ChangeLog | 25 +++++++++++++++++++++++++ lisp/gnus/gmm-utils.el | 29 +++++++++-------------------- lisp/gnus/gnus-agent.el | 17 +++++++---------- lisp/gnus/gnus-art.el | 41 ++++++++++------------------------------- lisp/gnus/gnus-audio.el | 2 +- lisp/gnus/gnus-cus.el | 2 +- lisp/gnus/gnus-group.el | 2 +- lisp/gnus/gnus-sum.el | 2 +- lisp/gnus/gnus-util.el | 32 ++++++++------------------------ 9 files changed, 63 insertions(+), 89 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index c1a54e0108..b8fae31324 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,28 @@ +2010-09-24 Katsumi Yamaoka + + * gmm-utils.el (gmm-tool-bar-from-list): Always use tool-bar-local-item + and tool-bar-local-item-from-menu. + + * gnus-agent.el (gnus-agent-make-mode-line-string): Always use + mode-line-highlight face for Emacs. + + * gnus-art.el (toplevel): Don't bind recursive-load-depth-limit while + loading gnus-sum.elc; fix comment for canlock-verify. + (gnus-article-jump-to-part): Use read-number. + (gnus-insert-mime-button, gnus-insert-mime-security-button): Remove + Emacs pre-21 compatible code for help-echo. + (gnus-article-next-page-1): No need to adjust the number of lines. + (gnus-article-describe-bindings): Always use help-buffer. + + * gnus-audio.el (gnus-audio-inline-sound) + * gnus-cus.el (gnus-custom-mode) + * gnus-group.el (gnus-group-update-tool-bar): Comment fix. + + * gnus-sum.el (gnus-remove-overlays): Doc fix. + + * gnus-util.el (gnus-select-frame-set-input-focus): Remove Emacs 21 + compatible code. + 2010-09-24 Glenn Morris * message.el (message-output): Use gnus-output-to-rmail if a buffer is diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el index 533d9a951b..b76db479df 100644 --- a/lisp/gnus/gmm-utils.el +++ b/lisp/gnus/gmm-utils.el @@ -267,27 +267,16 @@ DEFAULT-MAP specifies the default key map for ICON-LIST." ;; (tool-bar-add-item ICON DEF KEY &rest PROPS) (apply 'tool-bar-add-item icon nil nil :enable nil props))) ((equal fmap t) ;; Not a menu command - (if (fboundp 'tool-bar-local-item) - (apply 'tool-bar-local-item - icon command - (intern icon) ;; reuse icon or fmap here? - tool-bar-map props) - ;; Emacs 21 compatibility: - (apply 'tool-bar-add-item - icon command - (intern icon) - props))) + (apply 'tool-bar-local-item + icon command + (intern icon) ;; reuse icon or fmap here? + tool-bar-map props)) (t ;; A menu command - (if (fboundp 'tool-bar-local-item-from-menu) - (apply 'tool-bar-local-item-from-menu - ;; (apply 'tool-bar-local-item icon def key - ;; tool-bar-map props) - command icon tool-bar-map (symbol-value fmap) - props) - ;; Emacs 21 compatibility: - (apply 'tool-bar-add-item-from-menu - command icon (symbol-value fmap) - props)))) + (apply 'tool-bar-local-item-from-menu + ;; (apply 'tool-bar-local-item icon def key + ;; tool-bar-map props) + command icon tool-bar-map (symbol-value fmap) + props))) t)) (if (symbolp icon-list) (eval icon-list) diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 2a586e627c..8112565ba5 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el @@ -606,16 +606,13 @@ manipulated as follows: (propertize string 'local-map (make-mode-line-mouse-map mouse-button mouse-func) 'mouse-face - (cond ((and (featurep 'xemacs) - ;; XEmacs' `facep' only checks for a face - ;; object, not for a face name, so it's useless - ;; to check with `facep'. - (find-face 'modeline)) - 'modeline) - ((facep 'mode-line-highlight) ;; Emacs 22 - 'mode-line-highlight) - ((facep 'mode-line) ;; Emacs 21 - 'mode-line)) ) + (if (and (featurep 'xemacs) + ;; XEmacs' `facep' only checks for a face + ;; object, not for a face name, so it's useless + ;; to check with `facep'. + (find-face 'modeline)) + 'modeline + 'mode-line-highlight)) string)) (defun gnus-agent-toggle-plugged (set-to) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 7e51abb564..d92d29d621 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -34,10 +34,7 @@ (defvar w3m-minor-mode-map) (require 'gnus) -;; Avoid the "Recursive load suspected" error in Emacs 21.1. -(eval-and-compile - (let ((recursive-load-depth-limit 100)) - (require 'gnus-sum))) +(require 'gnus-sum) (require 'gnus-spec) (require 'gnus-int) (require 'gnus-win) @@ -4259,7 +4256,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is (put-text-property (match-end 0) (point-max) 'face eface))))))))) -(autoload 'canlock-verify "canlock" nil t) ;; for Emacs 21. +(autoload 'canlock-verify "canlock" nil t) ;; for XEmacs. (defun article-verify-cancel-lock () "Verify Cancel-Lock header." @@ -4894,10 +4891,7 @@ General format specifiers can also be used. See Info node ;; FIXME: why is it necessary? (sit-for 0) (let ((parts (length gnus-article-mime-handle-alist))) - (or n (setq n - (string-to-number - (read-string ;; Emacs 21 doesn't have `read-number'. - (format "Jump to part (2..%s): " parts))))) + (or n (setq n (read-number (format "Jump to part (2..%s): " parts)))) (unless (and (integerp n) (<= n parts) (>= n 1)) (setq n (progn @@ -5681,7 +5675,7 @@ all parts." :action 'gnus-widget-press-button :button-keymap gnus-mime-button-map :help-echo - (lambda (widget/window &optional overlay pos) + (lambda (widget) ;; Needed to properly clear the message due to a bug in ;; wid-edit (XEmacs only). (if (boundp 'help-echo-owns-message) @@ -5689,14 +5683,7 @@ all parts." (format "%S: %s the MIME part; %S: more options" (aref gnus-mouse-2 0) - ;; XEmacs will get a single widget arg; Emacs 21 will get - ;; window, overlay, position. - (if (mm-handle-displayed-p - (if overlay - (with-current-buffer (gnus-overlay-buffer overlay) - (widget-get (widget-at (gnus-overlay-start overlay)) - :mime-handle)) - (widget-get widget/window :mime-handle))) + (if (mm-handle-displayed-p (widget-get widget :mime-handle)) "hide" "show") (aref gnus-down-mouse-3 0)))))) @@ -6319,15 +6306,6 @@ specifies." 2))))))) (defun gnus-article-next-page-1 (lines) - (unless (featurep 'xemacs) - ;; Protect against the bug that Emacs 21.x hangs up when scrolling up for - ;; too many number of lines if `scroll-margin' is set as two or greater. - (when (and (numberp lines) - (> lines 0) - (> scroll-margin 0)) - (setq lines (min lines - (max 0 (- (count-lines (window-start) (point-max)) - scroll-margin)))))) (condition-case () (let ((scroll-in-place nil)) (scroll-up lines)) @@ -6581,6 +6559,9 @@ KEY is a string or a vector." (defvar gnus-draft-mode) ;; Calling help-buffer will autoload help-mode. (defvar help-xref-stack-item) +;; Emacs 22 doesn't load it in the batch mode. +(eval-when-compile + (autoload 'help-buffer "help-mode")) (defun gnus-article-describe-bindings (&optional prefix) "Show a list of all defined keys, and their definitions. @@ -6631,9 +6612,7 @@ then we display only bindings that start with that prefix." (with-current-buffer ,(current-buffer) (gnus-article-describe-bindings prefix))) ,prefix))) - (with-current-buffer (if (fboundp 'help-buffer) - (let (help-xref-following) (help-buffer)) - "*Help*") ;; Emacs 21 + (with-current-buffer (let (help-xref-following) (help-buffer)) (setq help-xref-stack-item item))))) (defun gnus-article-reply-with-original (&optional wide) @@ -8702,7 +8681,7 @@ For example: :action 'gnus-widget-press-button :button-keymap gnus-mime-security-button-map :help-echo - (lambda (widget/window &optional overlay pos) + (lambda (widget) ;; Needed to properly clear the message due to a bug in ;; wid-edit (XEmacs only). (when (boundp 'help-echo-owns-message) diff --git a/lisp/gnus/gnus-audio.el b/lisp/gnus/gnus-audio.el index c89faef702..cc198176f1 100644 --- a/lisp/gnus/gnus-audio.el +++ b/lisp/gnus/gnus-audio.el @@ -39,7 +39,7 @@ (defvar gnus-audio-inline-sound (or (if (fboundp 'device-sound-enabled-p) (device-sound-enabled-p)) ; XEmacs - (fboundp 'play-sound)) ; Emacs 21 + (fboundp 'play-sound)) ; Emacs "Non-nil means try to play sounds without using an external program.") (defcustom gnus-audio-directory (nnheader-find-etc-directory "sounds") diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el index 89b893090b..838150d114 100644 --- a/lisp/gnus/gnus-cus.el +++ b/lisp/gnus/gnus-cus.el @@ -50,7 +50,7 @@ if that value is non-nil." (setq major-mode 'gnus-custom-mode mode-name "Gnus Customize") (use-local-map widget-keymap) - ;; Emacs 21 stuff: + ;; Emacs stuff: (when (and (facep 'custom-button-face) (facep 'custom-button-pressed-face)) (set (make-local-variable 'widget-button-face) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 399eb2adf4..86cdb0e89e 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -1515,7 +1515,7 @@ if it is a string, only list groups matching REGEXP." (and (not (featurep 'xemacs)) (boundp 'tool-bar-mode) tool-bar-mode - ;; Using `redraw-frame' (see `gnus-tool-bar-update') in Emacs 21 might + ;; Using `redraw-frame' (see `gnus-tool-bar-update') in Emacs might ;; be confusing, so maybe we shouldn't call it by default. (fboundp 'force-window-update)) "Force updating the group buffer tool bar." diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 622665d519..50f9b32700 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -11318,7 +11318,7 @@ If ARG is positive number, turn showing conversation threads on." (defalias 'gnus-remove-overlays 'remove-overlays) (defun gnus-remove-overlays (beg end name val) "Clear BEG and END of overlays whose property NAME has value VAL. -For compatibility with Emacs 21 and XEmacs." +For compatibility with XEmacs." (dolist (ov (gnus-overlays-in beg end)) (when (eq (gnus-overlay-get ov name) val) (gnus-delete-overlay ov)))))) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 334f0eea7d..ead48f43ce 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1661,30 +1661,14 @@ CHOICE is a list of the choice char and help message at IDX." (kill-buffer buf)) tchar)) -(declare-function x-focus-frame "xfns.c" (frame)) -(declare-function w32-focus-frame "../term/w32-win" (frame)) - -(defun gnus-select-frame-set-input-focus (frame) - "Select FRAME, raise it, and set input focus, if possible." - (cond ((featurep 'xemacs) - (if (fboundp 'select-frame-set-input-focus) - (select-frame-set-input-focus frame) - (raise-frame frame) - (select-frame frame) - (focus-frame frame))) - ;; `select-frame-set-input-focus' defined in Emacs 21 will not - ;; set the input focus. - ((>= emacs-major-version 22) - (select-frame-set-input-focus frame)) - (t - (raise-frame frame) - (select-frame frame) - (cond ((memq window-system '(x ns mac)) - (x-focus-frame frame)) - ((eq window-system 'w32) - (w32-focus-frame frame))) - (when focus-follows-mouse - (set-mouse-position frame (1- (frame-width frame)) 0))))) +(if (fboundp 'select-frame-set-input-focus) + (defalias 'gnus-select-frame-set-input-focus 'select-frame-set-input-focus) + ;; XEmacs 21.4, SXEmacs + (defun gnus-select-frame-set-input-focus (frame) + "Select FRAME, raise it, and set input focus, if possible." + (raise-frame frame) + (select-frame frame) + (focus-frame frame))) (defun gnus-frame-or-window-display-name (object) "Given a frame or window, return the associated display name. -- 2.20.1