From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jarek Czekalski Newsgroups: gmane.emacs.devel Subject: Re: command-error-function default handler Date: Sun, 27 Oct 2013 14:48:30 +0100 Message-ID: <526D19AE.70004@poczta.onet.pl> References: <526C14F8.2080408@poczta.onet.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1382881719 27175 80.91.229.3 (27 Oct 2013 13:48:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Oct 2013 13:48:39 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 27 14:48:44 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VaQhw-0006a4-9z for ged-emacs-devel@m.gmane.org; Sun, 27 Oct 2013 14:48:44 +0100 Original-Received: from localhost ([::1]:37818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VaQhv-0006st-PB for ged-emacs-devel@m.gmane.org; Sun, 27 Oct 2013 09:48:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VaQhp-0006so-E5 for emacs-devel@gnu.org; Sun, 27 Oct 2013 09:48:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VaQhk-0007bx-FE for emacs-devel@gnu.org; Sun, 27 Oct 2013 09:48:37 -0400 Original-Received: from smtpo15.poczta.onet.pl ([213.180.142.146]:53328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VaQhk-0007br-40 for emacs-devel@gnu.org; Sun, 27 Oct 2013 09:48:32 -0400 Original-Received: from [192.168.17.9] (cj.e-siemianowice.pl [95.215.234.30]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jarekczek@poczta.onet.pl) by smtp.poczta.onet.pl (Onet) with ESMTPSA id 3d70l24SnSzZCXkr for ; Sun, 27 Oct 2013 14:48:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poczta.onet.pl; s=2011; t=1382881710; bh=QONmWMPWYXIAHSMdWfktdMd+PnhvddAOB8bJNHr260I=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=bA6DUo8s8UGaVy7moQCUr8vH35zUv0inScHhD/96L9qHbuXToY3DAy0IDnTiR/P2g jE59Wh2ZQVw99AdWzTA+k2eNZQLDQsTFVvyF9yfHuC0T2C6r5LgMCtnj13FbbgIuDU vDNHFiyf+tkgyan323YgNChGN+Ukh0juYeORlH2I= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 213.180.142.146 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164581 Archived-At: W dniu 2013-10-27 04:44, Stefan Monnier pisze: > The way to do that right is as follows: > - change command-error-function's default value to not be nil. > - don't set command-error-function via `setq' but via `add-function'. > The first step may require changes to the C code. Now I noticed that in current state of Emacs command-error-function may not be used by a package. Only user can use it. If a package grabs it, no other package can use it. So no package at all may grab it as a result. A cumbersome workaround is possible. If the value is nil, create a first handler with standard output included. If the value is not nil (there is already other handler), do add-function and don't produce standard output. But this is a workaround, not a reasonable usage of the feature. In the meantime I probably found the answer to my question. Looking at usage of print_error_message in other files I came up with something that resembles the default handler behaviour: (defun test-handler (&optional conditions context source) (message "%s%s: %s" context source (error-message-string conditions)) ; we would also like to ring a bell here ) So this is probably something that could be added to docs. Still this feature is not yet useful for packages. A package is the place where I wanted to use it. See related bug report: 15670 [1] If I am wrong, please correct me. Jarek [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15670