aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/message.el55
1 files changed, 26 insertions, 29 deletions
diff --git a/lisp/message.el b/lisp/message.el
index 1986454bb7e..33920059a82 100644
--- a/lisp/message.el
+++ b/lisp/message.el
@@ -679,6 +679,32 @@ Return the number of headers removed."
679 (1+ max))))) 679 (1+ max)))))
680 (message-sort-headers-1)))) 680 (message-sort-headers-1))))
681 681
682(defmacro message-y-or-n-p (question show &rest text)
683 "Ask QUESTION, displaying the rest of the arguments in a temporary buffer."
684 `(message-talkative-question 'y-or-n-p ,question ,show ,@text))
685
686(defun message-talkative-question (ask question show &rest text)
687 "Call FUNCTION with argument QUESTION, displaying the rest of the arguments in a temporary buffer if SHOW.
688The following arguments may contain lists of values."
689 (if (and show
690 (setq text (message-flatten-list text)))
691 (save-window-excursion
692 (save-excursion
693 (with-output-to-temp-buffer " *MESSAGE information message*"
694 (set-buffer " *MESSAGE information message*")
695 (mapcar 'princ text)
696 (goto-char (point-min))))
697 (funcall ask question))
698 (funcall ask question)))
699
700(defun message-flatten-list (&rest list)
701 (message-flatten-list-1 list))
702
703(defun message-flatten-list-1 (list)
704 (cond ((consp list)
705 (apply 'nconc (mapcar 'message-flatten-list-1 list)))
706 (list
707 (list list))))
682 708
683 709
684;;; 710;;;
@@ -2964,35 +2990,6 @@ Do a `tab-to-tab-stop' if not in those headers."
2964 (goto-char (point-min)) 2990 (goto-char (point-min))
2965 (pop-to-buffer cur))))))) 2991 (pop-to-buffer cur)))))))
2966 2992
2967;;; Help stuff.
2968
2969(defmacro message-y-or-n-p (question show &rest text)
2970 "Ask QUESTION, displaying the rest of the arguments in a temporary buffer."
2971 `(message-talkative-question 'y-or-n-p ,question ,show ,@text))
2972
2973(defun message-talkative-question (ask question show &rest text)
2974 "Call FUNCTION with argument QUESTION, displaying the rest of the arguments in a temporary buffer if SHOW.
2975The following arguments may contain lists of values."
2976 (if (and show
2977 (setq text (message-flatten-list text)))
2978 (save-window-excursion
2979 (save-excursion
2980 (with-output-to-temp-buffer " *MESSAGE information message*"
2981 (set-buffer " *MESSAGE information message*")
2982 (mapcar 'princ text)
2983 (goto-char (point-min))))
2984 (funcall ask question))
2985 (funcall ask question)))
2986
2987(defun message-flatten-list (&rest list)
2988 (message-flatten-list-1 list))
2989
2990(defun message-flatten-list-1 (list)
2991 (cond ((consp list)
2992 (apply 'append (mapcar 'message-flatten-list-1 list)))
2993 (list
2994 (list list))))
2995
2996(run-hooks 'message-load-hook) 2993(run-hooks 'message-load-hook)
2997 2994
2998(provide 'message) 2995(provide 'message)