From unknown Wed Jun 25 00:22:53 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8387 <8387@debbugs.gnu.org> To: bug#8387 <8387@debbugs.gnu.org> Subject: Status: 24.0.50; `run-hook-with-args' return value has changed Reply-To: bug#8387 <8387@debbugs.gnu.org> Date: Wed, 25 Jun 2025 07:22:53 +0000 retitle 8387 24.0.50; `run-hook-with-args' return value has changed reassign 8387 emacs submitter 8387 Michael Welsh Duggan severity 8387 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 31 02:26:05 2011 Received: (at submit) by debbugs.gnu.org; 31 Mar 2011 06:26:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5BKX-00067I-75 for submit@debbugs.gnu.org; Thu, 31 Mar 2011 02:26:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5BKR-00066l-Df for submit@debbugs.gnu.org; Thu, 31 Mar 2011 02:26:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5BKC-00033H-Da for submit@debbugs.gnu.org; Thu, 31 Mar 2011 02:25:54 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:35963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5BKC-000336-B2 for submit@debbugs.gnu.org; Thu, 31 Mar 2011 02:25:44 -0400 Received: from [140.186.70.92] (port=49607 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5BKA-0001tN-UM for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2011 02:25:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5BK9-00032g-Ie for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2011 02:25:42 -0400 Received: from md5i.com ([75.151.244.229]:37205 helo=maru.md5i.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5BK9-00031O-FQ for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2011 02:25:41 -0400 Received: from md5i by maru.md5i.com with local (Exim 4.74) (envelope-from ) id 1Q5BK2-0006D3-Eq for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2011 02:25:34 -0400 From: Michael Welsh Duggan To: bug-gnu-emacs@gnu.org Subject: 24.0.50; `run-hook-with-args' return value has changed Date: Thu, 31 Mar 2011 02:25:34 -0400 Message-ID: <877hbfn6w1.fsf@maru.md5i.com> User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) emacs -Q (defun foo (arg) 'test) C-j (defvar foo-hook '(foo)) C-j (run-hook-with-args 'foo-hook 'foo) C-j In the past, this would return 'test instead of nil. This breaks some code, in particular bbdb, which has the following: (defun bbdb-canonicalize-address (net) ;; call the bbdb-canonicalize-net-hook repeatedly until it returns a ;; value eq to the value passed in. This implies that it can't ;; destructively modify the string. ;; Hysterical Raisins: This is a function, not a hook. In order to ;; make this hook a hook, we'll quietly convert a single function ;; into a hook list. We should really warn the user that we're ;; doing this, and advise them to update their configuration ;; accordingly. For the release, maybe. (if (functionp bbdb-canonicalize-net-hook) (setq bbdb-canonicalize-net-hook (list bbdb-canonicalize-net-hook))) ;; Now, do the hook run. Note, if you mess up, it's possible that ;; BBDB will get stuck here oscillating between various definitions ;; of the canonical address. (while (not (equal net (setq net (run-hook-with-args 'bbdb-canonicalize-net-hook net))))) net) I don't have time to test this right now, but I would guess this started happening in the following commit: 2011-03-28 Stefan Monnier * keyboard.c (safe_run_hook_funcall): New function. (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error, don't set the hook to nil, but remove the offending function instead. (Qcommand_hook_internal): Remove, unused. (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define Vcommand_hook_internal. * eval.c (enum run_hooks_condition): Remove. (funcall_nil, funcall_not): New functions. (run_hook_with_args): Call each function through a `funcall' argument. Remove `cond' argument, now redundant. (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success) (Frun_hook_with_args_until_failure): Adjust accordingly. (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions. In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.3) of 2011-03-30 on maru Windowing system distributor `The X.Org Foundation', version 11.0.10707000 configured using `configure '--without-toolkit-scroll-bars'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t -- Michael Welsh Duggan (md5i@md5i.com) From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 31 11:02:57 2011 Received: (at 8387) by debbugs.gnu.org; 31 Mar 2011 15:02:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5JOj-00035x-0z for submit@debbugs.gnu.org; Thu, 31 Mar 2011 11:02:57 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5JOh-00035m-CB for 8387@debbugs.gnu.org; Thu, 31 Mar 2011 11:02:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAFeXlE1FxLZM/2dsb2JhbAClTHiIebZAhWsEliU X-IronPort-AV: E=Sophos;i="4.63,275,1299474000"; d="scan'208";a="98786440" Received: from 69-196-182-76.dsl.teksavvy.com (HELO ceviche.home) ([69.196.182.76]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 31 Mar 2011 11:02:49 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 2CEF8660C7; Thu, 31 Mar 2011 11:02:49 -0400 (EDT) From: Stefan Monnier To: Michael Welsh Duggan Subject: Re: bug#8387: 24.0.50; `run-hook-with-args' return value has changed Message-ID: References: <877hbfn6w1.fsf@maru.md5i.com> Date: Thu, 31 Mar 2011 11:02:49 -0400 In-Reply-To: <877hbfn6w1.fsf@maru.md5i.com> (Michael Welsh Duggan's message of "Thu, 31 Mar 2011 02:25:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8387 Cc: 8387@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > (defun foo (arg) 'test) C-j > (defvar foo-hook '(foo)) C-j > (run-hook-with-args 'foo-hook 'foo) C-j > In the past, this would return 'test instead of nil. This breaks some [...] > I don't have time to test this right now, but I would guess this started > happening in the following commit: [...] > (run_hook_with_args): Call each function through a `funcall' argument. > Remove `cond' argument, now redundant. > (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success) > (Frun_hook_with_args_until_failure): Adjust accordingly. No doubt it's the origin of the new behavior. But note that the above change has not touched the docstring of run-hook-with-args which says: It is best not to depend on the value returned by `run-hook-with-args', as that may change. Looking at the BBDB code, I think we don't need to try and accomodate it because it is fundamentally broken, not just because of the above docstring warning: ;; Hysterical Raisins: This is a function, not a hook. In order to ;; make this hook a hook, we'll quietly convert a single function ;; into a hook list. We should really warn the user that we're ;; doing this, and advise them to update their configuration ;; accordingly. For the release, maybe. (if (functionp bbdb-canonicalize-net-hook) (setq bbdb-canonicalize-net-hook (list bbdb-canonicalize-net-hook))) ;; Now, do the hook run. Note, if you mess up, it's possible that ;; BBDB will get stuck here oscillating between various definitions ;; of the canonical address. (while (not (equal net (setq net (run-hook-with-args 'bbdb-canonicalize-net-hook net))))) So bbdb-canonicalize-net-hook can start as a single function or a list of functions. But the code is explicit about wanting a list of functions. Now if this list contains N>1 function, then run-hook-with-args has to call all those functions and discard at least N-1 of the results. I.e. only one of the functions on bbdb-canonicalize-net-hook can work (in Emacs-23, one of them happened to work, and on the current trunk, none of them work). Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 31 11:03:09 2011 Received: (at 8387-done) by debbugs.gnu.org; 31 Mar 2011 15:03:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5JOu-00036f-Vt for submit@debbugs.gnu.org; Thu, 31 Mar 2011 11:03:09 -0400 Received: from mail-qy0-f172.google.com ([209.85.216.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5JOs-00036F-Oo for 8387-done@debbugs.gnu.org; Thu, 31 Mar 2011 11:03:07 -0400 Received: by qyk29 with SMTP id 29so3529418qyk.3 for <8387-done@debbugs.gnu.org>; Thu, 31 Mar 2011 08:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=TbwIuQNI72uPyqSc8ZDFj3LmhsBQfHhTa+cHgl1lgOU=; b=gzVrvy+OBJlsYa1n7KVDld0pmsiFe3HN3V/c52mu2Q1QlFbXVkB8yPvx5br1fRabHi DL1uLaaDQI5Gw6OYevcyn12Z1Gka4W963XS6vql+qys284GQ/ldubM4wR2Wfcb5AA0eM aLWktzeJBHINvo7NmQoL7GyyjGhfoEDtnzghc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=m4Eo3ovAjGXiylEWiH7C2rkuwfQ73T1H6lIbEhI+oF6/Pz14d37HmhiDiEDTEyKR/d SUtqoolFYIrJloNX+JAZhIKwZAm3XLvktTCMToVs7QQTTE2LI9TDs21k7hK+m1CRLC5D 1BgVM265tzSkPmYx732OjEMB8KRzyzrl+vdeU= Received: by 10.229.73.25 with SMTP id o25mr2252598qcj.208.1301583781293; Thu, 31 Mar 2011 08:03:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.94.207 with HTTP; Thu, 31 Mar 2011 08:02:21 -0700 (PDT) In-Reply-To: <877hbfn6w1.fsf@maru.md5i.com> References: <877hbfn6w1.fsf@maru.md5i.com> From: Juanma Barranquero Date: Thu, 31 Mar 2011 17:02:21 +0200 Message-ID: Subject: Re: bug#8387: 24.0.50; `run-hook-with-args' return value has changed To: Michael Welsh Duggan Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 8387-done Cc: 8387-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) On Thu, Mar 31, 2011 at 08:25, Michael Welsh Duggan wrote: > (run-hook-with-args 'foo-hook 'foo) C-j > > In the past, this would return 'test instead of nil. =C2=A0This breaks so= me > code, in particular bbdb, which has the following: I'm closing this one, as it is not a bug. The docstring of `run-hook-with-args' contains this bit, since at least Emacs 22.1: "It is best not to depend on the value returned by `run-hook-with-args', as that may change." =C2=A0 =C2=A0 Juanma From unknown Wed Jun 25 00:22:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 29 Apr 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator