Alternatives to Emacs
- Compatibility and Requirements
(require 'express) (express-install-aliases) (express "important message") (with-message-logonly (do-something-noisy))
express.el provides alternatives to Emacs' built-in
This library is generally only useful when programming in Emacs Lisp.
However, some end-users may find it useful to control messaging,
especially for the case of quietening chatty libraries in their
~/.emacs files (see
message alternatives below).
express function by default works differently from
message in almost every respect.
The arguments to the familiar
message function are a format string
followed by any number of arguments which may be substituted into the
format string. This flexible syntax obviates any arguments to control
the behavior of
express, by contrast, takes as its first argument a preformatted
value to display. Subsequent arguments control its behavior.
The full argument spec for the
express function is:
CONTENT &optional QUIET SECONDS NOCOLOR LOG NOTIFY POPUP
The docstring is included here:
Transiently and noticeably display CONTENT in the echo area.
CONTENT should be a pre-
formatted if it is a string.
CONTENT will be coerced to a string if it is not a string.
Optional QUIET suppresses the bell, which is on by default.
Optional SECONDS determines the number of seconds CONTENT will be
displayed before reverting to the previous content of the echo
area. Default is
express-message-seconds. If SECONDS is 0, or
non-numeric, the message is not timed out, and remains visible
until the next write to the echo area.
Optional NOCOLOR suppresses coloring the message with face held
in the variable
Optional LOG enables logging of CONTENT for any non-nil value.
If LOG is
'log-only, then CONTENT goes only to the *Messages*
buffer and all other options are ignored.
Optional NOTIFY enables sending the message via the notifications
system of the underlying OS. The default is nil. If NOTIFY is
'replace-echo, then the notification will be used instead of the
echo area. For any other non-nil value, the notification will be
used in addition to the echo area.
Optional POPUP enables sending the message via
popup.el. The default is nil. If POPUP is
the popup will be used instead of the echo area. For any other
non-nil value, the popup will be used in addition to the echo area.
The behavior of
express is very different from
String CONTENT must already be passed through
Non-strings are accepted for CONTENT.
The content is displayed with added color.
The bell is rung.
CONTENT is not written to the messages buffer (log).
After display, the previous contents of the echo area are restored.
The following forms using
express are equivalent:
(message "hello, %s" name) (express (format "hello, %s" name) 'quiet 0 'nocolor 'log)
The variant function
express* has identical functionality to
but takes CL-style arguments:
(express* "hello" :quiet 0)
The following functions provided by this library are drop-in
message which may be useful in an
express-message-nolog express-message-logonly express-message-highlight express-message-insert express-message-notify express-message-popup express-message-temp express-message-string
The following macros modify the behavior of
the enclosing expression:
express-with-message-nolog express-with-message-logonly express-with-message-highlight express-with-message-insert express-with-message-notify express-with-message-popup express-with-message-temp express-with-message-string
For example, the following code would redirect messages from a very chatty library to the log:
(express-with-message-nolog (require 'very-chatty-library))
The same method may also be handy with
(defadvice very-chatty-function (around very-chatty-redirect activate) (express-with-message-nolog ad-do-it))
Similarly, important messages may be redirected to a more visible form:
(defadvice an-important-function (around an-important-function activate) (express-with-message-notify ad-do-it))
express-install-aliases or setting the corresponding
customize will install convenience aliases outside
express- namespace. This is disabled by default.
express-message-noformat is also available, but it
is not quite a drop-in replacement for
message is a subr. Macros such as
will only affect calls to
message from Lisp.
Compatibility and Requirements
GNU Emacs version 24.4 : yes, at the time of writing GNU Emacs version 24.3 : yes GNU Emacs version 23.3 : yes GNU Emacs version 22.2 : yes, with some limitations GNU Emacs version 21.x and lower : unknown