From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72993: 31.0.50; 4f521fa14c18f57e5207bffd68e9f79454dccc79 breaks binding mode hooks in use-package Date: Wed, 04 Sep 2024 14:31:27 +0300 Message-ID: <86v7zb64fk.fsf@gnu.org> References: <87mskpo5qc.fsf@stebalien.com> <86v7zd79ds.fsf@gnu.org> <86msko7vzx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40653"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72993@debbugs.gnu.org, steven@stebalien.com To: John Wiegley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 04 13:32:31 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sloFT-000APN-Ne for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Sep 2024 13:32:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sloFD-0001Dz-On; Wed, 04 Sep 2024 07:32:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sloF0-0000f8-EB for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2024 07:32:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sloEx-0008Fd-K3 for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2024 07:32:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=VNWL76Sia9EHSfyoS7gmKbXOJPIC8CqLXo4pOkFVWY0=; b=dVlZ6soLIYA4FXB35fqk4ydR4Ag/OkRMEtP2vZmeCYkYmkbP3OwWgZxssqicx8GdKBQfDETWcL2ESsfuUuYYMa8Th4DxVIQdIofy1lwyIOlj633SiyU0GYFHCiy346jm68FOoKTUIPVlmziBvMnOcZmfbQi641UsMj8iAkz4Z5Pr7xRWleDngLj8MfQSoRlERr9DmEkc6ITgXfVVOB6jTlJYiyHJhIqiee/uIJgHeSs/pGz8dUjLpgdrnRCDEBE2vve8KHpKqv2UwzzB7xPLQfJ5jnvRrtrM0UXBeWGuygyqn925ZXFlKGIGCEQqJGz3EvR8KKXU+TY7Gp6TaHUWmQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sloFy-0006XE-Eb for bug-gnu-emacs@gnu.org; Wed, 04 Sep 2024 07:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Sep 2024 11:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72993 X-GNU-PR-Package: emacs Original-Received: via spool by 72993-submit@debbugs.gnu.org id=B72993.172544956325088 (code B ref 72993); Wed, 04 Sep 2024 11:33:02 +0000 Original-Received: (at 72993) by debbugs.gnu.org; 4 Sep 2024 11:32:43 +0000 Original-Received: from localhost ([127.0.0.1]:33701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sloFe-0006WZ-QV for submit@debbugs.gnu.org; Wed, 04 Sep 2024 07:32:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sloFc-0006WE-2x for 72993@debbugs.gnu.org; Wed, 04 Sep 2024 07:32:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sloEU-00089A-Sb; Wed, 04 Sep 2024 07:31:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=nDvs4ocXzdQo/b6KnA5TgtkqUGcymZH+gTNZ09Jb8jw=; b=izXMM4EwzZ5K7KhNAZIr tXgukKvndaFQ8QAMbN2hEs3fZ3l0+mISwb1d/Cwe3kMhLxLoCoAwQ2ZfVPmOHlg8kzVHCk82DiV9L +jj8J4Nr2FB7boX1VnPQ1lkotInx03eVwuz15lYcP2+h1YPrvN8FHvWf4Xy196VPLTNUQCbM90xfY pAkzkP65Y4lfJewIWkt7enYJ7KY6rogiXdXs15GVyzEaCZEbRiZvZI7d+k6ULJ9Fcev9A68LntiUj 4FVKpS3J3awGFFCSL7iPtrX3THEAnQneCKeF82+koCEE+nEsoicVYs3ty1Bn+6a+o0J5xmouzK86o Kdp3Q1UgZVAoKQ==; In-Reply-To: (message from John Wiegley on Tue, 03 Sep 2024 15:35:48 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291191 Archived-At: > From: John Wiegley > Cc: steven@stebalien.com, 72993@debbugs.gnu.org > Date: Tue, 03 Sep 2024 15:35:48 -0700 > > >>>>> Eli Zaretskii writes: > > >> Perhaps we should avoid auto -hook’ifying the variable name only if the name > >> does not already end in ‘-functions’? > > > Either that, or maybe exempt FOO-mode from the boundp test. > > This sounds likely to be even better. Like the below? diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 2c5fc56..6c3d350 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -1376,13 +1376,16 @@ use-package-handler/:hook (when fun (mapcar #'(lambda (sym) - (if (boundp sym) - `(add-hook (quote ,sym) (function ,fun)) - `(add-hook - (quote ,(intern - (concat (symbol-name sym) - use-package-hook-name-suffix))) - (function ,fun)))) + (let ((symname (symbol-name sym))) + (if (and (boundp sym) + ;; Mode variables are usually bound, but + ;; their hooks are named FOO-mode-hook. + (not (string-suffix-p "-mode" symname))) + `(add-hook (quote ,sym) (function ,fun)) + `(add-hook + (quote ,(intern + (concat symname use-package-hook-name-suffix))) + (function ,fun))))) (use-package-hook-handler-normalize-mode-symbols syms))))) (use-package-normalize-commands args))))