comparison lisp/message.el @ 15864:c21d455f162f

(message-y-or-n-p, message-talkative-question, message-flatten-list, message-flatten-list-1): Move utility functions up so macro is defined before first invocation.
author Erik Naggum <erik@naggum.no>
date Wed, 14 Aug 1996 02:09:54 +0000
parents 45f40424c2d7
children 9f99285bb635
comparison
equal deleted inserted replaced
15863:f11b2bfc1275 15864:c21d455f162f
677 message-header-format-alist))) 677 message-header-format-alist)))
678 (- max rank) 678 (- max rank)
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.
688 The 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 ;;;
685 ;;; Message mode 711 ;;; Message mode
686 ;;; 712 ;;;
2962 (let ((standard-output (current-buffer))) 2988 (let ((standard-output (current-buffer)))
2963 (display-completion-list (sort completions 'string<))) 2989 (display-completion-list (sort completions 'string<)))
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.
2975 The 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)
2999 2996
3000 ;;; message.el ends here 2997 ;;; message.el ends here