From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#66032: [PATCH] Inline advice documentation into advised function's docstring, after all Date: Mon, 18 Sep 2023 23:03:12 +0200 Message-ID: <87h6nr19f3.fsf@sappc2.fritz.box> References: <87led6ghu8.fsf@sappc2.fritz.box> Reply-To: Jens Schmidt Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19754"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: 66032@debbugs.gnu.org, drew.adams@oracle.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 18 23:04:23 2023 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 1qiLPr-0004oJ-ID for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Sep 2023 23:04:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiLPU-0004Kb-JP; Mon, 18 Sep 2023 17:04:00 -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 1qiLPO-0004KF-7V for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2023 17:03:54 -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 1qiLPN-00065e-Vn for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2023 17:03:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qiLPW-0007SY-As for bug-gnu-emacs@gnu.org; Mon, 18 Sep 2023 17:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jens Schmidt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Sep 2023 21:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66032 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66032-submit@debbugs.gnu.org id=B66032.169507102828654 (code B ref 66032); Mon, 18 Sep 2023 21:04:02 +0000 Original-Received: (at 66032) by debbugs.gnu.org; 18 Sep 2023 21:03:48 +0000 Original-Received: from localhost ([127.0.0.1]:54787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiLPI-0007S6-41 for submit@debbugs.gnu.org; Mon, 18 Sep 2023 17:03:48 -0400 Original-Received: from mr5.vodafonemail.de ([145.253.228.165]:36164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiLPE-0007Rj-FK for 66032@debbugs.gnu.org; Mon, 18 Sep 2023 17:03:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafonemail.de; s=vfde-mb-mr2-21dec; t=1695071009; bh=AsniyQVhyYGS65lK9kT5G7fXyi84GXe2HXA4nJq+iUY=; h=From:To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent: Content-Type:From; b=MoDQbHKDiWCvsdBcNWOQJVOf7V6GfWZYNpDCLdSc2sntUWndpxZyyHewPXqmNEFyS RPYOvtTnyD5FuenBaq71+KZ8/pdWDBLup8dLpjX6VvQWy/GRNJm3AHN8jT1fW6AIsF ERgig/U2kIQa+g9I0k4r4KA2Vk35HQg2cRloPQD0= Original-Received: from smtp.vodafone.de (unknown [10.0.0.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mr5.vodafonemail.de (Postfix) with ESMTPS id 4RqHMP4FtZz1yDy; Mon, 18 Sep 2023 21:03:29 +0000 (UTC) Original-Received: from sappc2 (port-92-194-242-136.dynamic.as20676.net [92.194.242.136]) (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 smtp.vodafone.de (Postfix) with ESMTPSA id 4RqHM755gCzKm4H; Mon, 18 Sep 2023 21:03:12 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Sun, 17 Sep 2023 16:13:16 -0400") X-purgate-type: clean X-purgate: clean X-purgate-size: 2232 X-purgate-ID: 155817::1695071005-387F258E-A7E69EF5/0/0 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:270843 Archived-At: [Sorry if this is resent - thought I sent it yesterday already.] Stefan Monnier writes: > [...] Thanks for your comments again, I'll consider them. >> Do you think this docstring generation should be covered by ERT tests? > > ERT tests are always welcome, I have been trying to understand these quirks and previous bugs of functions `advice--make-single-doc' and `advice--make-docstring' better, also to probably provide some ERT tests, and would like to focus on one issue I came across. Namely, it seems that your work-around: ;; Hack attack! For advices installed before calling ;; Snarf-documentation, the integer offset into the DOC file will not ;; be installed in the "core unadvised function" but in the advice ;; object instead! So here we try to undo the damage. (when (integerp (aref flist 4)) (setq docfun flist)) is no longer efficient. When I modify uniquifiy.el as follows in emacs master: diff --git a/lisp/uniquify.el b/lisp/uniquify.el index 2ad2fb0eeac..e43d61a3be6 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -489,7 +489,7 @@ uniquify-kill-buffer-function ;; rename-buffer and create-file-buffer. (Setting find-file-hook isn't ;; sufficient.) -;; (advice-add 'rename-buffer :around #'uniquify--rename-buffer-advice) +(advice-add 'rename-buffer :before #'ignore) (defun uniquify--rename-buffer-advice (newname &optional unique) ;; BEWARE: This is called directly from `buffer.c'! "Uniquify buffer names with parts of directory name." and remake emacs, I do not get the doc string for `rename-buffer' in that Emacs. Furthermore, if I execute (Snarf-documentation "DOC") I get a message Docstring slot busy for rename-buffer which makes me think that function store_function_docstring now knows better than simply overwriting the COMPILED_DOC_STRING slot. Most likely because of this test: /* Don't overwrite a non-docstring value placed there, * such as the symbols used for Oclosures. */ && VALID_DOCSTRING_P (AREF (fun, COMPILED_DOC_STRING)) What do you think? Strictly speaking, this is not even a bug since Emacs does not seem to use pre-dump advices.