From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: General variable for verbosity level. (was: saveplace: don't ask for coding system) Date: Sun, 02 Dec 2007 17:04:27 -0800 Message-ID: <877ijwlhb8.fsf_-_@red-bean.com> References: <198E2B70-D060-41D8-8BC2-A9614C2729CC@inf.ed.ac.uk> <6C0C2889-2C17-4E5C-BDB3-CB4F51BE163A@gmail.com> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1196643889 15763 80.91.229.12 (3 Dec 2007 01:04:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Dec 2007 01:04:49 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: David Reitter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 03 02:04:56 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Iyzjz-0001Jx-6L for ged-emacs-devel@m.gmane.org; Mon, 03 Dec 2007 02:04:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iyzji-0003gc-Q4 for ged-emacs-devel@m.gmane.org; Sun, 02 Dec 2007 20:04:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iyzjf-0003fH-9F for emacs-devel@gnu.org; Sun, 02 Dec 2007 20:04:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iyzjd-0003eQ-L8 for emacs-devel@gnu.org; Sun, 02 Dec 2007 20:04:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iyzjd-0003eN-IS for emacs-devel@gnu.org; Sun, 02 Dec 2007 20:04:33 -0500 Original-Received: from sanpietro.red-bean.com ([66.146.193.61]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Iyzja-0004Q2-TC; Sun, 02 Dec 2007 20:04:31 -0500 Original-Received: from localhost ([127.0.0.1]:49288) by sanpietro.red-bean.com with esmtp (Exim 4.68) (envelope-from ) id 1IyzjX-0003BU-Oo; Sun, 02 Dec 2007 19:04:28 -0600 In-Reply-To: <6C0C2889-2C17-4E5C-BDB3-CB4F51BE163A@gmail.com> (David Reitter's message of "Thu\, 29 Nov 2007 00\:25\:29 +0000") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:84522 Archived-At: David Reitter 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