aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1994-09-19 05:01:33 +0000
committerRichard M. Stallman1994-09-19 05:01:33 +0000
commit8b7ef584f611abb9d4c5422673a6d963ee905bb8 (patch)
treef46e3463b38a9c90556c52fd9cd2067f59b9fb69 /lisp
parent20b5d24c260c2f8d1afcfbabf3e3c1fd27e1fbcf (diff)
downloademacs-8b7ef584f611abb9d4c5422673a6d963ee905bb8.tar.gz
emacs-8b7ef584f611abb9d4c5422673a6d963ee905bb8.zip
Build proper keymap for the "Input (menu)" and "Output (menu)" submenus:
(rmail-find-all-files, rmail-list-to-menu, rmail-construct-io-menu): New functions. (rmail-input-menu): Function deleted. (rmail). Call rmail-construct-io-menu. (rmail-mode-map): 'Input Rmail file (menu)' renamed to `Input Rmail File'. `Output (Rmail Menu)' renamed to 'Output Rmail File'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mail/rmail.el94
1 files changed, 63 insertions, 31 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 617fc3da36b..782983c0033 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -280,7 +280,8 @@ If `rmail-display-summary' is non-nil, make a summary for this RMAIL file."
280 ;; determine already unseen messages first, as rmail-get-new-mail 280 ;; determine already unseen messages first, as rmail-get-new-mail
281 ;; positions on the first new message, thus marking it as seen. 281 ;; positions on the first new message, thus marking it as seen.
282 (rmail-show-message existing-unseen)) 282 (rmail-show-message existing-unseen))
283 (if rmail-display-summary (rmail-summary)))) 283 (if rmail-display-summary (rmail-summary))
284 (rmail-construct-io-menu)))
284 285
285;; Given the value of MAILPATH, return a list of inbox file names. 286;; Given the value of MAILPATH, return a list of inbox file names.
286;; This is turned off because it is not clear that the user wants 287;; This is turned off because it is not clear that the user wants
@@ -414,10 +415,10 @@ Note: it means the file has no messages in it.\n\^_")))
414 (cons "Classify" (make-sparse-keymap "Classify"))) 415 (cons "Classify" (make-sparse-keymap "Classify")))
415 416
416(define-key rmail-mode-map [menu-bar classify input-menu] 417(define-key rmail-mode-map [menu-bar classify input-menu]
417 '("Input Rmail file (menu)..." . rmail-input-menu)) 418 nil)
418 419
419(define-key rmail-mode-map [menu-bar classify output-menu] 420(define-key rmail-mode-map [menu-bar classify output-menu]
420 '("Output (Rmail menu)..." . rmail-output-menu)) 421 nil)
421 422
422(define-key rmail-mode-map [menu-bar classify output-inbox] 423(define-key rmail-mode-map [menu-bar classify output-inbox]
423 '("Output (inbox)..." . rmail-output)) 424 '("Output (inbox)..." . rmail-output))
@@ -691,31 +692,66 @@ Instead, these commands are available:
691 (interactive "FRun rmail on RMAIL file: ") 692 (interactive "FRun rmail on RMAIL file: ")
692 (rmail filename)) 693 (rmail filename))
693 694
694;; Choose a .xmail file in dir rmail-secondary-file-directory. 695(defun rmail-find-all-files (start)
695(defun rmail-secondary-file-menu (event) 696 (if (file-accessible-directory-p start)
696 (let ((files (directory-files rmail-secondary-file-directory nil 697 (let ((files (directory-files start nil
697 rmail-secondary-file-regexp))) 698 rmail-secondary-file-regexp))
698 (if files 699 (ret nil))
699 (let* ((menu (list "Rmail Files" 700 (while files
700 (cons "Rmail Files" 701 (setq file (car files))
701 (mapcar (function (lambda (f) (cons f f))) 702 (setq files (cdr files))
702 files)))) 703 (setq ret (cons
703 (chosen (x-popup-menu event menu))) 704 (rmail-find-all-files (concat start "/" file))
704 (if chosen 705 ret)))
705 (expand-file-name chosen rmail-secondary-file-directory))) 706 (cons (file-name-nondirectory start) ret))
706 (message "No files matching %s%s found" 707 (file-name-nondirectory start)))
707 rmail-secondary-file-directory rmail-secondary-file-regexp) 708
708 nil))) 709(defun rmail-list-to-menu (menu-name l action &optional full-name)
709 710 (let ((menu (make-sparse-keymap menu-name)))
711 (mapcar
712 (function (lambda (item)
713 (if (consp item)
714 (progn
715 (setq command
716 (rmail-list-to-menu (car item) (cdr item)
717 action
718 (if full-name
719 (concat full-name "/"
720 (car item))
721 (car item))))
722 (setq name (car item)))
723 (progn
724 (setq name item)
725 (setq command
726 (list 'lambda () '(interactive)
727 (list action
728 (expand-file-name
729 (if full-name
730 (concat full-name "/" item)
731 item)
732 rmail-secondary-file-directory))))))
733 (define-key menu (vector (intern name))
734 (cons name command))))
735 l)
736 menu))
737
738(defun rmail-construct-io-menu ()
739 (let ((files (rmail-find-all-files rmail-secondary-file-directory)))
740 (if (listp files)
741 (progn
742 (define-key rmail-mode-map [menu-bar classify input-menu]
743 (cons "Input Rmail File"
744 (rmail-list-to-menu "Input Rmail File"
745 (cdr files)
746 'rmail-input)))
747 (define-key rmail-mode-map [menu-bar classify output-menu]
748 (cons "Output Rmail File"
749 (rmail-list-to-menu "Output Rmail File"
750 (cdr files)
751 'rmail-output-to-rmail-file)))))
752 (message "No files matching %s/%s found"
753 rmail-secondary-file-directory rmail-secondary-file-regexp)))
710 754
711(defun rmail-input-menu (event)
712 "Choose a new Rmail file to edit, with a menu.
713The variables `rmail-secondary-file-directory' and
714`rmail-secondary-file-regexp' control which files are offered in the menu."
715 (interactive "e")
716 (let ((file-name (rmail-secondary-file-menu event)))
717 (if file-name
718 (rmail-input file-name))))
719 755
720;;;; *** Rmail input *** 756;;;; *** Rmail input ***
721 757
@@ -2332,10 +2368,6 @@ buffer visiting that file."
2332 "Append this message to Unix mail file named FILE-NAME." 2368 "Append this message to Unix mail file named FILE-NAME."
2333 t) 2369 t)
2334 2370
2335(autoload 'rmail-output-menu "rmailout"
2336 "Output current message to another Rmail file, chosen with a menu."
2337 t)
2338
2339;;;; *** Rmail undigestification *** 2371;;;; *** Rmail undigestification ***
2340 2372
2341(autoload 'undigestify-rmail-message "undigest" 2373(autoload 'undigestify-rmail-message "undigest"