changeset 7321:f8ee542dbe80

(rmail-input-menu): Don't call expand-file-name. Do nothing if rmail-secondary-file-menu return nil. (rmail-secondary-file-menu): If no files match, warn and return nil.
author Richard M. Stallman <rms@gnu.org>
date Wed, 04 May 1994 22:00:30 +0000
parents f44f181c3748
children 1f3536445289
files lisp/mail/rmail.el
diffstat 1 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Wed May 04 22:00:01 1994 +0000
+++ b/lisp/mail/rmail.el	Wed May 04 22:00:30 1994 +0000
@@ -678,21 +678,29 @@
 
 ;; 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
-				 rmail-secondary-file-regexp))
-	 (menu (list "Rmail Files"
-		     (cons "Rmail Files"
-			   (mapcar (function (lambda (f) (cons f f)))
-				   files))))
-	 (chosen (x-popup-menu event menu)))
-    (if chosen
-	(expand-file-name chosen rmail-secondary-file-directory))))
+  (let ((files (directory-files rmail-secondary-file-directory nil
+				rmail-secondary-file-regexp)))
+    (if files
+	(let* ((menu (list "Rmail Files"
+			   (cons "Rmail Files"
+				 (mapcar (function (lambda (f) (cons f f)))
+					 files))))
+	       (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)
+      nil)))
+
 
 (defun rmail-input-menu (event)
-  "Choose a new Rmail file to edit, with a menu."
+  "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")
-  (rmail-input (expand-file-name (rmail-secondary-file-menu event)
-				 rmail-secondary-file-directory)))
+  (let ((file-name (rmail-secondary-file-menu event)))
+    (if file-name
+	(rmail-input file-name))))
 
 ;;;; *** Rmail input ***