diff options
| author | Richard M. Stallman | 1994-10-11 17:38:48 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-10-11 17:38:48 +0000 |
| commit | 1529a12fb56de084e032002b398b726d9676b217 (patch) | |
| tree | 4a90b3d05bbc8afd12acf9be022b22a55d91a88f | |
| parent | 4986bd386fe914f943bb2e93deca40a2a6d4f742 (diff) | |
| download | emacs-1529a12fb56de084e032002b398b726d9676b217.tar.gz emacs-1529a12fb56de084e032002b398b726d9676b217.zip | |
(rmail-find-all-files): Fix several errors and make faster.
Always return a single-level list of file names.
(rmail-construct-io-menu): If FILES is null, turn off the menus.
(rmail-disable-menu): A phony "command", always disabled in menus.
(rmail-list-to-menu): Reverse the list L.
| -rw-r--r-- | lisp/mail/rmail.el | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 2d409b6ea11..2510e3cb46b 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -708,19 +708,27 @@ Instead, these commands are available: | |||
| 708 | (interactive "FRun rmail on RMAIL file: ") | 708 | (interactive "FRun rmail on RMAIL file: ") |
| 709 | (rmail filename)) | 709 | (rmail filename)) |
| 710 | 710 | ||
| 711 | ;; Return a list of file names for all files in or under START | ||
| 712 | ;; whose names match rmail-secondary-file-regexp. | ||
| 713 | ;; This includes START itself, if that name matches. | ||
| 714 | ;; But normally START is a directory. | ||
| 711 | (defun rmail-find-all-files (start) | 715 | (defun rmail-find-all-files (start) |
| 712 | (if (file-accessible-directory-p start) | 716 | (if (file-accessible-directory-p start) |
| 713 | (let ((files (directory-files start nil | 717 | ;; Don't sort here. |
| 714 | rmail-secondary-file-regexp)) | 718 | (let ((files (directory-files start t |
| 719 | rmail-secondary-file-regexp t)) | ||
| 715 | (ret nil)) | 720 | (ret nil)) |
| 716 | (while files | 721 | (while files |
| 717 | (setq file (car files)) | 722 | (setq file (car files)) |
| 718 | (setq files (cdr files)) | 723 | (setq files (cdr files)) |
| 719 | (setq ret (cons | 724 | (setq ret (nconc |
| 720 | (rmail-find-all-files (concat start "/" file)) | 725 | (rmail-find-all-files file) |
| 721 | ret))) | 726 | ret))) |
| 722 | (cons (file-name-nondirectory start) ret)) | 727 | ;; Sort here instead of in directory-files |
| 723 | (file-name-nondirectory start))) | 728 | ;; because this list is usually much shorter. |
| 729 | (sort ret 'string<)) | ||
| 730 | (if (string-match rmail-secondary-file-regexp start) | ||
| 731 | (list (file-name-nondirectory start))))) | ||
| 724 | 732 | ||
| 725 | (defun rmail-list-to-menu (menu-name l action &optional full-name) | 733 | (defun rmail-list-to-menu (menu-name l action &optional full-name) |
| 726 | (let ((menu (make-sparse-keymap menu-name))) | 734 | (let ((menu (make-sparse-keymap menu-name))) |
| @@ -748,23 +756,31 @@ Instead, these commands are available: | |||
| 748 | rmail-secondary-file-directory)))))) | 756 | rmail-secondary-file-directory)))))) |
| 749 | (define-key menu (vector (intern name)) | 757 | (define-key menu (vector (intern name)) |
| 750 | (cons name command)))) | 758 | (cons name command)))) |
| 751 | l) | 759 | (reverse l)) |
| 752 | menu)) | 760 | menu)) |
| 753 | 761 | ||
| 762 | ;; This command is always "disabled" when it appears in a menu. | ||
| 763 | (put 'rmail-disable-menu 'menu-enable ''nil) | ||
| 764 | |||
| 754 | (defun rmail-construct-io-menu () | 765 | (defun rmail-construct-io-menu () |
| 755 | (let ((files (rmail-find-all-files rmail-secondary-file-directory))) | 766 | (let ((files (rmail-find-all-files rmail-secondary-file-directory))) |
| 756 | (if (listp files) | 767 | (if files |
| 757 | (progn | 768 | (progn |
| 758 | (define-key rmail-mode-map [menu-bar classify input-menu] | 769 | (define-key rmail-mode-map [menu-bar classify input-menu] |
| 759 | (cons "Input Rmail File" | 770 | (cons "Input Rmail File" |
| 760 | (rmail-list-to-menu "Input Rmail File" | 771 | (rmail-list-to-menu "Input Rmail File" |
| 761 | (cdr files) | 772 | files |
| 762 | 'rmail-input))) | 773 | 'rmail-input))) |
| 763 | (define-key rmail-mode-map [menu-bar classify output-menu] | 774 | (define-key rmail-mode-map [menu-bar classify output-menu] |
| 764 | (cons "Output Rmail File" | 775 | (cons "Output Rmail File" |
| 765 | (rmail-list-to-menu "Output Rmail File" | 776 | (rmail-list-to-menu "Output Rmail File" |
| 766 | (cdr files) | 777 | files |
| 767 | 'rmail-output-to-rmail-file))))))) | 778 | 'rmail-output-to-rmail-file)))) |
| 779 | |||
| 780 | (define-key rmail-mode-map [menu-bar classify input-menu] | ||
| 781 | '("Input Rmail File" . rmail-disable-menu)) | ||
| 782 | (define-key rmail-mode-map [menu-bar classify output-menu] | ||
| 783 | '("Output Rmail File" . rmail-disable-menu))))) | ||
| 768 | 784 | ||
| 769 | 785 | ||
| 770 | ;;;; *** Rmail input *** | 786 | ;;;; *** Rmail input *** |