From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: wrapper fn for message and minibuffer-message? Date: Wed, 5 Oct 2005 09:23:10 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1128529569 15283 80.91.229.2 (5 Oct 2005 16:26:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Oct 2005 16:26:09 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 05 18:25:53 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ENC3I-0003a5-Do for ged-emacs-devel@m.gmane.org; Wed, 05 Oct 2005 18:23:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ENC3H-0006Zk-Nl for ged-emacs-devel@m.gmane.org; Wed, 05 Oct 2005 12:23:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ENC32-0006Z3-Tv for emacs-devel@gnu.org; Wed, 05 Oct 2005 12:23:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ENC31-0006Wd-5O for emacs-devel@gnu.org; Wed, 05 Oct 2005 12:23:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ENC30-0006Wa-Ur for emacs-devel@gnu.org; Wed, 05 Oct 2005 12:23:14 -0400 Original-Received: from [148.87.122.31] (helo=rgminet02.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ENC30-0000DQ-Gy for emacs-devel@gnu.org; Wed, 05 Oct 2005 12:23:14 -0400 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by rgminet02.oracle.com (Switch-3.1.6/Switch-3.1.7) with ESMTP id j95GNBQR016907 for ; Wed, 5 Oct 2005 10:23:11 -0600 Original-Received: from rgmsgw300.us.oracle.com (localhost [127.0.0.1]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j95GNBjD018113 for ; Wed, 5 Oct 2005 10:23:11 -0600 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id j95GNAG2018105 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Wed, 5 Oct 2005 10:23:11 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43577 Archived-At: > (defun msg-maybe-in-minibuffer (string &rest args) > "Display STRING with `message' or `minibuffer-message', as appropriate." > (if (active-minibuffer-window) > (minibuffer-message (format " [%s]" string)) > (message string))) I agree 100% with the intention. Typical such messages are the completion messages, for completion functions that can be used both in the minibuffer and in normal buffers. Yes, that's what I had in mind. Of course I'd define it more like (defun msg-maybe-in-minibuffer (format &rest args) "Display STRING with `message' or `minibuffer-message', as appropriate." (if (minibufferp) (minibuffer-message (apply 'format (concat " [" format "]") args)) (apply 'message format args))) Yes. I use (active-minibuffer-window) because I want the code to work on Emacs 20 also (where there is no `minibufferp'). Suggestion: Name the argument FORMAT-STRING, not FORMAT, for less confusion with the function. (And use that name in the doc string, instead of STRING.) (defun display-message (format-string &rest args) "Display FORMAT-STRING as a message. If called with the minibuffer active, this is done using `message'. Otherwise, it is done using `minibuffer-message'." (if (minibufferp) (minibuffer-message (apply 'format (concat " [" format-string "]") args)) (apply 'message format-string args))) I'd even argue that this function should be called "minibuffer-message", since currently minibuffer-message is only used when (minibufferp) is non-nil. I'm confused here. If used outside of the minibuffer, it is not a "minibuffer-message" at all, is it? Wouldn't the name `minibuffer-message' be misleading, in that case? The best name for the function would really be "message", with today's `message' being called something like `log-message' (since it logs to *Messages*). Otherwise, if it's a no-no to co-opt the standard `message' name, a name like "display-message" might be OK for this. WDOT?