]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/rmail.el
Calc: Update mode line after change mode
[gnu-emacs] / lisp / mail / rmail.el
index 5464c38af76fce98e59a41c0c35e055d88c9e707..e9882253c70246cb220df9eb1ebc746cc783da1a 100644 (file)
@@ -163,7 +163,7 @@ its character representation and its display representation.")
 (put 'rmail-spool-directory 'standard-value
      '((cond ((file-exists-p "/var/mail") "/var/mail/")
             ((file-exists-p "/var/spool/mail") "/var/spool/mail/")
-            ((memq system-type '(hpux usg-unix-v irix)) "/usr/mail/")
+            ((memq system-type '(hpux usg-unix-v)) "/usr/mail/")
             (t "/usr/spool/mail/"))))
 
 ;;;###autoload
@@ -176,7 +176,7 @@ its character representation and its display representation.")
         "/var/mail/")
        ;; Many GNU/Linux systems use this name.
        ((file-exists-p "/var/spool/mail") "/var/spool/mail/")
-       ((memq system-type '(hpux usg-unix-v irix)) "/usr/mail/")
+       ((memq system-type '(hpux usg-unix-v)) "/usr/mail/")
        (t "/usr/spool/mail/")))
   "Name of directory used by system mailer for delivering new mail.
 Its name should end with a slash."
@@ -241,6 +241,7 @@ please report it with \\[report-emacs-bug].")
 (declare-function mail-dont-reply-to "mail-utils" (destinations))
 (declare-function rmail-update-summary "rmailsum" (&rest ignore))
 (declare-function rmail-mime-toggle-hidden "rmailmm" ())
+(declare-function rmail-mime-entity-truncated "rmailmm" (entity))
 
 (defun rmail-probe (prog)
   "Determine what flavor of movemail PROG is.
@@ -1817,9 +1818,21 @@ not be a new one).  It returns non-nil if it got any new messages."
        ;; Read in the contents of the inbox files, renaming them as
        ;; necessary, and adding to the list of files to delete
        ;; eventually.
-       (if file-name
-           (rmail-insert-inbox-text files nil)
-         (setq delete-files (rmail-insert-inbox-text files t)))
+       (unwind-protect
+           (progn
+             ;; Set modified now to lock the file, so that we don't
+             ;; encounter locking problems later in the middle of
+             ;; reading the mail.
+             (set-buffer-modified-p t)
+             (if file-name
+                 (rmail-insert-inbox-text files nil)
+               (setq delete-files (rmail-insert-inbox-text files t))))
+         ;; If there was no new mail, or we aborted before actually
+         ;; trying to get any, mark buffer unmodified.  Otherwise the
+         ;; buffer is correctly marked modified and the file locked
+         ;; until we save out the new mail.
+         (if (= (point-min) (point-max))
+             (set-buffer-modified-p nil)))
        ;; Scan the new text and convert each message to
        ;; Rmail/mbox format.
        (goto-char (point-min))
@@ -1968,11 +1981,6 @@ Value is the size of the newly read mail after conversion."
     size))
 
 (defun rmail-insert-inbox-text (files renamep)
-  ;; Detect a locked file now, so that we avoid moving mail
-  ;; out of the real inbox file.  (That could scare people.)
-  (or (memq (file-locked-p buffer-file-name) '(nil t))
-      (error "RMAIL file %s is locked"
-            (file-name-nondirectory buffer-file-name)))
   (let (file tofile delete-files popmail got-password password)
     (while files
       ;; Handle remote mailbox names specially; don't expand as filenames
@@ -2799,7 +2807,12 @@ The current mail message becomes the message displayed."
          ;; rmail-header-style based on the binding in effect when
          ;; this function is called; `rmail-toggle-headers' can
          ;; inspect this value to determine how to toggle.
-         (set (make-local-variable 'rmail-header-style) header-style))
+         (set (make-local-variable 'rmail-header-style) header-style)
+          ;; In case viewing the previous message sets the paragraph
+          ;; direction non-nil, we reset it here to allow independent
+          ;; dynamic determination of paragraph direction in every
+          ;; message.
+          (setq bidi-paragraph-direction nil))
        (if (and rmail-enable-mime
                 rmail-show-mime-function
                 (re-search-forward "mime-version: 1.0" nil t))
@@ -4083,7 +4096,7 @@ typically for purposes of moderating a list."
                    (set-syntax-table mail-abbrev-syntax-table)
                    (goto-char before)
                    (while (and (< (point) end)
-                               (progn (forward-word 1)
+                               (progn (forward-word-strictly 1)
                                       (<= (point) end)))
                      (expand-abbrev))
                    (set-syntax-table old-syntax-table))
@@ -4579,10 +4592,13 @@ Argument MIME is non-nil if this is a mime message."
     (list armor-start (- (point-max) after-end) mime
           armor-end-regexp)))
 
+(declare-function rmail-mime-entity-truncated "rmailmm" (entity))
+
 ;; Should this have a key-binding, or be in a menu?
 ;; There doesn't really seem to be an appropriate menu.
 ;; Eg the edit command is not in a menu either.
 
+(defvar rmail-mime-render-html-function) ; defcustom in rmailmm
 (defun rmail-epa-decrypt ()
   "Decrypt GnuPG or OpenPGP armors in current message."
   (interactive)