From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: How to customize the face of echo area messages? Date: Sun, 2 Jan 2011 10:08:00 -0800 Message-ID: <923BF6AAACF240C8A46BF785C0D143A9@us.oracle.com> References: <546808c5-7160-4732-b8f6-b1d0d5d5e4c3@j25g2000vbs.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1293991994 15791 80.91.229.12 (2 Jan 2011 18:13:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 2 Jan 2011 18:13:14 +0000 (UTC) To: "'Antis Lathoi'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 02 19:13:10 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PZSQB-0005Gi-2s for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Jan 2011 19:13:09 +0100 Original-Received: from localhost ([127.0.0.1]:39332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZSNN-0005RH-S9 for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Jan 2011 13:09:53 -0500 Original-Received: from [140.186.70.92] (port=46472 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZSN3-0005Pb-VL for help-gnu-emacs@gnu.org; Sun, 02 Jan 2011 13:09:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZSN1-0006TG-NU for help-gnu-emacs@gnu.org; Sun, 02 Jan 2011 13:09:32 -0500 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:38387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZSN1-0006TB-DJ for help-gnu-emacs@gnu.org; Sun, 02 Jan 2011 13:09:31 -0500 Original-Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p02I9RGh001741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 Jan 2011 18:09:28 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p02Hn6qp019036; Sun, 2 Jan 2011 18:09:26 GMT Original-Received: from abhmt019.oracle.com by acsmt353.oracle.com with ESMTP id 922115301293991687; Sun, 02 Jan 2011 10:08:07 -0800 Original-Received: from dradamslap1 (/10.159.222.117) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 02 Jan 2011 10:08:07 -0800 X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Thread-Index: AcuqoXgBvmxGU8BhTuK2+Af6qGNOGwAAJ4kw In-Reply-To: <546808c5-7160-4732-b8f6-b1d0d5d5e4c3@j25g2000vbs.googlegroups.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78066 Archived-At: > I'm trying to change the appearance of messages that appear in the > echo area when you perform certain actions in emacs (e.g. saving files > --> "wrote FOOBAR", CTRL-g --> "quit"). By default these messages are > printed exactly the same way as buffer text is. I'd like to change > that (different foreground color), but didn't find anything within the > emacs customize system to do that. Ideas anyone? (defun my-msg (msg &optional face) "`message', but with text using FACE (default `highlight')." (message (propertize msg 'face (or face 'highlight)))) M-: (progn (my-msg "HELLO") (sleep-for 3)) M-: (progn (my-msg "HELLO" 'font-lock-warning-face) (sleep-for 3)) Of course, that only works for calls to `my-msg', not calls to `message' (such as what you described). You could advise `message' to catch most of those. Something like this: (defadvice message (around my-message-advice activate) "Show the message using face `font-lock-warning-face'." (ad-set-args 0 (list (propertize (apply #'format (ad-get-args 0)) 'face 'font-lock-warning-face))) ad-do-it) M-: (progn (message "Hello %s%s" 'there ", Antis") (sleep-for 3)) That works for the `message' calls from Lisp, but not for those from C. Unfortunately, the "Wrote ..." message comes from C. So you will see "Saving file foobar.el..." in face `font-lock-warning-face' but just after that you will see "Wrote foobar.el" with no special face. (That might happen so quickly that you do not notice the "Saving" message. To see it, add this just after `ad-do-it': (sleep-for 2).) Maybe someone else will have a better suggestion for you.