unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 66032@debbugs.gnu.org, drew.adams@oracle.com
Subject: bug#66032: [PATCH] Inline advice documentation into advised function's docstring, after all
Date: Mon, 18 Sep 2023 23:03:12 +0200	[thread overview]
Message-ID: <87h6nr19f3.fsf@sappc2.fritz.box> (raw)
In-Reply-To: <jwvzg1kpnq1.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 17 Sep 2023 16:13:16 -0400")

[Sorry if this is resent - thought I sent it yesterday already.]

Stefan Monnier <monnier@iro.umontreal.ca> 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.





  reply	other threads:[~2023-09-18 21:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-16 12:57 bug#66032: [PATCH] Inline advice documentation into advised function's docstring, after all Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-16 15:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-16 17:15   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-17 20:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18 21:03       ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-09-18 22:19         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-23  8:07       ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-23 16:03         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-23 19:09           ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-23 22:29             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6nr19f3.fsf@sappc2.fritz.box \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66032@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=jschmidt4gnu@vodafonemail.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).