From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#19363: Acknowledgement (24.4.1; Notifications can make ERC unusable) Date: Wed, 31 Dec 2014 09:46:20 -0800 Message-ID: <877fx7n24i.fsf@secretsauce.net> References: <87r3w4njp1.fsf@secretsauce.net> <87egrgmd29.fsf@secretsauce.net> <87bnmkmbx8.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1420048038 20443 80.91.229.3 (31 Dec 2014 17:47:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Dec 2014 17:47:18 +0000 (UTC) To: 19363@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 31 18:47:12 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Y6NMW-0003Dz-9L for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 18:47:12 +0100 Original-Received: from localhost ([::1]:40951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6NMV-0006Mi-RB for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 12:47:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6NMS-0006Md-7R for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 12:47:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6NMN-00076Y-2o for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 12:47:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6NMM-00075o-Qr for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 12:47:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y6NMM-0001lM-DX for bug-gnu-emacs@gnu.org; Wed, 31 Dec 2014 12:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 31 Dec 2014 17:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19363 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19363-submit@debbugs.gnu.org id=B19363.14200480096749 (code B ref 19363); Wed, 31 Dec 2014 17:47:02 +0000 Original-Received: (at 19363) by debbugs.gnu.org; 31 Dec 2014 17:46:49 +0000 Original-Received: from localhost ([127.0.0.1]:33889 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y6NM8-0001km-59 for submit@debbugs.gnu.org; Wed, 31 Dec 2014 12:46:48 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48200) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y6NM4-0001kb-Ab for 19363@debbugs.gnu.org; Wed, 31 Dec 2014 12:46:45 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C093C206A7 for <19363@debbugs.gnu.org>; Wed, 31 Dec 2014 12:46:43 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Wed, 31 Dec 2014 12:46:43 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:references:from:to:subject:date:in-reply-to :message-id:mime-version:content-type; s=mesmtp; bh=MymVv2141Zhm PFu1XXpvibFhMRM=; b=G6DZsjMJLDFPoaDP89HQAj+QfCrumm9EI8y2ovDEWkji /vMsMJxr8vrd23URqInKIA8kO4bfONwSUjDkoNJxCC9GMxilSNjnVnSP1uFLMUaE +UNvJSAwmmMyNg7CmBOb3EAzITi11CfndN2iwd9OFWfQ5gx10Btsfekm0IXRphU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:references:from:to:subject :date:in-reply-to:message-id:mime-version:content-type; s= smtpout; bh=MymVv2141ZhmPFu1XXpvibFhMRM=; b=TRQAC4kGBQzTe+JtHUt6 KT2tYsuTTSSMThu6vtPJUFeE0UxrvhQiMXujmc/gKyk/5cmJWkzODaXGrBH099rm I15XlgooJ1dC3/VmrLA8CBLQ4w1e0lXr68A1XZTO4dVadT1Wp5JwTfRqYbn/iSNv 8PZphdO9uA4ms3nbx7+yY3o= X-Sasl-enc: EpkscZKKX95MQcUxNdXmPk3rLzNOa0dLQLKOqlter0CL 1420048001 Original-Received: from shorty.local (unknown [172.56.0.110]) by mail.messagingengine.com (Postfix) with ESMTPA id E9A29680135 for <19363@debbugs.gnu.org>; Wed, 31 Dec 2014 12:46:41 -0500 (EST) Original-Received: from dima by shorty.local with local (Exim 4.84) (envelope-from ) id 1Y6NLy-0006go-DW for 19363@debbugs.gnu.org; Wed, 31 Dec 2014 09:46:38 -0800 In-reply-to: <87bnmkmbx8.fsf@secretsauce.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:97897 Archived-At: --=-=-= Content-Type: text/plain Here's a solution to THIS bug, for real this time. I'm attaching a tested-working patch. I'm no longer sure this is a regression since it's very sensitive to load order. In emacs 24.3 if ERC is byte-compiled then the bug manifests, but if it isn't then it works ok. In any case, the patch solves the issue regardless. To reiterate, ERC works if you start emacs with no init file, and then evaluate (require 'erc) (require 'erc-desktop-notifications) (erc-notifications-enable) However ERC does NOT work if you start with just this in the init file: (eval-after-load 'erc '(progn (require 'erc-desktop-notifications) (erc-notifications-enable) )) The issue is that in the working case, the value of erc-server-PRIVMSG-functions ends up as (erc-notifications-PRIVMSG erc-auto-query erc-server-PRIVMSG) and in the broken case as (erc-auto-query erc-notifications-PRIVMSG) erc-server-PRIVMSG is important, so ERC does not work correctly if it is missing. This missing element is normally added in erc-backend.el by (define-erc-response-handler (PRIVMSG NOTICE) ... which is a macro. In the macro, the significant line is (defvar ,hook-name ',fn-name ,(format hook-doc name)) If we have some (eval-after-load 'erc ...) stuff then by the time this (defvar) is evaluated, the list may already have a value, so the defvar then does NOT add its value to the list. The patch explicitly changes the (defvar list default) idiom to (defvar list nil) (add-to-list 'list default) and thus the default value always appears in the list. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ERC-no-longer-gets-confused-by-eval-after-load-erc.patch >From 28bc9430ce6342d210e986586af7b6f12e103043 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Wed, 31 Dec 2014 08:13:57 -0800 Subject: [PATCH] ERC no longer gets confused by (eval-after-load 'erc ...) ERC was initializing one of its lists with (defvar list default). If the list already had a value due to (eval-after-load 'erc ...) for instance, then (defvar) would see an initialized variable, and would NOT add the default value to the list. This was breaking things. This patch changes the above defvar idiom to (defvar list nil) (add-to-list 'list default) This way the default value is added to the list unconditionally Closes: #19363 --- lisp/erc/erc-backend.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index fa95d7e..43e56c0 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -1179,8 +1179,11 @@ add things to `%s' instead." (cl-loop for alias in aliases collect (intern (format "erc-server-%s-functions" alias))))) `(prog2 - ;; Normal hook variable. - (defvar ,hook-name ',fn-name ,(format hook-doc name)) + ;; Normal hook variable. The variable may already have a + ;; value at this point, so I default to nil, and (add-hook) + ;; unconditionally + (defvar ,hook-name nil ,(format hook-doc name)) + (add-to-list ',hook-name ',fn-name) ;; Handler function (defun ,fn-name (proc parsed) ,fn-doc -- 2.1.3 --=-=-=--