Mercurial > emacs
view lisp/gnus/gnus-move.el @ 67969:3ca8b2234237
* mh-customize.el: Sync docstrings with manual for faces and sort them
alphabetically.
(mh-faces): Move below mh-hooks. (mh-folder-faces, mh-index-faces,
mh-letter-faces)
(mh-show-faces, mh-speed-faces): Delete. Organize faces like hooks.
(mh-speed-update-interval): Fix group (mh-speedbar, not mh-speed).
(facemenu-unlisted-faces): Might as well ignore all MH-E faces.
(mh-folder-body-face, mh-folder-cur-msg-face)
(mh-folder-cur-msg-number-face, mh-folder-date-face)
(mh-folder-followup-face, mh-folder-msg-number-face)
(mh-folder-deleted-face, mh-folder-refiled-face)
(mh-folder-subject-face, mh-folder-address-face)
(mh-folder-scan-format-face, mh-folder-to-face) (mh-index-folder-face,
mh-show-cc-face, mh-show-date-face) (mh-show-header-face,
mh-show-pgg-good-face) (mh-show-pgg-unknown-face,
mh-show-pgg-bad-face)
(mh-show-to-face, mh-show-from-face, mh-show-subject-face): Delete.
(mh-folder-cur-msg): Unused. Delete.
(mh-folder-address): Use defface; inherit from mh-folder-subject.
(mh-folder-body, mh-folder-cur-msg-number, mh-folder-date): Inherit
from mh-folder-msg-number.
(mh-folder-deleted): Use defface. Inherit from mh-folder-msg-number.
(mh-folder-sent-to-me-hint): New face. Inherit from mh-folder-date.
(mh-folder-sent-to-me-sender): Rename from mh-folder-scan-format. Use
defface. Inherit from mh-folder-followup.
(mh-show-xface): Inherit from mh-show-from and highlight.
(bw-face-generation, bw-toggle-faces)
(bw-new-face-to-old, bw-old-face-to-new): New (tempoarary) variables,
functions for toggling between old and new faces.
* mh-e.el (font-lock-auto-fontify, font-lock-defaults): Hide in
eval-when-compile. We should probably do this throughout.
(mh-scan-good-msg-regexp, mh-scan-deleted-msg-regexp)
(mh-scan-refiled-msg-regexp, mh-scan-cur-msg-number-regexp)
(mh-scan-date-regexp, mh-scan-rcpt-regexp, mh-scan-body-regexp)
(mh-scan-subject-regexp): Sync docstrings with manual
(mh-scan-format-regexp): Rename to mh-scan-sent-to-me-sender-regexp.
Drop date parenthesized expression. Make expression more like the
others (anchored at the beginning of line). Sync docstrings with
manual.
(mh-folder-font-lock-keywords): Use faces directly rather than -face
variables. Use mh-scan-sent-to-me-sender-regexp instead of
mh-scan-format-regexp, and within that expression, use faces
mh-folder-sent-to-me-hint and mh-folder-sent-to-me-sender instead of
mh-folder-date-face and mh-folder-scan-format-face which were
misleading.
* mh-mime.el (mh-mime-security-button-face): Use faces directly rather
than -face variables.
* mh-utils.el (mh-show-font-lock-keywords): Use faces directly rather
than -face variables.
(mh-face-foreground-compat, mh-face-background-compat): New macros.
(mh-face-display-function): Use mh-face-foreground-compat and
mh-face-background-compat to use inherited attributes of mh-show-xface
on Emacs 22 while still working on Emacs 21.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Sun, 01 Jan 2006 18:51:18 +0000 |
parents | fafd692d1e40 |
children | 1077b8039c32 2d92f5c9d6ae |
line wrap: on
line source
;;; gnus-move.el --- commands for moving Gnus from one server to another ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, ;; 2005 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> ;; Keywords: news ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;;; Code: (eval-when-compile (require 'cl)) (require 'gnus) (require 'gnus-start) (require 'gnus-int) (require 'gnus-range) ;;; ;;; Moving by comparing Message-ID's. ;;; ;;;###autoload (defun gnus-change-server (from-server to-server) "Move from FROM-SERVER to TO-SERVER. Update the .newsrc.eld file to reflect the change of nntp server." (interactive (list gnus-select-method (gnus-read-method "Move to method: "))) ;; First start Gnus. (let ((gnus-activate-level 0) (mail-sources nil) (nnmail-spool-file nil)) (gnus)) (save-excursion ;; Go through all groups and translate. (let ((newsrc gnus-newsrc-alist) (nntp-nov-gap nil) info) (while (setq info (pop newsrc)) (when (gnus-group-native-p (gnus-info-group info)) (gnus-move-group-to-server info from-server to-server)))))) (defun gnus-move-group-to-server (info from-server to-server) "Move group INFO from FROM-SERVER to TO-SERVER." (let ((group (gnus-info-group info)) to-active hashtb type mark marks to-article to-reads to-marks article act-articles) (gnus-message 7 "Translating %s..." group) (when (gnus-request-group group nil to-server) (setq to-active (gnus-parse-active) hashtb (gnus-make-hashtable 1024) act-articles (gnus-uncompress-range to-active)) ;; Fetch the headers from the `to-server'. (when (and to-active act-articles (setq type (gnus-retrieve-headers act-articles group to-server))) ;; Convert HEAD headers. I don't care. (when (eq type 'headers) (nnvirtual-convert-headers)) ;; Create a mapping from Message-ID to article number. (set-buffer nntp-server-buffer) (goto-char (point-min)) (while (looking-at "^[0-9]+\t[^\t]*\t[^\t]*\t[^\t]*\t\\([^\t]*\\)\t") (gnus-sethash (buffer-substring (match-beginning 1) (match-end 1)) (read (current-buffer)) hashtb) (forward-line 1)) ;; Then we read the headers from the `from-server'. (when (and (gnus-request-group group nil from-server) (gnus-active group) (gnus-uncompress-range (gnus-active group)) (setq type (gnus-retrieve-headers (gnus-uncompress-range (gnus-active group)) group from-server))) ;; Make it easier to map marks. (let ((mark-lists (gnus-info-marks info)) ms type m) (while mark-lists (setq type (caar mark-lists) ms (gnus-uncompress-range (cdr (pop mark-lists)))) (while ms (if (setq m (assq (car ms) marks)) (setcdr m (cons type (cdr m))) (push (list (car ms) type) marks)) (pop ms)))) ;; Convert. (when (eq type 'headers) (nnvirtual-convert-headers)) ;; Go through the headers and map away. (set-buffer nntp-server-buffer) (goto-char (point-min)) (while (looking-at "^[0-9]+\t[^\t]*\t[^\t]*\t[^\t]*\t\\([^\t]*\\)\t") (when (setq to-article (gnus-gethash (buffer-substring (match-beginning 1) (match-end 1)) hashtb)) ;; Add this article to the list of read articles. (push to-article to-reads) ;; See if there are any marks and then add them. (when (setq mark (assq (read (current-buffer)) marks)) (setq marks (delq mark marks)) (setcar mark to-article) (push mark to-marks)) (forward-line 1))) ;; Now we know what the read articles are and what the ;; article marks are. We transform the information ;; into the Gnus info format. (setq to-reads (gnus-range-add (gnus-compress-sequence (and (setq to-reads (delq nil to-reads)) (sort to-reads '<)) t) (cons 1 (1- (car to-active))))) (gnus-info-set-read info to-reads) ;; Do the marks. I'm sure y'all understand what's ;; going on down below, so I won't bother with any ;; further comments. <duck> (let ((mlists gnus-article-mark-lists) lists ms a) (while mlists (push (list (cdr (pop mlists))) lists)) (while (setq ms (pop marks)) (setq article (pop ms)) (while ms (setcdr (setq a (assq (pop ms) lists)) (cons article (cdr a))))) (setq a lists) (while a (setcdr (car a) (gnus-compress-sequence (and (cdar a) (sort (cdar a) '<)))) (pop a)) (gnus-info-set-marks info lists t))))) (gnus-message 7 "Translating %s...done" group))) (defun gnus-group-move-group-to-server (info from-server to-server) "Move the group on the current line from FROM-SERVER to TO-SERVER." (interactive (let ((info (gnus-get-info (gnus-group-group-name)))) (list info (gnus-find-method-for-group (gnus-info-group info)) (gnus-read-method (format "Move group %s to method: " (gnus-info-group info)))))) (save-excursion (gnus-move-group-to-server info from-server to-server) ;; We have to update the group info to point use the right server. (gnus-info-set-method info to-server t) ;; We also have to change the name of the group and stuff. (let* ((group (gnus-info-group info)) (new-name (gnus-group-prefixed-name (gnus-group-real-name group) to-server))) (gnus-info-set-group info new-name) (gnus-sethash new-name (gnus-gethash group gnus-newsrc-hashtb) gnus-newsrc-hashtb) (gnus-sethash group nil gnus-newsrc-hashtb)))) (provide 'gnus-move) ;;; arch-tag: 503742b8-7d66-4d79-bb31-4a698070707b ;;; gnus-move.el ends here