From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 d0d9f55: Allow newlines inside cl function arglists Date: Tue, 10 May 2016 13:11:05 +0300 Message-ID: References: <20160509235343.17047.73943@vcs.savannah.gnu.org> <20160509235343.759D0220128@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1462875097 14791 80.91.229.3 (10 May 2016 10:11:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 May 2016 10:11:37 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 10 12:11:37 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b04dc-00018S-IF for ged-emacs-devel@m.gmane.org; Tue, 10 May 2016 12:11:36 +0200 Original-Received: from localhost ([::1]:45568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b04db-0006HN-FN for ged-emacs-devel@m.gmane.org; Tue, 10 May 2016 06:11:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b04dF-0006AH-Ry for emacs-devel@gnu.org; Tue, 10 May 2016 06:11:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b04dB-0002Uh-Gr for emacs-devel@gnu.org; Tue, 10 May 2016 06:11:12 -0400 Original-Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b04dB-0002Uc-9w for emacs-devel@gnu.org; Tue, 10 May 2016 06:11:09 -0400 Original-Received: by mail-wm0-x242.google.com with SMTP id n129so1839141wmn.1 for ; Tue, 10 May 2016 03:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=n/8Y/uwM0Zz2VibKvGNfSEB1r8e8y5bIuQIFQEMNynE=; b=RvM0S5KsdjU5LusHaHDk0817bbf6+RzVc9mvqqjsntwnx/Zx4DYvj0ojsK7tH8M27/ OiDrAI6DJnNixUMhK+19fp9G4lpcdr1RIZCPfWQDOyFJJejN3bJcX+ytNWIO9U+CBCnC W9OVea4OOxTjYeccdTo+MAD+mvzZSaAlfUJRuhvx6Qm5kRtutd2DSlintRu17mg5UuCx /4eeFIxUgBZ29LB9CSGXFeB4wEVznMcG/5llmzlnx93N8TOl/oMiV+7jw9EtECJQMzYH +n8YTvtQEH+ecq6F9eTItPeT2OlXuX+0+eK7ta27Dya5TfZ9maCsacdow3sTEIuWffSq c1sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=n/8Y/uwM0Zz2VibKvGNfSEB1r8e8y5bIuQIFQEMNynE=; b=V/xin/eAvrGH0iv1l0s31V2aU4WFooB8s64EvFnU3KQsN6gWVwoUqOwRJHUnSAaNDO 5rBj9wVC1oJBxp4sk0Mi+ms5toyjcNqK5+fvFETjr6sCUEB+WN8j1wt8iHYXTG20IMJF q4qD2f8Eu+h6o/1xTOtvGd1gYpfYZ5+3EKuBltMqKrVDmR9VDppXZf87Ah4zQG9TrGQv z2tYBIC5UMtgQzqoPTj+nr80fYABXtENTdC+PeKAuUIzlLWxUlYXeUoalDkHdv+gw3J6 kH2srBXYmGRWva98okj3OfXVIeoTEhcZDfd+Gj8dKeP+NqYOnTFrMYFjX5vEzTBDW8sp PZqA== X-Gm-Message-State: AOPr4FV4vvDgMhUefLkh7SOFb5n9UMh3B4VBQGAbK199nLqCX12uX1pOC1htukMuidH1xA== X-Received: by 10.28.230.137 with SMTP id e9mr17175925wmi.0.1462875068440; Tue, 10 May 2016 03:11:08 -0700 (PDT) Original-Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id c4sm1658365wjm.24.2016.05.10.03.11.06 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2016 03:11:07 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:203759 Archived-At: On 05/10/2016 04:34 AM, Stefan Monnier wrote: > Why? Because nobody has proposed a better patch until now. > This is problematic since it might be difficult to adjust > help-split-fundoc correspondingly. We already have this problem with e.g. (cl-defgeneric asdasd (&optional (separator "\n"))) because when that is evaluated, ARGLIST passed to help-add-fundoc-usage is a form, not a string. I think it's better than not being able to define the function at all. We could escape the newlines in the returned string. What's the best place to do that? Do we have a handier function that turns "\n" into "\\n", and does the same for \r, \t, and maybe unprintable characters? This seems to work: diff --git a/lisp/help.el b/lisp/help.el index 7289375..4bd9cc1 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1394,11 +1394,14 @@ help-add-fundoc-usage (if (string-match "\n?\n\\'" docstring) (if (< (- (match-end 0) (match-beginning 0)) 2) "\n" "") "\n\n") - (if (stringp arglist) - (if (string-match "\\`[^ ]+\\(\\(?:.\\|\n\\)*\\))\\'" arglist) - (concat "(fn" (match-string 1 arglist) ")") - (error "Unrecognized usage format")) - (help--make-usage-docstring 'fn arglist))))) + (replace-regexp-in-string + "\n" "\\n" + (if (stringp arglist) + (if (string-match "\\`[^ ]+\\(\\(?:.\\|\n\\)*\\))\\'" arglist) + (concat "(fn" (match-string 1 arglist) ")") + (error "Unrecognized usage format")) + (help--make-usage-docstring 'fn arglist)) + t t)))) (defun help-function-arglist (def &optional preserve-names) "Return a formal argument list for the function DEF.