From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#25461: [Patch #2]: Missing doc strings for "," and ",@". Date: Sat, 21 Jan 2017 20:46:48 +0000 Message-ID: <20170121204648.GA21091@acm> References: <20170116212257.GA4747@acm.fritz.box> <20170118194320.GB4108@acm.fritz.box> <87lgu7dbyz.fsf@web.de> <20170119175801.GB3397@acm.fritz.box> <877f5qbndp.fsf@web.de> <20170120165856.GA3384@acm.fritz.box> <87y3y5cfnl.fsf@web.de> <20170121155651.GB5394@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1485031705 23645 195.159.176.226 (21 Jan 2017 20:48:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Jan 2017 20:48:25 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 25461@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 21 21:48:21 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cV2Zy-0004j1-JK for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Jan 2017 21:48:06 +0100 Original-Received: from localhost ([::1]:33297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cV2a3-0006bM-Q1 for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Jan 2017 15:48:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cV2Zx-0006bD-AU for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2017 15:48:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cV2Zu-0005eF-7N for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2017 15:48:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cV2Zu-0005e5-3H for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2017 15:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cV2Zt-0001qH-Mq for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2017 15:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jan 2017 20:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25461 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25461-submit@debbugs.gnu.org id=B25461.14850316297020 (code B ref 25461); Sat, 21 Jan 2017 20:48:01 +0000 Original-Received: (at 25461) by debbugs.gnu.org; 21 Jan 2017 20:47:09 +0000 Original-Received: from localhost ([127.0.0.1]:37765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cV2Z2-0001p9-PA for submit@debbugs.gnu.org; Sat, 21 Jan 2017 15:47:08 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:37066 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1cV2Z1-0001oz-9O for 25461@debbugs.gnu.org; Sat, 21 Jan 2017 15:47:07 -0500 Original-Received: (qmail 84719 invoked by uid 3782); 21 Jan 2017 20:47:04 -0000 Original-Received: from acm.muc.de (p548C61DB.dip0.t-ipconnect.de [84.140.97.219]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 21 Jan 2017 21:47:04 +0100 Original-Received: (qmail 28110 invoked by uid 1000); 21 Jan 2017 20:46:48 -0000 Content-Disposition: inline In-Reply-To: <20170121155651.GB5394@acm> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128302 Archived-At: Hello again, Michael. On Sat, Jan 21, 2017 at 15:56:51 +0000, Alan Mackenzie wrote: > Hello, Michael. > On Sat, Jan 21, 2017 at 03:26:06 +0100, Michael Heerdegen wrote: [ .... ] > How about starting on a different tack. Would you accept , and ,@ > having doc strings, with the entirety of these being: > [for ,]: > See ``' (and also `pcase') for the details of `,'. > [for ,@]: > See ``' for the details of `,@'. > ? I've hacked all this together. What used to be called a "reader macro" is now a "reader construct". I've made the ``' a clickable link, too. Is there anything else you think needs changing? diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el index 94c561c..acc3fa4 100644 --- a/lisp/emacs-lisp/backquote.el +++ b/lisp/emacs-lisp/backquote.el @@ -247,4 +247,14 @@ backquote-listify tail)) (t (cons 'list heads))))) + +;; Give `,' and `,@' documentation strings which can be examined by C-h f. +(put '\, 'function-documentation + "See `\\=`' (also `pcase') for the details of `,'.") +(put '\, 'reader-construct t) + +(put '\,@ 'function-documentation + "See `\\=`' or `,' for the details of `,@'.") +(put '\,@ 'reader-construct t) + ;;; backquote.el ends here diff --git a/lisp/help-fns.el b/lisp/help-fns.el index fa16fa0..edbcd90 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -115,13 +115,15 @@ describe-function (if fn (format "Describe function (default %s): " fn) "Describe function: ") - #'help--symbol-completion-table #'fboundp t nil nil + #'help--symbol-completion-table + (lambda (f) (or (fboundp f) (get f 'function-documentation))) + t nil nil (and fn (symbol-name fn))))) (unless (equal val "") (setq fn (intern val))) (unless (and fn (symbolp fn)) (user-error "You didn't specify a function symbol")) - (unless (fboundp fn) + (unless (or (fboundp fn) (get fn 'function-documentation)) (user-error "Symbol's function definition is void: %s" fn)) (list fn))) @@ -144,7 +146,9 @@ describe-function (save-excursion (with-help-window (help-buffer) - (prin1 function) + (if (get function 'reader-construct) + (princ function) + (prin1 function)) ;; Use " is " instead of a colon so that ;; it is easier to get out the function name using forward-sexp. (princ " is ") @@ -469,7 +473,8 @@ help-fns--signature (let ((fill-begin (point)) (high-usage (car high)) (high-doc (cdr high))) - (insert high-usage "\n") + (unless (get function 'reader-construct) + (insert high-usage "\n")) (fill-region fill-begin (point)) high-doc))))) @@ -565,18 +570,21 @@ describe-function-1 (or (and advised (advice--cd*r (advice--symbol-function function))) function)) - ;; Get the real definition. + ;; Get the real definition, if any. (def (if (symbolp real-function) - (or (symbol-function real-function) - (signal 'void-function (list real-function))) + (cond ((symbol-function real-function)) + ((get real-function 'function-documentation) + nil) + (t (signal 'void-function (list real-function)))) real-function)) - (aliased (or (symbolp def) - ;; Advised & aliased function. - (and advised (symbolp real-function) - (not (eq 'autoload (car-safe def)))) - (and (subrp def) - (not (string= (subr-name def) - (symbol-name function)))))) + (aliased (and def + (or (symbolp def) + ;; Advised & aliased function. + (and advised (symbolp real-function) + (not (eq 'autoload (car-safe def)))) + (and (subrp def) + (not (string= (subr-name def) + (symbol-name function))))))) (real-def (cond ((and aliased (not (subrp def))) (let ((f real-function)) @@ -605,6 +613,8 @@ describe-function-1 ;; Print what kind of function-like object FUNCTION is. (princ (cond ((or (stringp def) (vectorp def)) "a keyboard macro") + ((get function 'reader-construct) + "a reader construct") ;; Aliases are Lisp functions, so we need to check ;; aliases before functions. (aliased diff --git a/lisp/help-mode.el b/lisp/help-mode.el index a8d7294..3fb793e 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -328,7 +328,7 @@ help-xref-symbol-regexp "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" "[ \t\n]+\\)?" ;; Note starting with word-syntax character: - "['`‘]\\(\\sw\\(\\sw\\|\\s_\\)+\\)['’]")) + "['`‘]\\(\\sw\\(\\sw\\|\\s_\\)+\\|`\\)['’]")) "Regexp matching doc string references to symbols. The words preceding the quoted symbol can be used in doc strings to -- Alan Mackenzie (Nuremberg, Germany).