Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
9a10bd0d
Commit
9a10bd0d
authored
Jan 25, 1997
by
Karl Heuer
Browse files
(rmail-get-new-mail): Fix return value to match doc.
parent
fd2d7b3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
93 deletions
+94
-93
lisp/mail/rmail.el
lisp/mail/rmail.el
+94
-93
No files found.
lisp/mail/rmail.el
View file @
9a10bd0d
...
@@ -916,100 +916,101 @@ It returns t if it got any new messages."
...
@@ -916,100 +916,101 @@ It returns t if it got any new messages."
(let ((all-files (if file-name (list file-name)
(let ((all-files (if file-name (list file-name)
rmail-inbox-list)))
rmail-inbox-list)))
(unwind-protect
(unwind-protect
(while all-files
(let (found)
(let ((opoint (point))
(while all-files
(new-messages 0)
(let ((opoint (point))
(delete-files ())
(new-messages 0)
;; If buffer has not changed yet, and has not been saved yet,
(delete-files ())
;; don't replace the old backup file now.
;; If buffer has not changed yet, and has not been saved yet,
(make-backup-files (and make-backup-files (buffer-modified-p)))
;; don't replace the old backup file now.
(buffer-read-only nil)
(make-backup-files (and make-backup-files (buffer-modified-p)))
;; Don't make undo records for what we do in getting mail.
(buffer-read-only nil)
(buffer-undo-list t)
;; Don't make undo records for what we do in getting mail.
success
(buffer-undo-list t)
;; Files to insert this time around.
success
files
;; Files to insert this time around.
;; Last names of those files.
files
file-last-names)
;; Last names of those files.
;; Pull files off all-files onto files
file-last-names)
;; as long as there is no name conflict.
;; Pull files off all-files onto files
;; A conflict happens when two inbox file names
;; as long as there is no name conflict.
;; have the same last component.
;; A conflict happens when two inbox file names
(while (and all-files
;; have the same last component.
(not (member (file-name-nondirectory (car all-files))
(while (and all-files
file-last-names)))
(not (member (file-name-nondirectory (car all-files))
(setq files (cons (car all-files) files)
file-last-names)))
file-last-names
(setq files (cons (car all-files) files)
(cons (file-name-nondirectory (car all-files)) files))
file-last-names
(setq all-files (cdr all-files)))
(cons (file-name-nondirectory (car all-files)) files))
;; Put them back in their original order.
(setq all-files (cdr all-files)))
(setq files (nreverse files))
;; Put them back in their original order.
(setq files (nreverse files))
(goto-char (point-max))
(goto-char (point-max))
(skip-chars-backward " \t\n")
; just in case of brain damage
(skip-chars-backward " \t\n") ; just in case of brain damage
(delete-region (point) (point-max)) ; caused by require-final-newline
(delete-region (point) (point-max)) ; caused by require-final-newline
(save-excursion
(save-excursion
(save-restriction
(save-restriction
(narrow-to-region (point) (point))
(narrow-to-region (point) (point))
;; Read in the contents of the inbox files,
;; Read in the contents of the inbox files,
;; renaming them as necessary,
;; renaming them as necessary,
;; and adding to the list of files to delete eventually.
;; and adding to the list of files to delete eventually.
(if file-name
(if file-name
(rmail-insert-inbox-text files nil)
(rmail-insert-inbox-text files nil)
(setq delete-files (rmail-insert-inbox-text files t)))
(setq delete-files (rmail-insert-inbox-text files t)))
;; Scan the new text and convert each message to babyl format.
;; Scan the new text and convert each message to babyl format.
(goto-char (point-min))
(goto-char (point-min))
(unwind-protect
(unwind-protect
(save-excursion
(save-excursion
(setq new-messages (rmail-convert-to-babyl-format)
(setq new-messages (rmail-convert-to-babyl-format)
success t))
success t))
;; If we could not convert the file's inboxes,
;; If we could not convert the file's inboxes,
;; rename the files we tried to read
;; rename the files we tried to read
;; so we won't over and over again.
;; so we won't over and over again.
(if (and (not file-name) (not success))
(if (and (not file-name) (not success))
(let ((delfiles delete-files)
(let ((delfiles delete-files)
(count 0))
(count 0))
(while delfiles
(while delfiles
(while (file-exists-p (format "RMAILOSE.%d" count))
(while (file-exists-p (format "RMAILOSE.%d" count))
(setq count (1+ count)))
(setq count (1+ count)))
(rename-file (car delfiles)
(rename-file (car delfiles)
(format "RMAILOSE.%d" count))
(format "RMAILOSE.%d" count))
(setq delfiles (cdr delfiles))))))
(setq delfiles (cdr delfiles))))))
(or (zerop new-messages)
(or (zerop new-messages)
(let (success)
(let (success)
(widen)
(widen)
(search-backward "\n\^_" nil t)
(search-backward "\n\^_" nil t)
(narrow-to-region (point) (point-max))
(narrow-to-region (point) (point-max))
(goto-char (1+ (point-min)))
(goto-char (1+ (point-min)))
(rmail-count-new-messages)
(rmail-count-new-messages)
(run-hooks 'rmail-get-new-mail-hook)
(run-hooks 'rmail-get-new-mail-hook)
(save-buffer)))
(save-buffer)))
;; Delete the old files, now that babyl file is saved.
;; Delete the old files, now that babyl file is saved.
(while delete-files
(while delete-files
(condition-case ()
(condition-case ()
;; First, try deleting.
;; First, try deleting.
(condition-case ()
(condition-case ()
(delete-file (car delete-files))
(delete-file (car delete-files))
(file-error
(file-error
;; If we can't delete it, truncate it.
;; If we can't delete it, truncate it.
(write-region (point) (point) (car delete-files))))
(write-region (point) (point) (car delete-files))))
(file-error nil))
(file-error nil))
(setq delete-files (cdr delete-files)))))
(setq delete-files (cdr delete-files)))))
(if (= new-messages 0)
(if (= new-messages 0)
(progn (goto-char opoint)
(progn (goto-char opoint)
(if (or file-name rmail-inbox-list)
(if (or file-name rmail-inbox-list)
(message "(No new mail has arrived)"))
(message "(No new mail has arrived)"))
)
nil
)
(if (rmail-summary-exists
)
(if (rmail-summary-exists)
(rmail-select-summary
(rmail-
select
-summary
(rmail-
update
-summary
)))
(rmail-update-summary)))
(message "%d new message%s read"
(message "%d
new
message
%s read"
new-messages (if (= 1
new
-
message
s) "" "s"))
new-messages (if (= 1
new
-
message
s) "" "s"))
;; Move to the first
new
message
;; Move to the first new message
;; unless we have other unseen messages before it.
;; unless we have other
unseen
message
s before it.
(rmail-show-message (rmail-first-
unseen
-
message
))
(rmail-show-message (rmail-first-unseen-message)
)
(run-hooks 'rmail-after-get-new-mail-hook
)
(run-hooks 'rmail-after-get-new-mail-hook
)
(setq found t)))
)
t))
)
found
)
;; Don't leave the buffer screwed up if we get a disk-full error.
;; Don't leave the buffer screwed up if we get a disk-full error.
(rmail-show-message))))
(rmail-show-message))))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment