diff options
| author | Eric M. Ludlam | 1998-01-23 02:14:02 +0000 |
|---|---|---|
| committer | Eric M. Ludlam | 1998-01-23 02:14:02 +0000 |
| commit | 03c9127e39529442c8ef8b75dc4ece02417cc98e (patch) | |
| tree | 691ef009d37e264e3c5c9715a87fd283abbef6f4 /lisp | |
| parent | e9a918f970f20a7560d1b0e534ec1f963cd3ed3a (diff) | |
| download | emacs-03c9127e39529442c8ef8b75dc4ece02417cc98e.tar.gz emacs-03c9127e39529442c8ef8b75dc4ece02417cc98e.zip | |
Added speedbar support for RMAIL files.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/mail/rmail.el | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index e24698351cb..f2ecae58097 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -2985,6 +2985,89 @@ This has an effect only if a summary buffer exists." | |||
| 2985 | (font-lock-fontify-region (point-min) (point-max)) | 2985 | (font-lock-fontify-region (point-min) (point-max)) |
| 2986 | (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil))))))) | 2986 | (and (not modified) (buffer-modified-p) (set-buffer-modified-p nil))))))) |
| 2987 | 2987 | ||
| 2988 | ;;; Speedbar support for RMAIL files. | ||
| 2989 | (eval-when-compile (require 'speedbspec)) | ||
| 2990 | |||
| 2991 | (defvar rmail-speedbar-last-user nil | ||
| 2992 | "The last user to be displayed in the speedbar.") | ||
| 2993 | |||
| 2994 | (defvar rmail-speedbar-menu-items | ||
| 2995 | '(["Browse Item On Line" speedbar-edit-line t] | ||
| 2996 | ["Move message to folder" rmail-move-message-to-folder-on-line | ||
| 2997 | (save-excursion (beginning-of-line) | ||
| 2998 | (looking-at "<M> "))]) | ||
| 2999 | "Additional menu-items to add to speedbar frame.") | ||
| 3000 | |||
| 3001 | (defun rmail-speedbar-buttons (buffer) | ||
| 3002 | "Create buttons for BUFFER containing rmail messages. | ||
| 3003 | Click on the address under Reply to: to reply to this person. | ||
| 3004 | Under Folders: Click a name to read it, or on the <M> to move the | ||
| 3005 | current message into that RMAIL folder." | ||
| 3006 | (let ((from nil)) | ||
| 3007 | (save-excursion | ||
| 3008 | (set-buffer buffer) | ||
| 3009 | (goto-char (point-min)) | ||
| 3010 | (if (not (re-search-forward "^Reply-To: " nil t)) | ||
| 3011 | (if (not (re-search-forward "^From:? " nil t)) | ||
| 3012 | (setq from t))) | ||
| 3013 | (if from | ||
| 3014 | nil | ||
| 3015 | (setq from (buffer-substring (point) (save-excursion | ||
| 3016 | (end-of-line) | ||
| 3017 | (point)))))) | ||
| 3018 | (goto-char (point-min)) | ||
| 3019 | (if (and (looking-at "Reply to:") | ||
| 3020 | (equal from rmail-speedbar-last-user)) | ||
| 3021 | nil | ||
| 3022 | (setq rmail-speedbar-last-user from) | ||
| 3023 | (erase-buffer) | ||
| 3024 | (insert "Reply To:\n") | ||
| 3025 | (if (stringp from) | ||
| 3026 | (speedbar-insert-button from 'speedbar-directory-face 'highlight | ||
| 3027 | 'rmail-speedbar-button 'rmail-reply)) | ||
| 3028 | (insert "Folders:\n") | ||
| 3029 | (let* ((case-fold-search nil) | ||
| 3030 | (df (directory-files (save-excursion (set-buffer buffer) | ||
| 3031 | default-directory) | ||
| 3032 | nil "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"))) | ||
| 3033 | (while df | ||
| 3034 | (speedbar-insert-button "<M>" 'speedbar-button-face 'highlight | ||
| 3035 | 'rmail-speedbar-move-message (car df)) | ||
| 3036 | (speedbar-insert-button (car df) 'speedbar-file-face 'highlight | ||
| 3037 | 'rmail-speedbar-find-file nil t) | ||
| 3038 | (setq df (cdr df))))))) | ||
| 3039 | |||
| 3040 | (defun rmail-speedbar-button (text token indent) | ||
| 3041 | "Execute an rmail command specified by TEXT. | ||
| 3042 | The command used is TOKEN. INDENT is not used." | ||
| 3043 | (speedbar-with-attached-buffer | ||
| 3044 | (funcall token t))) | ||
| 3045 | |||
| 3046 | (defun rmail-speedbar-find-file (text token indent) | ||
| 3047 | "Load in the rmail file TEXT. | ||
| 3048 | TOKEN and INDENT are not used." | ||
| 3049 | (speedbar-with-attached-buffer | ||
| 3050 | (message "Loading in RMAIL file %s..." text) | ||
| 3051 | (find-file text))) | ||
| 3052 | |||
| 3053 | (defun rmail-move-message-to-folder-on-line () | ||
| 3054 | "If the current line is a folder, move current message to it." | ||
| 3055 | (interactive) | ||
| 3056 | (save-excursion | ||
| 3057 | (beginning-of-line) | ||
| 3058 | (if (re-search-forward "<M> " (save-excursion (end-of-line) (point)) t) | ||
| 3059 | (progn | ||
| 3060 | (forward-char -2) | ||
| 3061 | (speedbar-do-function-pointer))))) | ||
| 3062 | |||
| 3063 | (defun rmail-speedbar-move-message (text token indent) | ||
| 3064 | "From button TEXT, copy current message to the rmail file specified by TOKEN. | ||
| 3065 | TEXT and INDENT are not used." | ||
| 3066 | (speedbar-with-attached-buffer | ||
| 3067 | (message "Moving message to %s" token) | ||
| 3068 | (rmail-output-to-rmail-file token))) | ||
| 3069 | |||
| 3070 | |||
| 2988 | (provide 'rmail) | 3071 | (provide 'rmail) |
| 2989 | 3072 | ||
| 2990 | ;;; rmail.el ends here | 3073 | ;;; rmail.el ends here |