Mercurial > emacs
comparison lisp/mail/rmail.el @ 21435:41fa600fadc4
(rmail-message-regexp-p): Handle messages
whose headers have not been reformatted.
(rmail-message-recipients-p): Likewise.
(rmail-movemail-program): Customized.
(rmail-message-filter): Customized.
(rmail-display-summary): Customized.
(rmail-inbox-list, rmail-keywords, rmail-current-message)
(rmail-total-messages, rmail-message-vector, rmail-deleted-vector)
(rmail-msgref-vector, rmail-overlay-list, rmail-view-buffer)
(rmail-last-label, rmail-last-regexp): Now permanent locals.
(rmail-perm-variables): Set up all permanent locals here.
(rmail-variables): Not here.
(rmail-variables): Set enable-local-variables here.
(rmail-mode-2): Not here.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 08 Apr 1998 19:02:34 +0000 |
parents | 4370dfe3cfb3 |
children | cd1971673dfd |
comparison
equal
deleted
inserted
replaced
21434:276b22459b98 | 21435:41fa600fadc4 |
---|---|
35 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix | 35 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix |
36 ;; variable, and a bury rmail buffer (wipe) command. | 36 ;; variable, and a bury rmail buffer (wipe) command. |
37 ;; | 37 ;; |
38 | 38 |
39 (require 'mail-utils) | 39 (require 'mail-utils) |
40 | |
41 ;; For Emacs V18 compatibility | |
42 (and (not (fboundp 'buffer-disable-undo)) | |
43 (fboundp 'buffer-flush-undo) | |
44 (defalias 'buffer-disable-undo 'buffer-flush-undo)) | |
45 | 40 |
46 ; These variables now declared in paths.el. | 41 ; These variables now declared in paths.el. |
47 ;(defvar rmail-spool-directory "/usr/spool/mail/" | 42 ;(defvar rmail-spool-directory "/usr/spool/mail/" |
48 ; "This is the name of the directory used by the system mailer for\n\ | 43 ; "This is the name of the directory used by the system mailer for\n\ |
49 ;delivering new mail. Its name should end with a slash.") | 44 ;delivering new mail. Its name should end with a slash.") |
86 :prefix "rmail-output-" | 81 :prefix "rmail-output-" |
87 :prefix "rmail-" | 82 :prefix "rmail-" |
88 :group 'rmail) | 83 :group 'rmail) |
89 | 84 |
90 | 85 |
91 (defvar rmail-movemail-program nil | 86 (defcustom rmail-movemail-program nil |
92 "If non-nil, name of program for fetching new mail.") | 87 "If non-nil, name of program for fetching new mail." |
88 :group 'rmail-retrieve | |
89 :type 'string) | |
93 | 90 |
94 (defcustom rmail-pop-password nil | 91 (defcustom rmail-pop-password nil |
95 "*Password to use when reading mail from a POP server, if required." | 92 "*Password to use when reading mail from a POP server, if required." |
96 :type '(choice (string :tag "Password") | 93 :type '(choice (string :tag "Password") |
97 (const :tag "Not Required" nil)) | 94 (const :tag "Not Required" nil)) |
234 (defvar rmail-mmdf-delim1 "^\001\001\001\001\n" | 231 (defvar rmail-mmdf-delim1 "^\001\001\001\001\n" |
235 "Regexp marking the start of an mmdf message") | 232 "Regexp marking the start of an mmdf message") |
236 (defvar rmail-mmdf-delim2 "^\001\001\001\001\n" | 233 (defvar rmail-mmdf-delim2 "^\001\001\001\001\n" |
237 "Regexp marking the end of an mmdf message") | 234 "Regexp marking the end of an mmdf message") |
238 | 235 |
239 (defvar rmail-message-filter nil | 236 (defcustom rmail-message-filter nil |
240 "If non-nil, a filter function for new messages in RMAIL. | 237 "If non-nil, a filter function for new messages in RMAIL. |
241 Called with region narrowed to the message, including headers, | 238 Called with region narrowed to the message, including headers, |
242 before obeying `rmail-ignored-headers'.") | 239 before obeying `rmail-ignored-headers'." |
240 :group 'rmail-headers | |
241 :type 'function) | |
243 | 242 |
244 (defvar rmail-reply-prefix "Re: " | 243 (defvar rmail-reply-prefix "Re: " |
245 "String to prepend to Subject line when replying to a message.") | 244 "String to prepend to Subject line when replying to a message.") |
246 | 245 |
247 ;; Some mailers use "Re(2):" or "Re^2:" or "Re: Re:" or "Re[2]:". | 246 ;; Some mailers use "Re(2):" or "Re^2:" or "Re: Re:" or "Re[2]:". |
248 ;; This pattern should catch all the common variants. | 247 ;; This pattern should catch all the common variants. |
249 (defvar rmail-reply-regexp "\\`\\(Re\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?: *\\)*" | 248 (defvar rmail-reply-regexp "\\`\\(Re\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?: *\\)*" |
250 "Regexp to delete from Subject line before inserting `rmail-reply-prefix'.") | 249 "Regexp to delete from Subject line before inserting `rmail-reply-prefix'.") |
251 | 250 |
252 (defvar rmail-display-summary nil | 251 (defcustom rmail-display-summary nil |
253 "If non-nil, Rmail always displays the summary buffer.") | 252 "*If non-nil, Rmail always displays the summary buffer." |
254 | 253 :group 'rmail-summary |
255 (defvar rmail-mode-map nil) | 254 :type 'boolean) |
256 | 255 |
257 (defvar rmail-inbox-list nil) | 256 (defvar rmail-inbox-list nil) |
257 (put 'rmail-inbox-list 'permanent-local t) | |
258 | |
258 (defvar rmail-keywords nil) | 259 (defvar rmail-keywords nil) |
260 (put 'rmail-keywords 'permanent-local t) | |
259 | 261 |
260 (defvar rmail-buffer nil | 262 (defvar rmail-buffer nil |
261 "The RMAIL buffer related to the current buffer. | 263 "The RMAIL buffer related to the current buffer. |
262 In an RMAIL buffer, this holds the RMAIL buffer itself. | 264 In an RMAIL buffer, this holds the RMAIL buffer itself. |
263 In a summary buffer, this holds the RMAIL buffer it is a summary for.") | 265 In a summary buffer, this holds the RMAIL buffer it is a summary for.") |
264 (put 'rmail-buffer 'permanent-local t) | 266 (put 'rmail-buffer 'permanent-local t) |
265 | 267 |
266 ;; Message counters and markers. Deleted flags. | 268 ;; Message counters and markers. Deleted flags. |
267 | 269 |
268 (defvar rmail-current-message nil) | 270 (defvar rmail-current-message nil) |
271 (put 'rmail-current-message 'permanent-local t) | |
272 | |
269 (defvar rmail-total-messages nil) | 273 (defvar rmail-total-messages nil) |
274 (put 'rmail-total-messages 'permanent-local t) | |
275 | |
270 (defvar rmail-message-vector nil) | 276 (defvar rmail-message-vector nil) |
277 (put 'rmail-message-vector 'permanent-local t) | |
278 | |
271 (defvar rmail-deleted-vector nil) | 279 (defvar rmail-deleted-vector nil) |
280 (put 'rmail-deleted-vector 'permanent-local t) | |
281 | |
272 (defvar rmail-msgref-vector nil | 282 (defvar rmail-msgref-vector nil |
273 "In an Rmail buffer, a vector whose Nth element is a list (N). | 283 "In an Rmail buffer, a vector whose Nth element is a list (N). |
274 When expunging renumbers messages, these lists are modified | 284 When expunging renumbers messages, these lists are modified |
275 by substituting the new message number into the existing list.") | 285 by substituting the new message number into the existing list.") |
286 (put 'rmail-msgref-vector 'permanent-local t) | |
276 | 287 |
277 (defvar rmail-overlay-list nil) | 288 (defvar rmail-overlay-list nil) |
289 (put 'rmail-overlay-list 'permanent-local t) | |
290 | |
291 ;; These are used by autoloaded rmail-summary. | |
292 | |
293 (defvar rmail-summary-buffer nil) | |
294 (put 'rmail-summary-buffer 'permanent-local t) | |
295 (defvar rmail-summary-vector nil) | |
296 (put 'rmail-summary-vector 'permanent-local t) | |
297 | |
298 (defvar rmail-view-buffer nil | |
299 "Buffer which holds RMAIL message for MIME displaying.") | |
300 (put 'rmail-view-buffer 'permanent-local t) | |
301 | |
302 ;; `Sticky' default variables. | |
303 | |
304 ;; Last individual label specified to a or k. | |
305 (defvar rmail-last-label nil) | |
306 (put 'rmail-last-label 'permanent-local t) | |
307 | |
308 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l. | |
309 (defvar rmail-last-multi-labels nil) | |
310 | |
311 (defvar rmail-last-regexp nil) | |
312 (put 'rmail-last-regexp 'permanent-local t) | |
313 | |
314 (defcustom rmail-default-file "~/xmail" | |
315 "*Default file name for \\[rmail-output]." | |
316 :type 'file | |
317 :group 'rmail-files) | |
318 (defcustom rmail-default-rmail-file "~/XMAIL" | |
319 "*Default file name for \\[rmail-output-to-rmail-file]." | |
320 :type 'file | |
321 :group 'rmail-files) | |
322 | |
323 ;; Mule and MIME related variables. | |
324 | |
325 ;;;###autoload | |
326 (defvar rmail-file-coding-system nil | |
327 "Coding system used in RMAIL file. | |
328 | |
329 This is set to nil by default.") | |
330 | |
331 ;;;###autoload | |
332 (defcustom rmail-enable-mime nil | |
333 "*If non-nil, RMAIL uses MIME feature. | |
334 If the value is t, RMAIL automatically shows MIME decoded message. | |
335 If the value is neither t nor nil, RMAIL does not show MIME decoded message | |
336 until a user explicitly requires it." | |
337 :type '(choice (const :tag "on" t) | |
338 (const :tag "off" nil) | |
339 (sexp :tag "when asked" :format "%t\n" ask)) | |
340 :group 'rmail) | |
341 | |
342 ;;;###autoload | |
343 (defvar rmail-show-mime-function nil | |
344 "Function to show MIME decoded message of RMAIL file.") | |
345 | |
346 ;;;###autoload | |
347 (defvar rmail-mime-feature 'rmail-mime | |
348 "Feature to provide for using MIME feature in RMAIL. | |
349 When starting rmail, this feature is requrired if rmail-enable-mime | |
350 is non-nil.") | |
351 | |
352 | |
353 ;;; Regexp matching the delimiter of messages in UNIX mail format | |
354 ;;; (UNIX From lines), minus the initial ^. Note that if you change | |
355 ;;; this expression, you must change the code in rmail-nuke-pinhead-header | |
356 ;;; that knows the exact ordering of the \\( \\) subexpressions. | |
357 (defvar rmail-unix-mail-delimiter | |
358 (let ((time-zone-regexp | |
359 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?" | |
360 "\\|[-+]?[0-9][0-9][0-9][0-9]" | |
361 "\\|" | |
362 "\\) *"))) | |
363 (concat | |
364 "From " | |
365 | |
366 ;; Many things can happen to an RFC 822 mailbox before it is put into | |
367 ;; a `From' line. The leading phrase can be stripped, e.g. | |
368 ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g. | |
369 ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF | |
370 ;; can be removed, e.g. | |
371 ;; From: joe@y.z (Joe K | |
372 ;; User) | |
373 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and | |
374 ;; From: Joe User | |
375 ;; <joe@y.z> | |
376 ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'. | |
377 ;; The mailbox can be removed or be replaced by white space, e.g. | |
378 ;; From: "Joe User"{space}{tab} | |
379 ;; <joe@y.z> | |
380 ;; can yield `From {space}{tab} Fri Mar 22 08:11:15 1996', | |
381 ;; where {space} and {tab} represent the Ascii space and tab characters. | |
382 ;; We want to match the results of any of these manglings. | |
383 ;; The following regexp rejects names whose first characters are | |
384 ;; obviously bogus, but after that anything goes. | |
385 "\\([^\0-\b\n-\r\^?].*\\)? " | |
386 | |
387 ;; The time the message was sent. | |
388 "\\([^\0-\r \^?]+\\) +" ; day of the week | |
389 "\\([^\0-\r \^?]+\\) +" ; month | |
390 "\\([0-3]?[0-9]\\) +" ; day of month | |
391 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day | |
392 | |
393 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
394 ;; numeric offset. | |
395 time-zone-regexp | |
396 | |
397 ;; The year. | |
398 " \\([0-9][0-9]+\\) *" | |
399 | |
400 ;; On some systems the time zone can appear after the year, too. | |
401 time-zone-regexp | |
402 | |
403 ;; Old uucp cruft. | |
404 "\\(remote from .*\\)?" | |
405 | |
406 "\n")) | |
407 nil) | |
278 | 408 |
279 (defvar rmail-font-lock-keywords | 409 (defvar rmail-font-lock-keywords |
280 (eval-when-compile | 410 (eval-when-compile |
281 (let* ((cite-chars "[>|}]") | 411 (let* ((cite-chars "[>|}]") |
282 (cite-prefix "A-Za-z") | 412 (cite-prefix "A-Za-z") |
297 (4 font-lock-comment-face nil t))) | 427 (4 font-lock-comment-face nil t))) |
298 '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\|Date\\):.*$" | 428 '("^\\(X-[A-Za-z0-9-]+\\|In-reply-to\\|Date\\):.*$" |
299 . font-lock-string-face)))) | 429 . font-lock-string-face)))) |
300 "Additional expressions to highlight in Rmail mode.") | 430 "Additional expressions to highlight in Rmail mode.") |
301 | 431 |
302 ;; These are used by autoloaded rmail-summary. | |
303 | |
304 (defvar rmail-summary-buffer nil) | |
305 (put 'rmail-summary-buffer 'permanent-local t) | |
306 (defvar rmail-summary-vector nil) | |
307 (put 'rmail-summary-vector 'permanent-local t) | |
308 | |
309 ;; `Sticky' default variables. | |
310 | |
311 ;; Last individual label specified to a or k. | |
312 (defvar rmail-last-label nil) | |
313 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l. | |
314 (defvar rmail-last-multi-labels nil) | |
315 (defvar rmail-last-regexp nil) | |
316 (defcustom rmail-default-file "~/xmail" | |
317 "*Default file name for \\[rmail-output]." | |
318 :type 'file | |
319 :group 'rmail-files) | |
320 (defcustom rmail-default-rmail-file "~/XMAIL" | |
321 "*Default file name for \\[rmail-output-to-rmail-file]." | |
322 :type 'file | |
323 :group 'rmail-files) | |
324 | |
325 ;;; Regexp matching the delimiter of messages in UNIX mail format | |
326 ;;; (UNIX From lines), minus the initial ^. Note that if you change | |
327 ;;; this expression, you must change the code in rmail-nuke-pinhead-header | |
328 ;;; that knows the exact ordering of the \\( \\) subexpressions. | |
329 (defvar rmail-unix-mail-delimiter | |
330 (let ((time-zone-regexp | |
331 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?" | |
332 "\\|[-+]?[0-9][0-9][0-9][0-9]" | |
333 "\\|" | |
334 "\\) *"))) | |
335 (concat | |
336 "From " | |
337 | |
338 ;; Many things can happen to an RFC 822 mailbox before it is put into | |
339 ;; a `From' line. The leading phrase can be stripped, e.g. | |
340 ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g. | |
341 ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF | |
342 ;; can be removed, e.g. | |
343 ;; From: joe@y.z (Joe K | |
344 ;; User) | |
345 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and | |
346 ;; From: Joe User | |
347 ;; <joe@y.z> | |
348 ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'. | |
349 ;; The mailbox can be removed or be replaced by white space, e.g. | |
350 ;; From: "Joe User"{space}{tab} | |
351 ;; <joe@y.z> | |
352 ;; can yield `From {space}{tab} Fri Mar 22 08:11:15 1996', | |
353 ;; where {space} and {tab} represent the Ascii space and tab characters. | |
354 ;; We want to match the results of any of these manglings. | |
355 ;; The following regexp rejects names whose first characters are | |
356 ;; obviously bogus, but after that anything goes. | |
357 "\\([^\0-\b\n-\r\^?].*\\)? " | |
358 | |
359 ;; The time the message was sent. | |
360 "\\([^\0-\r \^?]+\\) +" ; day of the week | |
361 "\\([^\0-\r \^?]+\\) +" ; month | |
362 "\\([0-3]?[0-9]\\) +" ; day of month | |
363 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day | |
364 | |
365 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
366 ;; numeric offset. | |
367 time-zone-regexp | |
368 | |
369 ;; The year. | |
370 " \\([0-9][0-9]+\\) *" | |
371 | |
372 ;; On some systems the time zone can appear after the year, too. | |
373 time-zone-regexp | |
374 | |
375 ;; Old uucp cruft. | |
376 "\\(remote from .*\\)?" | |
377 | |
378 "\n")) | |
379 nil) | |
380 | |
381 ;; Perform BODY in the summary buffer | 432 ;; Perform BODY in the summary buffer |
382 ;; in such a way that its cursor is properly updated in its own window. | 433 ;; in such a way that its cursor is properly updated in its own window. |
383 (defmacro rmail-select-summary (&rest body) | 434 (defmacro rmail-select-summary (&rest body) |
384 (` (let ((total rmail-total-messages)) | 435 (` (let ((total rmail-total-messages)) |
385 (if (rmail-summary-displayed) | 436 (if (rmail-summary-displayed) |
398 (save-excursion | 449 (save-excursion |
399 (set-buffer rmail-summary-buffer) | 450 (set-buffer rmail-summary-buffer) |
400 (let ((rmail-total-messages total)) | 451 (let ((rmail-total-messages total)) |
401 (,@ body)))) | 452 (,@ body)))) |
402 (rmail-maybe-display-summary)))) | 453 (rmail-maybe-display-summary)))) |
403 | |
404 (defvar rmail-view-buffer nil | |
405 "Buffer which holds RMAIL message for MIME displaying.") | |
406 | |
407 ;; Mule and MIME related variables. | |
408 | |
409 ;;;###autoload | |
410 (defvar rmail-file-coding-system nil | |
411 "Coding system used in RMAIL file. | |
412 | |
413 This is set to nil by default.") | |
414 | |
415 ;;;###autoload | |
416 (defcustom rmail-enable-mime nil | |
417 "*If non-nil, RMAIL uses MIME feature. | |
418 If the value is t, RMAIL automatically shows MIME decoded message. | |
419 If the value is neither t nor nil, RMAIL does not show MIME decoded message | |
420 until a user explicitly requires it." | |
421 :type '(choice (const :tag "on" t) | |
422 (const :tag "off" nil) | |
423 (sexp :tag "when asked" :format "%t\n" ask)) | |
424 :group 'rmail) | |
425 | |
426 ;;;###autoload | |
427 (defvar rmail-show-mime-function nil | |
428 "Function to show MIME decoded message of RMAIL file.") | |
429 | |
430 ;;;###autoload | |
431 (defvar rmail-mime-feature 'rmail-mime | |
432 "Feature to provide for using MIME feature in RMAIL. | |
433 When starting rmail, this feature is requrired if rmail-enable-mime | |
434 is non-nil.") | |
435 | |
436 | 454 |
437 ;;;; *** Rmail Mode *** | 455 ;;;; *** Rmail Mode *** |
438 | 456 |
439 (defvar rmail-enable-multibyte nil) | 457 (defvar rmail-enable-multibyte nil) |
440 | 458 |
620 (setq count (1+ count))) | 638 (setq count (1+ count))) |
621 (message "Decoding messages...done") | 639 (message "Decoding messages...done") |
622 (set-buffer-file-coding-system rmail-file-coding-system) | 640 (set-buffer-file-coding-system rmail-file-coding-system) |
623 (set-buffer-modified-p modifiedp))))) | 641 (set-buffer-modified-p modifiedp))))) |
624 | 642 |
643 (defvar rmail-mode-map nil) | |
625 (if rmail-mode-map | 644 (if rmail-mode-map |
626 nil | 645 nil |
627 (setq rmail-mode-map (make-keymap)) | 646 (setq rmail-mode-map (make-keymap)) |
628 (suppress-keymap rmail-mode-map) | 647 (suppress-keymap rmail-mode-map) |
629 (define-key rmail-mode-map "a" 'rmail-add-label) | 648 (define-key rmail-mode-map "a" 'rmail-add-label) |
858 (rmail-show-message rmail-total-messages) | 877 (rmail-show-message rmail-total-messages) |
859 (run-hooks 'rmail-mode-hook)) | 878 (run-hooks 'rmail-mode-hook)) |
860 | 879 |
861 (defun rmail-mode-2 () | 880 (defun rmail-mode-2 () |
862 (kill-all-local-variables) | 881 (kill-all-local-variables) |
863 ;; Don't let a local variables list in a message cause confusion. | |
864 (make-local-variable 'enable-local-variables) | |
865 (setq enable-local-variables nil) | |
866 (rmail-mode-1) | 882 (rmail-mode-1) |
883 (rmail-perm-variables) | |
867 (rmail-variables)) | 884 (rmail-variables)) |
868 | 885 |
869 (defun rmail-mode-1 () | 886 (defun rmail-mode-1 () |
870 (setq major-mode 'rmail-mode) | 887 (setq major-mode 'rmail-mode) |
871 (setq mode-name "RMAIL") | 888 (setq mode-name "RMAIL") |
879 (setq mode-line-modified "--") | 896 (setq mode-line-modified "--") |
880 (use-local-map rmail-mode-map) | 897 (use-local-map rmail-mode-map) |
881 (set-syntax-table text-mode-syntax-table) | 898 (set-syntax-table text-mode-syntax-table) |
882 (setq local-abbrev-table text-mode-abbrev-table)) | 899 (setq local-abbrev-table text-mode-abbrev-table)) |
883 | 900 |
884 (defun rmail-variables () | 901 ;; Set up the permanent locals associated with an Rmail file. |
885 (make-local-variable 'revert-buffer-function) | 902 (defun rmail-perm-variables () |
886 (setq revert-buffer-function 'rmail-revert) | |
887 (make-local-variable 'font-lock-defaults) | |
888 (setq font-lock-defaults | |
889 '(rmail-font-lock-keywords t nil nil nil | |
890 (font-lock-maximum-size . nil) | |
891 (font-lock-fontify-buffer-function . rmail-fontify-buffer-function) | |
892 (font-lock-unfontify-buffer-function . rmail-unfontify-buffer-function) | |
893 (font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode)))) | |
894 (make-local-variable 'rmail-last-label) | 903 (make-local-variable 'rmail-last-label) |
895 (make-local-variable 'rmail-last-regexp) | 904 (make-local-variable 'rmail-last-regexp) |
896 (make-local-variable 'rmail-deleted-vector) | 905 (make-local-variable 'rmail-deleted-vector) |
897 (make-local-variable 'rmail-buffer) | 906 (make-local-variable 'rmail-buffer) |
898 (setq rmail-buffer (current-buffer)) | 907 (setq rmail-buffer (current-buffer)) |
900 (setq rmail-view-buffer rmail-buffer) | 909 (setq rmail-view-buffer rmail-buffer) |
901 (make-local-variable 'rmail-summary-buffer) | 910 (make-local-variable 'rmail-summary-buffer) |
902 (make-local-variable 'rmail-summary-vector) | 911 (make-local-variable 'rmail-summary-vector) |
903 (make-local-variable 'rmail-current-message) | 912 (make-local-variable 'rmail-current-message) |
904 (make-local-variable 'rmail-total-messages) | 913 (make-local-variable 'rmail-total-messages) |
905 (make-local-variable 'require-final-newline) | |
906 (setq require-final-newline nil) | |
907 (make-local-variable 'rmail-overlay-list) | 914 (make-local-variable 'rmail-overlay-list) |
908 (setq rmail-overlay-list nil) | 915 (setq rmail-overlay-list nil) |
909 (make-local-variable 'version-control) | |
910 (setq version-control 'never) | |
911 (make-local-variable 'kill-buffer-hook) | |
912 (add-hook 'kill-buffer-hook 'rmail-mode-kill-summary) | |
913 (make-local-variable 'file-precious-flag) | |
914 (setq file-precious-flag t) | |
915 (make-local-variable 'rmail-message-vector) | 916 (make-local-variable 'rmail-message-vector) |
916 (make-local-variable 'rmail-msgref-vector) | 917 (make-local-variable 'rmail-msgref-vector) |
917 (make-local-variable 'rmail-inbox-list) | 918 (make-local-variable 'rmail-inbox-list) |
918 (setq rmail-inbox-list (rmail-parse-file-inboxes)) | 919 (setq rmail-inbox-list (rmail-parse-file-inboxes)) |
919 ;; Provide default set of inboxes for primary mail file ~/RMAIL. | 920 ;; Provide default set of inboxes for primary mail file ~/RMAIL. |
927 (concat rmail-spool-directory | 928 (concat rmail-spool-directory |
928 (user-login-name))))))) | 929 (user-login-name))))))) |
929 (make-local-variable 'rmail-keywords) | 930 (make-local-variable 'rmail-keywords) |
930 ;; this gets generated as needed | 931 ;; this gets generated as needed |
931 (setq rmail-keywords nil)) | 932 (setq rmail-keywords nil)) |
933 | |
934 ;; Set up the non-permanent locals associated with Rmail mode. | |
935 (defun rmail-variables () | |
936 ;; Don't let a local variables list in a message cause confusion. | |
937 (make-local-variable 'enable-local-variables) | |
938 (setq enable-local-variables nil) | |
939 (make-local-variable 'revert-buffer-function) | |
940 (setq revert-buffer-function 'rmail-revert) | |
941 (make-local-variable 'font-lock-defaults) | |
942 (setq font-lock-defaults | |
943 '(rmail-font-lock-keywords t nil nil nil | |
944 (font-lock-maximum-size . nil) | |
945 (font-lock-fontify-buffer-function . rmail-fontify-buffer-function) | |
946 (font-lock-unfontify-buffer-function . rmail-unfontify-buffer-function) | |
947 (font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode)))) | |
948 (make-local-variable 'require-final-newline) | |
949 (setq require-final-newline nil) | |
950 (make-local-variable 'version-control) | |
951 (setq version-control 'never) | |
952 (make-local-variable 'kill-buffer-hook) | |
953 (add-hook 'kill-buffer-hook 'rmail-mode-kill-summary) | |
954 (make-local-variable 'file-precious-flag) | |
955 (setq file-precious-flag t)) | |
932 | 956 |
933 ;; Handle M-x revert-buffer done in an rmail-mode buffer. | 957 ;; Handle M-x revert-buffer done in an rmail-mode buffer. |
934 (defun rmail-revert (arg noconfirm) | 958 (defun rmail-revert (arg noconfirm) |
935 (let ((revert-buffer-function (default-value 'revert-buffer-function))) | 959 (let ((revert-buffer-function (default-value 'revert-buffer-function))) |
936 ;; Call our caller again, but this time it does the default thing. | 960 ;; Call our caller again, but this time it does the default thing. |
2155 (if (>= where (rmail-msgbeg high)) high low))) | 2179 (if (>= where (rmail-msgbeg high)) high low))) |
2156 | 2180 |
2157 (defun rmail-message-recipients-p (msg recipients &optional primary-only) | 2181 (defun rmail-message-recipients-p (msg recipients &optional primary-only) |
2158 (save-restriction | 2182 (save-restriction |
2159 (goto-char (rmail-msgbeg msg)) | 2183 (goto-char (rmail-msgbeg msg)) |
2160 (search-forward "\n*** EOOH ***\n") | 2184 (search-forward "\n*** EOOH ***\n" (point-max) t) |
2161 (narrow-to-region (point) (progn (search-forward "\n\n") (point))) | 2185 (narrow-to-region (point) (progn (search-forward "\n\n") (point))) |
2162 (or (string-match recipients (or (mail-fetch-field "To") "")) | 2186 (or (string-match recipients (or (mail-fetch-field "To") "")) |
2163 (string-match recipients (or (mail-fetch-field "From") "")) | 2187 (string-match recipients (or (mail-fetch-field "From") "")) |
2164 (if (not primary-only) | 2188 (if (not primary-only) |
2165 (string-match recipients (or (mail-fetch-field "Cc") "")))))) | 2189 (string-match recipients (or (mail-fetch-field "Cc") "")))))) |
2167 (defun rmail-message-regexp-p (msg regexp) | 2191 (defun rmail-message-regexp-p (msg regexp) |
2168 "Return t, if for message number MSG, regexp REGEXP matches in the header." | 2192 "Return t, if for message number MSG, regexp REGEXP matches in the header." |
2169 (goto-char (rmail-msgbeg msg)) | 2193 (goto-char (rmail-msgbeg msg)) |
2170 (let ((end | 2194 (let ((end |
2171 (save-excursion | 2195 (save-excursion |
2172 (search-forward "*** EOOH ***" (point-max)) (point)))) | 2196 (or (search-forward "\n*** EOOH ***\n" (point-max) t) |
2197 (search-forward "\n\n" (point-max))) | |
2198 (point)))) | |
2173 (re-search-forward regexp end t))) | 2199 (re-search-forward regexp end t))) |
2174 | 2200 |
2175 (defvar rmail-search-last-regexp nil) | 2201 (defvar rmail-search-last-regexp nil) |
2176 (defun rmail-search (regexp &optional n) | 2202 (defun rmail-search (regexp &optional n) |
2177 "Show message containing next match for REGEXP (but not the current msg). | 2203 "Show message containing next match for REGEXP (but not the current msg). |