]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/rmail.el
* mail/reporter.el (reporter-submit-bug-report): Handle missing package-name.
[gnu-emacs] / lisp / mail / rmail.el
index a05cd342862544dc27581646311e3a66e60444a9..e29becedb6e4c2035901d4061115e27d634d30a5 100644 (file)
@@ -1085,6 +1085,7 @@ The buffer is expected to be narrowed to just the header of the message."
     (define-key map "<"      'rmail-first-message)
     (define-key map ">"      'rmail-last-message)
     (define-key map " "      'scroll-up-command)
+    (define-key map [?\S-\ ] 'scroll-down-command)
     (define-key map "\177"   'scroll-down-command)
     (define-key map "?"      'describe-mode)
     (define-key map "\C-c\C-s\C-d" 'rmail-sort-by-date)
@@ -1507,6 +1508,8 @@ If so restore the actual mbox message collection."
   (setq file-precious-flag t)
   (make-local-variable 'desktop-save-buffer)
   (setq desktop-save-buffer t)
+  (make-local-variable 'save-buffer-coding-system)
+  (setq save-buffer-coding-system 'no-conversion)
   (setq next-error-move-function 'rmail-next-error-move))
 \f
 ;; Handle M-x revert-buffer done in an rmail-mode buffer.
@@ -2173,20 +2176,35 @@ If MSGNUM is nil, use the current message."
 
 (defun rmail-set-header-1 (name value)
   "Subroutine of `rmail-set-header'.
-Narrow to header, set header NAME to VALUE, replacing existing if present.
-VALUE nil means to remove NAME altogether."
+Narrow to headers, set header NAME to VALUE, replacing existing if present.
+VALUE nil means to remove NAME altogether.
+
+Only changes the first instance of NAME.  If VALUE is multi-line,
+continuation lines should already be indented.  VALUE should not
+end in a newline."
   (if (search-forward "\n\n" nil t)
       (progn
        (forward-char -1)
        (narrow-to-region (point-min) (point))
+       ;; cf mail-fetch-field.
        (goto-char (point-min))
-       (if (re-search-forward (concat "^" (regexp-quote name) ":") nil 'move)
+       (if (let ((case-fold-search t))
+             (re-search-forward (concat "^" (regexp-quote name) "[ \t]*:")
+                                nil 'move))
+           (let ((start (point))
+                 end)
+             (while (and (zerop (forward-line 1))
+                         (looking-at "[ \t]")))
+             ;; Back up over newline.
+             (forward-char -1)
+             (setq end (point))
+             (goto-char start)
             (if value
                 (progn
-                  (delete-region (point) (line-end-position))
+                   (delete-region start end)
                   (insert " " value))
-              (delete-region (line-beginning-position)
-                             (line-beginning-position 2)))
+               (delete-region (line-beginning-position) (1+ end))))
+         ;; Not already present: insert at end of headers.
           (if value (insert name ": " value "\n"))))
     (rmail-error-bad-format)))
 
@@ -4087,6 +4105,9 @@ The message should be narrowed to just the headers."
 
 (autoload 'mail-position-on-field "sendmail")
 
+(declare-function rmail-mime-message-p "rmailmm" ())
+(declare-function rmail-mime-toggle-raw "rmailmm" (&optional state))
+
 (defun rmail-retry-failure ()
   "Edit a mail message which is based on the contents of the current message.
 For a message rejected by the mail system, extract the interesting headers and
@@ -4099,7 +4120,13 @@ The variable `rmail-retry-ignored-headers' is a regular expression
 specifying headers which should not be copied into the new message."
   (interactive)
   (require 'mail-utils)
-  (if rmail-enable-mime
+  ;; FIXME This does not handle rmail-mime-feature != 'rmailmm.
+  ;; There is no API defined for rmail-mime-feature to provide
+  ;; rmail-mime-message-p, rmail-mime-toggle-raw equivalents.
+  ;; But does anyone actually use rmail-mime-feature != 'rmailmm?
+  (if (and rmail-enable-mime
+          (eq rmail-mime-feature 'rmailmm)
+          (featurep rmail-mime-feature))
       (with-current-buffer rmail-buffer
        (if (rmail-mime-message-p)
            (let ((rmail-mime-mbox-buffer rmail-view-buffer)
@@ -4283,8 +4310,6 @@ This has an effect only if a summary buffer exists."
                  (restore-buffer-modified-p nil)))))))
 \f
 ;;; Speedbar support for RMAIL files.
-(eval-when-compile (require 'speedbar))
-
 (defcustom rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"
   "Regexp matching Rmail folder names to be displayed in Speedbar.
 Enabling this permits Speedbar to display your folders for easy
@@ -4299,12 +4324,12 @@ browsing, and moving of messages."
 (defvar rmail-speedbar-key-map nil
   "Keymap used when in rmail display mode.")
 
+(declare-function speedbar-make-specialized-keymap "speedbar" ())
+
 (defun rmail-install-speedbar-variables ()
   "Install those variables used by speedbar to enhance rmail."
-  (if rmail-speedbar-key-map
-      nil
+  (unless rmail-speedbar-key-map
     (setq rmail-speedbar-key-map (speedbar-make-specialized-keymap))
-
     (define-key rmail-speedbar-key-map "e" 'speedbar-edit-line)
     (define-key rmail-speedbar-key-map "r" 'speedbar-edit-line)
     (define-key rmail-speedbar-key-map "\C-m" 'speedbar-edit-line)
@@ -4319,6 +4344,9 @@ browsing, and moving of messages."
                     (looking-at "<M> "))])
   "Additional menu-items to add to speedbar frame.")
 
+(declare-function speedbar-insert-button "speedbar"
+                 (text face mouse function &optional token prevline))
+
 ;; Make sure our special speedbar major mode is loaded
 (if (featurep 'speedbar)
     (rmail-install-speedbar-variables)
@@ -4360,19 +4388,27 @@ current message into that RMAIL folder."
            (speedbar-insert-button file 'speedbar-file-face 'highlight
                                    'rmail-speedbar-find-file nil t)))))))
 
+(eval-when-compile (require 'dframe))
+;; Part of the macro expansion of dframe-with-attached-buffer.
+;; At runtime, will be pulled in as a require of speedbar.
+(declare-function dframe-select-attached-frame "dframe" (&optional frame))
+(declare-function dframe-maybee-jump-to-attached-frame "dframe" ())
+
 (defun rmail-speedbar-button (text token indent)
   "Execute an rmail command specified by TEXT.
 The command used is TOKEN.  INDENT is not used."
-  (speedbar-with-attached-buffer
+  (dframe-with-attached-buffer
    (funcall token t)))
 
 (defun rmail-speedbar-find-file (text token indent)
   "Load in the rmail file TEXT.
 TOKEN and INDENT are not used."
-  (speedbar-with-attached-buffer
+  (dframe-with-attached-buffer
    (message "Loading in RMAIL file %s..." text)
    (rmail text)))
 
+(declare-function speedbar-do-function-pointer "speedbar" ())
+
 (defun rmail-speedbar-move-message-to-folder-on-line ()
   "If the current line is a folder, move current message to it."
   (interactive)
@@ -4386,7 +4422,7 @@ TOKEN and INDENT are not used."
 (defun rmail-speedbar-move-message (text token indent)
   "From button TEXT, copy current message to the rmail file specified by TOKEN.
 TEXT and INDENT are not used."
-  (speedbar-with-attached-buffer
+  (dframe-with-attached-buffer
    (message "Moving message to %s" token)
    ;; expand-file-name is needed due to the unhelpful way in which
    ;; rmail-output expands non-absolute filenames against rmail-default-file.
@@ -4632,7 +4668,7 @@ With prefix argument N moves forward N messages with these labels.
 
 ;;;***
 \f
-;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "1f33964668345a1a1f3119fece148227")
+;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "93951f748e43e1015da1b485088970ca")
 ;;; Generated autoloads from rmailmm.el
 
 (autoload 'rmail-mime "rmailmm" "\
@@ -4734,7 +4770,7 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
 \f
 ;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic
 ;;;;;;  rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels
-;;;;;;  rmail-summary) "rmailsum" "rmailsum.el" "341825201e892b8fc875c1ae49ffd560")
+;;;;;;  rmail-summary) "rmailsum" "rmailsum.el" "61e7ad0931be1e07034dd57825ff326a")
 ;;; Generated autoloads from rmailsum.el
 
 (autoload 'rmail-summary "rmailsum" "\