From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 02 12:00:14 2025 Received: (at submit) by debbugs.gnu.org; 2 Apr 2025 16:00:14 +0000 Received: from localhost ([127.0.0.1]:59069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u00Vi-0003x6-3N for submit@debbugs.gnu.org; Wed, 02 Apr 2025 12:00:14 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47026) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u00Vf-0003qs-1A for submit@debbugs.gnu.org; Wed, 02 Apr 2025 12:00:11 -0400 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 1u00VY-0006YB-Sr for bug-gnu-emacs@gnu.org; Wed, 02 Apr 2025 12:00:05 -0400 Received: from mail.hostpark.net ([212.243.197.30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u00VW-00057l-Kq for bug-gnu-emacs@gnu.org; Wed, 02 Apr 2025 12:00:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 26C6616524 for ; Wed, 02 Apr 2025 17:59:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :subject:subject:from:from; s=sel2011a; t=1743609595; bh=eBx4oFB loJQ8LGFjhPZ7FTH14MnTsoF4lRkq73qgXqE=; b=Fcdie+RVvcyypvPL/Ekhxsg JOW48tNrkV2YlZnSBv3WqtTOV9LlPqYNduSCwkuFrQ6TKLULRqLJMKsRvtowoGcC 3YPaGNHf0HX4FihWGoB69APnzldKKkJxeIT+SO31PWrFk7P+t/sGWH/JvZCM2WcC Ifr0ok/f6CbxJmoBppII= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavis, port 10224) with ESMTP id cge_3eWoPjIe for ; Wed, 2 Apr 2025 17:59:55 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id D346616500 for ; Wed, 02 Apr 2025 17:59:55 +0200 (CEST) From: Jonas Bernoulli To: bug-gnu-emacs@gnu.org Subject: X is already defined as something else than a generic function Date: Wed, 02 Apr 2025 17:59:53 +0200 Message-ID: <87v7rma70m.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Hello, Users of my packages occasionally report such errors but I was never able to reproduce. What is strange is that X always was a function that was definitely not defined as "something else than a generic function" anywhere in my code, or even just in past versions of my code, and users were not able to find anything in their configuration or third-party packages either. Actually I have seen this issue myself a few times, but it was always when I badly messed up something else and by the time I had fixed that, the "something other" issue was also gone. In hindsight it is obvious that I should sooner have investigated the "something other" issue without first fixing the seemingly unrelated issue. Now that I have finally done that, I also managed to come of with a reproducer. 1. Create a file "demo.el" with contents: (require 'eieio) (defclass demo-class () ()) (cl-defmethod demo-function ((obj demo-class)) obj) (error "something else goes wrong here") (provide 'demo) 2. Optionally apply this patch to Emacs: diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el @@ -193,8 +193,8 @@ cl-generic-ensure-function (autoloadp (symbol-function name)) (and (functionp name) generic) noerror) - (error "%s is already defined as something else than a generic function" - origname)) + (error "%s [%s] is already defined as something else than a generic function" + origname (symbol-function name))) (if generic (cl-assert (eq name (cl--generic-name generic))) (setf (cl--generic name) (setq generic (cl--generic-make name)))) @@ -645,7 +645,9 @@ cl-generic-define-method ;; is still valid (e.g. still empty method cache)? (gfun (cl--generic-make-function generic))) (unless (symbol-function sym) - (defalias sym 'dummy)) ;Record definition into load-history. + (defalias sym 'dummy) ;Record definition into load-history. + (when (eq sym 'demo-function) + (message "First defalias: %s" (symbol-function 'demo-function)))) (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format (cl--generic-name generic) qualifiers specializers)) @@ -659,7 +661,9 @@ cl-generic-define-method (set-advertised-calling-convention gfun old-adv-cc nil)) ;; But do use `defalias', so that it interacts properly with nadvice, ;; e.g. for tracing/debug-on-entry. - (defalias sym gfun))))) + (defalias sym gfun) + (when (eq sym 'demo-function) + (message "Second defalias: %s" (symbol-function 'demo-function))))))) (defvar cl--generic-dispatchers (make-hash-table :test #'equal)) 3. Paste this into a buffer and adjust the load-path: (add-to-list 'load-path "/path/to/demo") (message "Load attempt one... [%s]" (symbol-function 'demo-function)) (with-demoted-errors "Trigger: %S" (require 'demo)) (message "Load attempt one...done") (message "Load attempt two... [%s]" (symbol-function 'demo-function)) (require 'demo) (message "Load attempt two...done") 4. Evaluate that buffer, you'll get this output: Load attempt one... [nil] First defalias: dummy Second defalias: #[...] Trigger: (error "something else goes wrong here") Load attempt one...done Load attempt two... [dummy] cl-generic-ensure-function: demo-function [dummy] is already defined \ as something else than a generic function cl-generic-define-method first sets (symbol-function 'demo-function) to 'dummy, and then it successfully sets it to something else. The debug statements helped confirm that both defalias calls are actually successful, i.e., the problem isn't that something in between these calls ends up calling cl-generic-ensure-function. Then, after this function has returned, something else goes wrong (in this reproducer intentionally). We can then observe that the value of (symbol-function 'demo-function) somehow goes back to being 'dummy. (I couldn't find anything else in Emacs that sets a symbol-function to 'dummy.) The first (require 'demo) failed because the (here intentional) error occurred before the provide form was reached. Once a second attempt to require the same library is made, the cl-defmethod fails because the encountered 'dummy is "something else than a generic function". (Also, isn't it "something OTHER than a generic function"?) Cheers, Jonas From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 13 04:18:17 2025 Received: (at 77464) by debbugs.gnu.org; 13 Apr 2025 08:18:17 +0000 Received: from localhost ([127.0.0.1]:38012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u3sXf-00052m-OQ for submit@debbugs.gnu.org; Sun, 13 Apr 2025 04:18:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43822) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u3sX3-0004vS-MS for 77464@debbugs.gnu.org; Sun, 13 Apr 2025 04:17:39 -0400 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 1u3sWd-0000Ti-0M; Sun, 13 Apr 2025 04:17:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=aXeYmHVOrx+0vYzzoWdEZJRd4+mnoZZiNVky6HbXKvA=; b=ldQLgHjZJxd1 2h+87CtHUkOHav6Cg+XEFl8FZlYLATMAYHUlJEZDJzJ8cVlLY7jtSsCfDa9Ynhhc3TJXRdFj4WH/t XAoP/mHDIP5W3MAclzfsF6zCDme4K1/ahek5NjqH0eI5XcSjSDOSk7+KpLRBfdOJrbkPvzJZEgaUp 3nb+J/48JWnmoeUkzkNXwYLEOjxJHS+L5kBj2cOqXxyLTaebRqHdEQdvptpHFRO4WZk2zUMujfnEF YMP2b7d6SJPleFjYpp7Zdlc4VsQHfMvkAiGHdNWFR9derkyz/6h8d4vC9Vca0cKJbuTDMtkfXLE4l cyol40BPiQaCqhiOgG7Ejg==; Date: Sun, 13 Apr 2025 11:17:05 +0300 Message-Id: <86a58klblq.fsf@gnu.org> From: Eli Zaretskii To: Jonas Bernoulli , Stefan Monnier In-Reply-To: <87v7rma70m.fsf@bernoul.li> (bug-gnu-emacs@gnu.org) Subject: Re: bug#77464: X is already defined as something else than a generic function References: <87v7rma70m.fsf@bernoul.li> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77464 Cc: 77464@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 02 Apr 2025 17:59:53 +0200 > From: Jonas Bernoulli via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Hello, > > Users of my packages occasionally report such errors but I was never > able to reproduce. What is strange is that X always was a function that > was definitely not defined as "something else than a generic function" > anywhere in my code, or even just in past versions of my code, and users > were not able to find anything in their configuration or third-party > packages either. > > Actually I have seen this issue myself a few times, but it was always > when I badly messed up something else and by the time I had fixed that, > the "something other" issue was also gone. In hindsight it is obvious > that I should sooner have investigated the "something other" issue > without first fixing the seemingly unrelated issue. > > Now that I have finally done that, I also managed to come of with a > reproducer. > > 1. Create a file "demo.el" with contents: > > (require 'eieio) > (defclass demo-class () ()) > (cl-defmethod demo-function ((obj demo-class)) obj) > > (error "something else goes wrong here") > (provide 'demo) > > 2. Optionally apply this patch to Emacs: > > diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el > @@ -193,8 +193,8 @@ cl-generic-ensure-function > (autoloadp (symbol-function name)) > (and (functionp name) generic) > noerror) > - (error "%s is already defined as something else than a generic function" > - origname)) > + (error "%s [%s] is already defined as something else than a generic function" > + origname (symbol-function name))) > (if generic > (cl-assert (eq name (cl--generic-name generic))) > (setf (cl--generic name) (setq generic (cl--generic-make name)))) > @@ -645,7 +645,9 @@ cl-generic-define-method > ;; is still valid (e.g. still empty method cache)? > (gfun (cl--generic-make-function generic))) > (unless (symbol-function sym) > - (defalias sym 'dummy)) ;Record definition into load-history. > + (defalias sym 'dummy) ;Record definition into load-history. > + (when (eq sym 'demo-function) > + (message "First defalias: %s" (symbol-function 'demo-function)))) > (cl-pushnew `(cl-defmethod . ,(cl--generic-load-hist-format > (cl--generic-name generic) > qualifiers specializers)) > @@ -659,7 +661,9 @@ cl-generic-define-method > (set-advertised-calling-convention gfun old-adv-cc nil)) > ;; But do use `defalias', so that it interacts properly with nadvice, > ;; e.g. for tracing/debug-on-entry. > - (defalias sym gfun))))) > + (defalias sym gfun) > + (when (eq sym 'demo-function) > + (message "Second defalias: %s" (symbol-function 'demo-function))))))) > > (defvar cl--generic-dispatchers (make-hash-table :test #'equal)) > > 3. Paste this into a buffer and adjust the load-path: > > (add-to-list 'load-path "/path/to/demo") > > (message "Load attempt one... [%s]" (symbol-function 'demo-function)) > (with-demoted-errors "Trigger: %S" > (require 'demo)) > (message "Load attempt one...done") > (message "Load attempt two... [%s]" (symbol-function 'demo-function)) > (require 'demo) > (message "Load attempt two...done") > > 4. Evaluate that buffer, you'll get this output: > > Load attempt one... [nil] > First defalias: dummy > Second defalias: #[...] > Trigger: (error "something else goes wrong here") > Load attempt one...done > Load attempt two... [dummy] > cl-generic-ensure-function: demo-function [dummy] is already defined \ > as something else than a generic function > > > cl-generic-define-method first sets (symbol-function 'demo-function) > to 'dummy, and then it successfully sets it to something else. The > debug statements helped confirm that both defalias calls are actually > successful, i.e., the problem isn't that something in between these > calls ends up calling cl-generic-ensure-function. > > Then, after this function has returned, something else goes wrong (in > this reproducer intentionally). We can then observe that the value of > (symbol-function 'demo-function) somehow goes back to being 'dummy. > (I couldn't find anything else in Emacs that sets a symbol-function to > 'dummy.) > > The first (require 'demo) failed because the (here intentional) error > occurred before the provide form was reached. Once a second attempt to > require the same library is made, the cl-defmethod fails because the > encountered 'dummy is "something else than a generic function". > > (Also, isn't it "something OTHER than a generic function"?) Stefan, any comments or suggestions? From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 13 12:51:50 2025 Received: (at 77464) by debbugs.gnu.org; 13 Apr 2025 16:51:50 +0000 Received: from localhost ([127.0.0.1]:43657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u40Yg-0006Zs-Bh for submit@debbugs.gnu.org; Sun, 13 Apr 2025 12:51:50 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5743) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u40Ya-0006ZY-P9 for 77464@debbugs.gnu.org; Sun, 13 Apr 2025 12:51:46 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 49B9A808AD; Sun, 13 Apr 2025 12:51:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1744563096; bh=nJOAmmS/6mF1qmAJ+D7clp9hPcFgyj8ni7AfYLgMB1A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=G14nwg9VM5G2pyySUFKSz3tsq9HUvPBasAZbpgDbCwLr6zKjrT1FNA6/k3ii4n2Rg 7v2WKMjJWUI9QCr4V3XC2G1xMQW5H5kWDZ9IoaZ1r/s9CpDjAovm84S56dbJti0I+T s99/9BIFUdKgCET7TIBGq4UjXbHtZMqXGLuolSJUrN1+RvFxe/7UuQpS9lEbj70qWY 8MnX4bfXNc/7A4FBRezvaRyWPPzyQIMp3QSdW333EE3vAUzEYr41G37iOj+LOukXMZ sWLOBRW0f01TPOTkc4Y7YamiSz12yv116vvS7U1r0xTZuWoW1BcUWuSgrPafQCEOkJ Pvo1wVV8799HA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3931F80599; Sun, 13 Apr 2025 12:51:36 -0400 (EDT) Received: from pastel (unknown [104.247.242.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0B1401206DB; Sun, 13 Apr 2025 12:51:36 -0400 (EDT) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#77464: X is already defined as something else than a generic function In-Reply-To: <86a58klblq.fsf@gnu.org> Message-ID: References: <87v7rma70m.fsf@bernoul.li> <86a58klblq.fsf@gnu.org> Date: Sun, 13 Apr 2025 12:51:35 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.369 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77464 Cc: Eli Zaretskii , 77464@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Jonas, >> Now that I have finally done that, I also managed to come of with a >> reproducer. >> >> 1. Create a file "demo.el" with contents: >> >> (require 'eieio) >> (defclass demo-class () ()) >> (cl-defmethod demo-function ((obj demo-class)) obj) >> >> (error "something else goes wrong here") >> (provide 'demo) I pushed to `master` what I think should fix this problem. Can you try again? Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 14 14:14:26 2025 Received: (at 77464) by debbugs.gnu.org; 14 Apr 2025 18:14:26 +0000 Received: from localhost ([127.0.0.1]:48910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u4OKA-0001uN-8v for submit@debbugs.gnu.org; Mon, 14 Apr 2025 14:14:26 -0400 Received: from mail.hostpark.net ([212.243.197.30]:49704) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u4OK7-0001uD-MB for 77464@debbugs.gnu.org; Mon, 14 Apr 2025 14:14:24 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 4332F16332; Mon, 14 Apr 2025 20:14:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from; s=sel2011a; t=1744654460; bh=iY0XFHSC8umg2eS9xTX7lOtnUwavTSC0Qd9tcWSPjdI=; b= XrUx783fDnaWRrGXGf1d8VdHYscJPSEjVaRpXAjK6HaH9il4qH9NnfVPYTI8T20a tIShmFsDZlFF9VkAF9HYgsLXRmfITEmjv7Om187pGL6jXVkKZ+1I9cZD251YXPLC shv/KeelHzErB/aqKGFIRBVMJUEy8oWiqguDYXay/NM= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavis, port 10224) with ESMTP id nfmoy4ll39j6; Mon, 14 Apr 2025 20:14:20 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 8B1EF16304; Mon, 14 Apr 2025 20:14:20 +0200 (CEST) From: Jonas Bernoulli To: Stefan Monnier Subject: Re: bug#77464: X is already defined as something else than a generic function In-Reply-To: References: <87v7rma70m.fsf@bernoul.li> <86a58klblq.fsf@gnu.org> Date: Mon, 14 Apr 2025 20:14:19 +0200 Message-ID: <87o6wyehl0.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77464 Cc: Eli Zaretskii , 77464@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello Stefan Stefan Monnier writes: >>> Now that I have finally done that, I also managed to come of with a >>> reproducer. >>> >>> 1. Create a file "demo.el" with contents: >>> >>> (require 'eieio) >>> (defclass demo-class () ()) >>> (cl-defmethod demo-function ((obj demo-class)) obj) >>> >>> (error "something else goes wrong here") >>> (provide 'demo) > > I pushed to `master` what I think should fix this problem. > Can you try again? That fixed the issue. It's now also easier to understand why, when and how this avoids recording the location. Of course that won't fix the issue for released Emacsen, and for anyone who runs into this and has not seen this thread that continues to be very confusing. Can you think of any workaround beside making sure that each and every generic function is first declared using cl-defgeneric? >> Then, after this function has returned, something else goes wrong (in >> this reproducer intentionally). We can then observe that the value of >> (symbol-function 'demo-function) somehow goes back to being 'dummy. >> (I couldn't find anything else in Emacs that sets a symbol-function to >> 'dummy.) Could you please explain what was happening? To me this still looks like the value somehow magically goes back to 'dummy. Thanks! Jonas From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 15 10:04:17 2025 Received: (at 77464) by debbugs.gnu.org; 15 Apr 2025 14:04:17 +0000 Received: from localhost ([127.0.0.1]:52882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u4gtc-00054I-Oo for submit@debbugs.gnu.org; Tue, 15 Apr 2025 10:04:17 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7237) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u4gtW-00053v-Uq for 77464@debbugs.gnu.org; Tue, 15 Apr 2025 10:04:14 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C52EF807B7; Tue, 15 Apr 2025 10:04:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1744725844; bh=7xNHZ2Ql0rVEuq+dvNTQOdwjDp7omHYR0tMrBawkUTw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jbuvSdg7GznsoIm77W0LijKrMS+zzg2RwWJXi0GCfoT1SkSEiNjXH25Z2jK44kx2z MPlkkJaYlWMJztnFd/ITzh7bTmGPWjIDc3CRhBJvCNC5tnfqXFuBjoYEZBWFHmKbtM vsQYL/IrW3txqXJzGpXVqDEFL9E9edrTRgZwf8b1OQqVicdmvPh+cnZEiLGaJNuSZN pFa9dejYY5s0dSkzA87UARQff+fnESeHBwlPQpfGOCqsrSjIIiK//VTO6s4RYlnIxu bHP348E2TqGtOuGZKV+mYH2YB0sUlCXqBy8rsqKerDEupvfPOwpdRYq4690OuodbYy BYLi3benZcbvg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EFE00806EF; Tue, 15 Apr 2025 10:04:03 -0400 (EDT) Received: from pastel (unknown [104.247.242.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C567D120371; Tue, 15 Apr 2025 10:04:03 -0400 (EDT) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#77464: X is already defined as something else than a generic function In-Reply-To: <87o6wyehl0.fsf@bernoul.li> Message-ID: References: <87v7rma70m.fsf@bernoul.li> <86a58klblq.fsf@gnu.org> <87o6wyehl0.fsf@bernoul.li> Date: Tue, 15 Apr 2025 10:04:02 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.368 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77464 Cc: Eli Zaretskii , 77464@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Of course that won't fix the issue for released Emacsen, and for anyone > who runs into this and has not seen this thread that continues to be > very confusing. Can you think of any workaround beside making sure that > each and every generic function is first declared using cl-defgeneric? Don't signal an error while loading a file? >>> Then, after this function has returned, something else goes wrong (in >>> this reproducer intentionally). We can then observe that the value of >>> (symbol-function 'demo-function) somehow goes back to being 'dummy. >>> (I couldn't find anything else in Emacs that sets a symbol-function to >>> 'dummy.) > Could you please explain what was happening? To me this still looks > like the value somehow magically goes back to 'dummy. I have not worked out the details of the sequence of events, to be honest. AFAICT, the "magic" comes from the code that tries to undo partial loads when an error is encountered in the middle of loading a file (which involves the `function-history` symbol property and the `Vautoload_queue`). It's quite possible that it's a result of a bug in there. Stefan