From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: master 49192e9: Strip "(fn...)" from output of `describe-mode' (bug#38222) Date: Fri, 22 Nov 2019 21:00:01 +0100 Message-ID: References: <20191119101930.28082.63466@vcs0.savannah.gnu.org> <20191119101931.EA4E2209BF@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000daac70597f4dea0" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="7978"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 22 21:00:51 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iYF6p-0001v9-77 for ged-emacs-devel@m.gmane.org; Fri, 22 Nov 2019 21:00:51 +0100 Original-Received: from localhost ([::1]:54690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYF6n-00066k-Uu for ged-emacs-devel@m.gmane.org; Fri, 22 Nov 2019 15:00:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51564) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYF6h-00064q-1c for emacs-devel@gnu.org; Fri, 22 Nov 2019 15:00:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYF6e-00040D-Vg for emacs-devel@gnu.org; Fri, 22 Nov 2019 15:00:42 -0500 Original-Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:45391) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iYF6d-0003xZ-0P for emacs-devel@gnu.org; Fri, 22 Nov 2019 15:00:40 -0500 Original-Received: by mail-qv1-xf2f.google.com with SMTP id d12so1437271qvv.12 for ; Fri, 22 Nov 2019 12:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j1gw+Ez4cJ6Q/9abDMn20mAqW+qiNiCd3RyWOPvwoWc=; b=BOhuUDIIQs4W8d9xEWUg3rZ9ZAGIDfhu9fly7tISSZs4j6IIh6jPSGh3KF88XmStNG 0IZU2cIfRMRbYVFunYP+jl5T5eM3YrQTH70aBZcQXe8EdcbR6O+iI3GaQt6EL3yId9FO Ci3PLGeVl1coK4qlz1E0dKUsntRGXMDReIg4UCb2OahZ++CBW1EyW17+3yrHEgClzhKD bnN9duxTb0aXySriSJY1mBwNj+F4vAPdyjg09EAboRAaNVIhJR9ZZQMqNIlVqbf4Qfjz IciWA27xMO+6VneSaON9oaYpAAYHo6cyL/XdBvIdEHfrd8F/HxU9D4HqTliwivRJajqo qxsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j1gw+Ez4cJ6Q/9abDMn20mAqW+qiNiCd3RyWOPvwoWc=; b=DaKSxWZkHlgyqVK8on2J4KX7oizDteOzazRQIPDGo7i9nc9i7sg7BB96F8e9R0dvXe pBWIwawMVUxajwRB6UuXQZx72ekJ5ezSsrX0z3xhjW/v6Xpz8aZj2q9LlVZnICq6qieT 1I3WrisPnxigKBUQF8/c0sUDLRhJip2Qetc9jpgFLXhGWeQrN1msM1ehCNxTB8+Y8l3N CPKcNB6hLtpUzQjF5LTzlUycIasPFnBZ7MNNQLDS0w82QXd7T3HYuqVgdoRZFCMLzCsz L10dvIEF7gZSFa8fg8WUP28X/59EOXR4PggH2BKxlK9q0Swrqt7/GhmKge929qfLqmwv HljA== X-Gm-Message-State: APjAAAVcDgowBo9HAcLoK8Kl7Q+s2M5WO0mx6B1Rth3a1OwjUO1JxGbK rnx6mdF7CYNOGM1In8VJcIW0PZIA4Z0OSS60D4A= X-Google-Smtp-Source: APXvYqwYLIGEWJ1BfwVEceVOI9NyUZ13DzGa+kN842bpPJGqmsmsoUZfk9a4BYt7lom9HCaLVXW0+eKR85EiiEWL3cs= X-Received: by 2002:ad4:450a:: with SMTP id k10mr183693qvu.136.1574452836804; Fri, 22 Nov 2019 12:00:36 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f2f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242627 Archived-At: --0000000000000daac70597f4dea0 Content-Type: text/plain; charset="UTF-8" On Tue, Nov 19, 2019 at 9:56 PM Stefan Monnier wrote: > What I'm suggesting is to look at all the usage we can find and see if > such a change would break that code. If none is broken, there's a high > probability that other code we don't know about wouldn't be > broken either. After looking at all the code calling help-split-fundoc in our sources (not ELPA), I'm unconvinced that changing it to return (nil . DOC) when there's no usage would be a good idea. Basically, all callers do the moral equivalent of (let ((ud (help-split-fundoc documentation symbol))) (if ud ;;; (car ud) or (cdr ud) and assume that (car ud) and (cdr ud) are strings. For example, take a look at this code from semantic-grammar-eldoc-get-macro-docstring: (let* ((doc (help-split-fundoc (documentation expander t) expander))) (cond (doc (setq doc (car doc)) (string-match "\\`[^ )]* ?" doc) (setq doc (concat "(" (substring doc (match-end 0))))) which would set doc to nil and then try to string-match it. There are ten cases like this just in our sources; each one would require some bit of tweaking, however small. A far less intrusive option IMHO would be to add an optional argument SECTION, with SECTION = nil as it is now, and SECTION 'usage or 'doc returning only that part. --0000000000000daac70597f4dea0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Nov 19, 2019 at 9:56 PM Stefan Monnier <= ;monnier@iro.umontreal.ca&g= t; wrote:

> What I'm suggesting is to look at all the us= age we can find and see if
> such a change would break that code.=C2= =A0 If none is broken, there's a high
> probability that other co= de we don't know about wouldn't be
> broken either.

Af= ter looking at all the code calling help-split-fundoc in our sources (not E= LPA), I'm unconvinced that changing it to return (nil . DOC) when there= 's no usage would be a good idea.

Basically, all call= ers do the moral equivalent of

(let ((ud (help-split-fundoc documentation symbol)))
=C2=A0 =C2=A0(if ud
=C2=A0 =C2=A0 =C2=A0 =C2=A0;;; (car ud) or (cdr ud)

and assume that (car ud) and (cdr ud) are strings.<= /div>

For example, take a look at this code from semanti= c-grammar-eldoc-get-macro-docstring:
=C2=A0 =C2=A0 (let* ((doc (help= -split-fundoc (documentation expander t) expander)))
=C2=A0 =C2=A0 =C2= =A0 (cond
=C2=A0 =C2=A0 =C2=A0 =C2=A0(doc
=C2=A0 =C2=A0 =C2=A0 =C2=A0= (setq doc (car doc))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (string-match "\\= `[^ )]* ?" doc)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq doc (concat "= ;(" (substring doc (match-end 0)))))


which would set doc to nil and then try to string-match it.
There are ten cases like this just in our sources; each one wo= uld require some bit of tweaking, however small.

A= far less intrusive option IMHO would be to add an optional argument SECTIO= N, with SECTION =3D nil as it is now, and SECTION 'usage or 'doc re= turning only that part.

--0000000000000daac70597f4dea0--