emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More noticeable version of (message)


From: Lennart Borgman
Subject: Re: More noticeable version of (message)
Date: Thu, 3 Nov 2011 19:16:01 +0100

On Thu, Nov 3, 2011 at 17:23, Jambunathan K <address@hidden> wrote:
> Yagnesh Raghava Yakkala <address@hidden> writes:
>
>> Hi Jambunathan,
>>
>> Jambunathan K <address@hidden> writes:
>>
>>> Jambunathan K <address@hidden> writes:
>>>
>>>> Craig Muth <address@hidden> writes:
>>>>
>>>>> I often don't notice the output of lines like (message "hi"),
>>>>> especially when in full-screen mode.
>>>>>
>>>>> Any ideas?  Not a huge fan of beeping because I associate that with
>>>>> an error.  I'm on a mac so any face/font stuff is fair game.
>>>>
>>>> Try this:
>>>>
>>>> (fset 'message-plain (symbol-function 'message))
>>>>
>>>> (defun message-colored (fmt-string &rest args)
>>>>   (message-plain
>>>>    (propertize
>>>>     (apply 'format fmt-string args)
>>>>     'face 'font-lock-comment-face)))
>>>>
>>>> (fset 'message 'message-colored)
>>>> You will see that the messages appear in comment face.
>>>
>>> This is an elegant variation of the above.
>>
>>>
>>> (defadvice message
>>>   (before colored-message activate)
>>>   (ad-set-arg 0 (propertize (ad-get-arg 0) 'face 'font-lock-comment-face)))

Here is the version I am using in nXhtml:


(defun web-vcs-message-with-face (face format-string &rest args)
  "Display a colored message at the bottom of the string.
FACE is the face to use for the message.
FORMAT-STRING and ARGS are the same as for `message'.

Also put FACE on the message in *Messages* buffer."
  (with-current-buffer "*Messages*"
    (save-restriction
      (widen)
      (let* ((start (let ((here (point)))
                      (goto-char (point-max))
                      (prog1
                          (copy-marker
                           (if (bolp) (point-max)
                             (1+ (point-max))))
                        (goto-char here))))
             (msg-with-face (propertize (apply 'format format-string args)
                                        'face face)))
        ;; This is for the echo area:
        (message "%s" msg-with-face)
        ;; This is for the buffer:
        (when (< 0 (length msg-with-face))
          (goto-char (1- (point-max)))
          ;;(backward-char)
          ;;(unless (eolp) (goto-char (line-end-position)))
          (put-text-property start (point)
                             'face face))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]