Mercurial > emacs
comparison lisp/gnus/gnus-util.el @ 70146:2cd7cafcba54
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-238
Merge from gnus--rel--5.10
Patches applied:
* gnus--rel--5.10 (patch 87-90)
- Merge from emacs--devo--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 21 Apr 2006 05:35:31 +0000 |
parents | b4faac2800dd |
children | 59dd12493697 72dea2ff0142 |
comparison
equal
deleted
inserted
replaced
70145:00cb3fe5fed5 | 70146:2cd7cafcba54 |
---|---|
59 (autoload 'nnheader-narrow-to-headers "nnheader") | 59 (autoload 'nnheader-narrow-to-headers "nnheader") |
60 (autoload 'nnheader-replace-chars-in-string "nnheader")) | 60 (autoload 'nnheader-replace-chars-in-string "nnheader")) |
61 | 61 |
62 (eval-and-compile | 62 (eval-and-compile |
63 (cond | 63 (cond |
64 ((fboundp 'replace-in-string) | 64 ;; Prefer `replace-regexp-in-string' (present in Emacs, XEmacs 21.5, |
65 (defalias 'gnus-replace-in-string 'replace-in-string)) | 65 ;; SXEmacs 22.1.4) over `replace-in-string'. The later leads to inf-loops |
66 ;; on empty matches: | |
67 ;; (replace-in-string "foo" "/*$" "/") | |
68 ;; (replace-in-string "xe" "\\(x\\)?" "") | |
66 ((fboundp 'replace-regexp-in-string) | 69 ((fboundp 'replace-regexp-in-string) |
67 (defun gnus-replace-in-string (string regexp newtext &optional literal) | 70 (defun gnus-replace-in-string (string regexp newtext &optional literal) |
68 "Replace all matches for REGEXP with NEWTEXT in STRING. | 71 "Replace all matches for REGEXP with NEWTEXT in STRING. |
69 If LITERAL is non-nil, insert NEWTEXT literally. Return a new | 72 If LITERAL is non-nil, insert NEWTEXT literally. Return a new |
70 string containing the replacements. | 73 string containing the replacements. |
71 | 74 |
72 This is a compatibility function for different Emacsen." | 75 This is a compatibility function for different Emacsen." |
73 (replace-regexp-in-string regexp newtext string nil literal))) | 76 (replace-regexp-in-string regexp newtext string nil literal))) |
77 ((fboundp 'replace-in-string) | |
78 (defalias 'gnus-replace-in-string 'replace-in-string)) | |
74 (t | 79 (t |
75 (defun gnus-replace-in-string (string regexp newtext &optional literal) | 80 (defun gnus-replace-in-string (string regexp newtext &optional literal) |
76 "Replace all matches for REGEXP with NEWTEXT in STRING. | 81 "Replace all matches for REGEXP with NEWTEXT in STRING. |
77 If LITERAL is non-nil, insert NEWTEXT literally. Return a new | 82 If LITERAL is non-nil, insert NEWTEXT literally. Return a new |
78 string containing the replacements. | 83 string containing the replacements. |
1422 tchar)) | 1427 tchar)) |
1423 | 1428 |
1424 (defun gnus-select-frame-set-input-focus (frame) | 1429 (defun gnus-select-frame-set-input-focus (frame) |
1425 "Select FRAME, raise it, and set input focus, if possible." | 1430 "Select FRAME, raise it, and set input focus, if possible." |
1426 (cond ((featurep 'xemacs) | 1431 (cond ((featurep 'xemacs) |
1427 (raise-frame frame) | 1432 (if (fboundp 'select-frame-set-input-focus) |
1428 (select-frame frame) | 1433 (select-frame-set-input-focus frame) |
1429 (focus-frame frame)) | 1434 (raise-frame frame) |
1430 ;; The function `select-frame-set-input-focus' won't set | 1435 (select-frame frame) |
1431 ;; the input focus under Emacs 21.2 and X window system. | 1436 (focus-frame frame))) |
1432 ;;((fboundp 'select-frame-set-input-focus) | 1437 ;; `select-frame-set-input-focus' defined in Emacs 21 will not |
1433 ;; (defalias 'gnus-select-frame-set-input-focus | 1438 ;; set the input focus. |
1434 ;; 'select-frame-set-input-focus) | 1439 ((>= emacs-major-version 22) |
1435 ;; (select-frame-set-input-focus frame)) | 1440 (select-frame-set-input-focus frame)) |
1436 (t | 1441 (t |
1437 (raise-frame frame) | 1442 (raise-frame frame) |
1438 (select-frame frame) | 1443 (select-frame frame) |
1439 (cond ((and (eq window-system 'x) | 1444 (cond ((memq window-system '(x mac)) |
1440 (fboundp 'x-focus-frame)) | |
1441 (x-focus-frame frame)) | 1445 (x-focus-frame frame)) |
1442 ((eq window-system 'w32) | 1446 ((eq window-system 'w32) |
1443 (w32-focus-frame frame))) | 1447 (w32-focus-frame frame))) |
1444 (when focus-follows-mouse | 1448 (when focus-follows-mouse |
1445 (set-mouse-position frame (1- (frame-width frame)) 0))))) | 1449 (set-mouse-position frame (1- (frame-width frame)) 0))))) |