From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27748: 26.0.50; doc strings should be in DOC file Date: Sat, 05 Aug 2017 20:09:16 -0400 Message-ID: <87a83d5zgz.fsf@users.sourceforge.net> References: <11A6DB23-F538-4A59-AC90-7CF5040FA496@raeburn.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1501978100 20306 195.159.176.226 (6 Aug 2017 00:08:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 6 Aug 2017 00:08:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27748@debbugs.gnu.org To: Ken Raeburn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 06 02:08:13 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 1de976-0004hu-F1 for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Aug 2017 02:08:12 +0200 Original-Received: from localhost ([::1]:59203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1de979-0003f1-Fi for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Aug 2017 20:08:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1de971-0003el-IX for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2017 20:08:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1de96y-0007zo-Au for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2017 20:08:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41199) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1de96y-0007zX-67 for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2017 20:08:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1de96w-0000Wx-4z for bug-gnu-emacs@gnu.org; Sat, 05 Aug 2017 20:08:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Aug 2017 00:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27748 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27748-submit@debbugs.gnu.org id=B27748.15019780662018 (code B ref 27748); Sun, 06 Aug 2017 00:08:02 +0000 Original-Received: (at 27748) by debbugs.gnu.org; 6 Aug 2017 00:07:46 +0000 Original-Received: from localhost ([127.0.0.1]:43876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1de96f-0000WT-NB for submit@debbugs.gnu.org; Sat, 05 Aug 2017 20:07:45 -0400 Original-Received: from mail-io0-f196.google.com ([209.85.223.196]:32998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1de96d-0000WG-VI for 27748@debbugs.gnu.org; Sat, 05 Aug 2017 20:07:44 -0400 Original-Received: by mail-io0-f196.google.com with SMTP id q64so3335004ioi.0 for <27748@debbugs.gnu.org>; Sat, 05 Aug 2017 17:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=OiOVSFeNOVy5vn/LjLnXvZOa4fC/50O9C6/jNtcGjZw=; b=WZnyHMp46ykTIM/50fsoom6a+S/W6ZanWYFgKbheSsTEAhBfPwgZl56Mde5V1JcI+W MdSnzuz5uvxX3uNHKEzEPonNIo2ZknCbveNqD7mhGJJkU4nthlNpx7DBek2ewBEhoUdN 4eFrImF+8tIcY4ddZDZ6QabyOjnbYDdtve9zThCgIfpviRh7DyO2at5EruMJvqtYX85C luiyfhmslZnXe0y4kXknNJ6wxtEPLHcyRAJb0qgKC5ZrigK9iOV7Ome0oOgSBOAiWZKZ 4socgg2O8I0oQyECm5mwxg0cqc+FCIfkOgEn0RFStDTwbXkcqKUno7k6ukxdpVSTnrUj rGig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=OiOVSFeNOVy5vn/LjLnXvZOa4fC/50O9C6/jNtcGjZw=; b=LMdhM70VKgbR8aQ/Rwebde13WEAdbmPRhvLnCKAFz+smRclNY/7pW3QiJBLiPzv6Mw oMAu3odBUMEi8PuUaqA6yJVBbi1XeBMwEHl9dm1LkjwDWDCBLOIE1OqsVGo3qmVFs2LC O2nnpbCOW2vOFWTtLsSifX+YyXO5yS9YxsVZ2MJrlRZhxtjA9mJ2HYD/k5VQPCDk+WL2 J+xjK7cHMBm9+51BKGJfGTA8ShnNGIj5a1Lms7PDJTrJ/mJYqT1+zpLlTJUmsl6pFqgk cwcuRQ+jv2luE/MzR4QahkcPsRs09etAZbZ98IC8HAhmMImDzKOTt2OW+t4weWFXKBm+ Z2+w== X-Gm-Message-State: AHYfb5gavKtAyw0vS/pdlTJvf6vGEcIcWV6DFvIVVIFUuz2MkHq3G7SX jUccSQ4fn/DmBn3I X-Received: by 10.107.164.98 with SMTP id n95mr7072939ioe.38.1501978058182; Sat, 05 Aug 2017 17:07:38 -0700 (PDT) Original-Received: from zony ([45.2.119.48]) by smtp.googlemail.com with ESMTPSA id z75sm767349ita.18.2017.08.05.17.07.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Aug 2017 17:07:35 -0700 (PDT) In-Reply-To: <11A6DB23-F538-4A59-AC90-7CF5040FA496@raeburn.org> (Ken Raeburn's message of "Tue, 18 Jul 2017 02:47:09 -0400") 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:135458 Archived-At: --=-=-= Content-Type: text/plain Ken Raeburn writes: > > 1. defcustom doc strings from files compiled with lexical binding. > > For example, files.el (lexical bindings) defines > delete-auto-save-files but it doesn't show up in the DOC file; > files.elc starts with an initial byte-code blob which includes the > symbol delete-auto-save-files and its doc string in the constants > array. Actually, it's not only about lexical binding, the following file: ;;; -*- lexical-binding: nil -*- (defcustom custom-foo nil "a custom variable" :type 'boolean :group 'foo-group) ;; (defun foo () ;; t) (defcustom custom-bar nil "another custom variable" :type 'boolean :group 'foo-group) produces (with prologue removed, and reformatted for readability) (byte-code "\300\301\302\303\304\305\306\307&\210\300\310\302\311\304\305\306\307&\207" [custom-declare-variable custom-foo nil "a custom variable" :type boolean :group foo-group custom-bar "another custom variable"] 8) Uncommenting the (defun foo...) produces: #@19 a custom variable (custom-declare-variable 'custom-foo nil '(#$ . 411) :type 'boolean :group 'foo-group) (defalias 'foo #[nil "\300\207" [t] 1]) #@25 another custom variable (custom-declare-variable 'custom-bar nil '(#$ . 562) :type 'boolean :group 'foo-group) Then changing to lexical binding produces: (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\207" [custom-declare-variable custom-foo funcall function #[0 "\300\207" [nil] 1] "a custom variable" :type boolean :group foo-group] 8) (defalias 'foo #[0 "\300\207" [t] 1]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\207" [custom-declare-variable custom-bar funcall function #[0 "\300\207" [nil] 1] "another custom variable" :type boolean :group foo-group] 8) As far as I can tell, the problem is that the byte-compile-dynamic-docstrings feature (that's the #@19 thing) relies on `byte-compile-out-toplevel' to decompile "trivial" functions back into source code. So having lexical binding set, or 2 defcustoms in a row produces "non-trivial" code which is not decompiled, and therefore not recognized in byte-compile-output-file-form as something which should be used with byte-compile-output-docform. (defun byte-compile-out-toplevel (&optional for-effect output-type) ... ;; Decompile trivial functions: ... (cond ;; #### This should be split out into byte-compile-nontrivial-function-p. ((or (eq output-type 'lambda) (nthcdr (if (eq output-type 'file) 50 8) byte-compile-output) ... (while (cond ((memq (car (car rest)) '(byte-varref byte-constant)) ... ((and maycall ;; Allow a funcall if at most one atom follows it. ... (setq maycall nil) ; Only allow one real function call. ... (or (eq output-type 'file) (not (delq nil (mapcar 'consp (cdr (car body)))))))) ... (list 'byte-code (byte-compile-lapcode byte-compile-output) byte-compile-vector byte-compile-maxdepth))) ;; it's a trivial function ((cdr body) (cons 'progn (nreverse body))) ((car body)))) (defun byte-compile-output-file-form (form) ;; Write the given form to the output buffer, being careful of docstrings ;; in defvar, defvaralias, defconst, autoload and ;; custom-declare-variable because make-docfile is so amazingly stupid. ... (if (and (memq (car-safe form) '(defvar defvaralias defconst autoload custom-declare-variable)) (stringp (nth 3 form))) (byte-compile-output-docform nil nil '("\n(" 3 ")") form nil (memq (car form) '(defvaralias autoload custom-declare-variable))) (princ "\n" byte-compile--outbuffer) (prin1 form byte-compile--outbuffer) nil))) The following patch prevents custom-declare-variable from being compiled and lets the docstrings get printed properly. Probably needs a bit more refinement though. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-custom.el-custom-declare-variable-Don-t-compile.patch Content-Description: patch >From 4cb45936966de76f91b95971c886599a24361c5b Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 5 Aug 2017 20:02:19 -0400 Subject: [PATCH] * lisp/custom.el (custom-declare-variable): Don't compile (Bug#27748). --- lisp/custom.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/custom.el b/lisp/custom.el index ecfa34db5b..5876d3fd56 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -144,6 +144,9 @@ (defun custom-declare-variable (symbol default doc &rest args) DEFAULT is stored as SYMBOL's standard value, in SYMBOL's property `standard-value'. At the same time, SYMBOL's property `force-value' is set to nil, as the value is no longer rogue." + (declare (compiler-macro + (lambda (form) + `(eval ',form lexical-binding)))) (put symbol 'standard-value (purecopy (list default))) ;; Maybe this option was rogue in an earlier version. It no longer is. (when (get symbol 'force-value) -- 2.11.1 --=-=-=--