emacs-devel
[Top][All Lists]
Advanced

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

General variable for verbosity level. (was: saveplace: don't ask for cod


From: Karl Fogel
Subject: General variable for verbosity level. (was: saveplace: don't ask for coding system)
Date: Sun, 02 Dec 2007 17:04:27 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

David Reitter <address@hidden> writes:
> I wonder if this hasn't come up before: could we not have a global
> verbosity level? If it is well-defined, all parts including modes
> could respect it.
>
> One could have an optional argument to `message', indicating the level
> of the particular message.

In this change:

   
http://cvs.savannah.gnu.org/viewvc/emacs/lisp/saveplace.el?root=emacs&r1=1.38&r2=1.39

...I added a boolean that tells saveplace.el whether or not to print
loading/saving messages.  David Reitter rightly points out that it
would make more sense to have this be a generic variable that many
packages in Emacs could use.  For example, it could subsume these two:

  gmm-message
  Function: If LEVEL is lower than `gmm-verbose' print ARGS using `message'.

  gnus-message
  Function: If LEVEL is lower than `gnus-verbose' print ARGS using `message'.

(No doubt there are other examples elsewhere in Emacs.)

The purpose of this email is to figure out whether/how we should
implement such a system.  Proposal: a new function and new variable:

   maybe-message LEVEL FORMAT_STRING &optional FORMAT_ARGS
   Function: Print FORMAT_STRING formatted with FORMAT_ARGS iff LEVEL
             is equal to or higher than `message-verbosity-level'.

   message-verbosity-level
   Variable: Say which messages are printed by `maybe-message' (which see)
             in non-interactive contexts.

For interactive functions, `maybe-message' should behave just like
`message' does today.  But should `message-verbosity-level' be a
number, or something else?  It could be, for example, a symbol:

   message-verbosity-level:
     `none'       ==>  print no messages (except errors)
     `important'  ==>  print only important messages
     `regular'    ==>  ...

This has the advantages of being clearer to users, and of allowing us
to cleanly insert new verbosity levels in the future.

I'm avoiding proposing a system of overlapping categories; that is,
where you'd set the variable to a list of symbols, and maybe-message
would print iff the level specified by the code matched any of them.
While that would be the most flexible system, I'm not sure we really
need that level of complexity here.

Please comment.  Feel free to trash this system in favor of something
entirely different -- I'm not wedded to it, I'm just trying to get the
conversation started.

-Karl




reply via email to

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