Commit 8b7ef584 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

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'.
parent 20b5d24c
......@@ -280,7 +280,8 @@ If `rmail-display-summary' is non-nil, make a summary for this RMAIL file."
;; determine already unseen messages first, as rmail-get-new-mail
;; positions on the first new message, thus marking it as seen.
(rmail-show-message existing-unseen))
(if rmail-display-summary (rmail-summary))))
(if rmail-display-summary (rmail-summary))
;; Given the value of MAILPATH, return a list of inbox file names.
;; 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\^_")))
(cons "Classify" (make-sparse-keymap "Classify")))
(define-key rmail-mode-map [menu-bar classify input-menu]
'("Input Rmail file (menu)..." . rmail-input-menu))
(define-key rmail-mode-map [menu-bar classify output-menu]
'("Output (Rmail menu)..." . rmail-output-menu))
(define-key rmail-mode-map [menu-bar classify output-inbox]
'("Output (inbox)..." . rmail-output))
......@@ -691,31 +692,66 @@ Instead, these commands are available:
(interactive "FRun rmail on RMAIL file: ")
(rmail filename))
;; Choose a .xmail file in dir rmail-secondary-file-directory.
(defun rmail-secondary-file-menu (event)
(let ((files (directory-files rmail-secondary-file-directory nil
(if files
(let* ((menu (list "Rmail Files"
(cons "Rmail Files"
(mapcar (function (lambda (f) (cons f f)))
(chosen (x-popup-menu event menu)))
(if chosen
(expand-file-name chosen rmail-secondary-file-directory)))
(message "No files matching %s%s found"
rmail-secondary-file-directory rmail-secondary-file-regexp)
(defun rmail-find-all-files (start)
(if (file-accessible-directory-p start)
(let ((files (directory-files start nil
(ret nil))
(while files
(setq file (car files))
(setq files (cdr files))
(setq ret (cons
(rmail-find-all-files (concat start "/" file))
(cons (file-name-nondirectory start) ret))
(file-name-nondirectory start)))
(defun rmail-list-to-menu (menu-name l action &optional full-name)
(let ((menu (make-sparse-keymap menu-name)))
(function (lambda (item)
(if (consp item)
(setq command
(rmail-list-to-menu (car item) (cdr item)
(if full-name
(concat full-name "/"
(car item))
(car item))))
(setq name (car item)))
(setq name item)
(setq command
(list 'lambda () '(interactive)
(list action
(if full-name
(concat full-name "/" item)
(define-key menu (vector (intern name))
(cons name command))))
(defun rmail-construct-io-menu ()
(let ((files (rmail-find-all-files rmail-secondary-file-directory)))
(if (listp files)
(define-key rmail-mode-map [menu-bar classify input-menu]
(cons "Input Rmail File"
(rmail-list-to-menu "Input Rmail File"
(cdr files)
(define-key rmail-mode-map [menu-bar classify output-menu]
(cons "Output Rmail File"
(rmail-list-to-menu "Output Rmail File"
(cdr files)
(message "No files matching %s/%s found"
rmail-secondary-file-directory rmail-secondary-file-regexp)))
(defun rmail-input-menu (event)
"Choose a new Rmail file to edit, with a menu.
The variables `rmail-secondary-file-directory' and
`rmail-secondary-file-regexp' control which files are offered in the menu."
(interactive "e")
(let ((file-name (rmail-secondary-file-menu event)))
(if file-name
(rmail-input file-name))))
;;;; *** Rmail input ***
......@@ -2332,10 +2368,6 @@ buffer visiting that file."
"Append this message to Unix mail file named FILE-NAME."
(autoload 'rmail-output-menu "rmailout"
"Output current message to another Rmail file, chosen with a menu."
;;;; *** Rmail undigestification ***
(autoload 'undigestify-rmail-message "undigest"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment