From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements Date: Mon, 08 May 2023 13:51:23 +0000 Message-ID: <875y936iec.fsf@posteo.net> References: <87fs89qg9y.fsf@breatheoutbreathe.in> <87cz3cea4k.fsf@posteo.net> <87pm7c7zfs.fsf@breatheoutbreathe.in> <83zg6gc5yp.fsf@gnu.org> <87sfc8gd9s.fsf@posteo.net> <87fs877tgz.fsf@breatheoutbreathe.in> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17115"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63337@debbugs.gnu.org, Eli Zaretskii To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 08 15:52:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pw1Hj-0004EH-FX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 May 2023 15:52:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pw1HZ-0006d9-4W; Mon, 08 May 2023 09:52:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pw1HW-0006d1-T4 for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 09:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pw1HW-0003xq-Aa for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 09:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pw1HV-0005ox-JP for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 09:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2023 13:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63337 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63337-submit@debbugs.gnu.org id=B63337.168355389322311 (code B ref 63337); Mon, 08 May 2023 13:52:01 +0000 Original-Received: (at 63337) by debbugs.gnu.org; 8 May 2023 13:51:33 +0000 Original-Received: from localhost ([127.0.0.1]:39615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw1H3-0005nl-3l for submit@debbugs.gnu.org; Mon, 08 May 2023 09:51:33 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:38217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw1H0-0005mw-Es for 63337@debbugs.gnu.org; Mon, 08 May 2023 09:51:31 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 75AF224019D for <63337@debbugs.gnu.org>; Mon, 8 May 2023 15:51:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683553884; bh=eh4/soxFfaINr4+Cwcw6JhdnndOi6x2Im6WpO5DGXOg=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=R4wIt4MoJ3be3MvOy2TdL6LKPGvYTFXHBw921oinTyIrbr4UEz8N6ct+HwZnPz5EJ 3M7c08nUpqA/mIdzxAeNWbEkYxR1/Kly2vcCFlcWEe3bpPrpSOUm8zbUvswpIJkPrZ Bzzf58NZaTQWN9N0WqFCSUGWF1l1R5T6v2fGsyXCFQgNGPU9vRcZziVZotRzmJ8umu Lh/XVxqRnHM7Q9qvCaIy8FyoBBmOnQ2bK2Hk05PlwfM8/RFntESJ1yW3y0JENOyCnC jBih8i7KCKKxYflEqw9xS73c09FuXmPn6sZCymrw4iQvT7XDvIa2cjaLYxdpxi8L8x 9FPUO4Zu7xmpw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QFN4C6VZwz9rxB; Mon, 8 May 2023 15:51:23 +0200 (CEST) In-Reply-To: <87fs877tgz.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Sun, 07 May 2023 13:29:53 -0700") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261323 Archived-At: Joseph Turner writes: > Philip Kaludercic writes: > >> Eli Zaretskii writes: >> >>>> Cc: 63337@debbugs.gnu.org >>>> Date: Sun, 07 May 2023 11:40:46 -0700 >>>> From: Joseph Turner via "Bug reports for GNU Emacs, >>>> the Swiss army knife of text editors" >>>> >>>> > According to the docs, makeinfo has -I to append the search path, and -P >>>> > to prepend. I don't know how well either of the two are supported, but >>>> > assuming they are, shouldn't -P be preferred? Or wouldn't it have any >>>> > effect? >>>> >>>> I am not sure what difference it would make. I don't know if the default >>>> @include search path includes anything besides the working directory. >> >> I don't know that either, and I can imagine that certain versions of >> makeinfo might be patched or this could change in the future. >> >>> It doesn't, according to the Texinfo manual. Only the current >>> directory is searched. >>> >>>> In the attached diff, I have changed -I to -P. >>> >>> I think it's a mistake: the current directory should searched first. >>> So -I is better. >> >> What do we mean by the current directory? When building the manual from >> an org-file, we switch to a temporary directory (where the .org -> .texi >> conversion is stored), so the "actual" directory is not the same as the >> default-directory. > > AFAICT, makeinfo searches the default-directory. See attached patch, > where we let-bind default-directory to the docs-directory. In this case, > neither -I nor -P is necessary. > > It's a bit strange to let-bind default-directory twice in the same > function, but we can't bind it at the top of the function, the > insert-file-contents expects default-directory to be package-desc-dir. It might be, but I'll have to look into that in more detail, that the first default-directory binding is not necessary if we pass (package-desc-dir pkg-desc) as the second argument to `expand-file-name' when binding `output'. Then this would all be simplified, and we could avoid the confusion you mention. > Joseph > > From 7ddfd7ab08820eef159b21047194aaaf4c8841f7 Mon Sep 17 00:00:00 2001 > From: Joseph Turner > Date: Sat, 6 May 2023 14:49:43 -0700 > Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include > statements > > --- > lisp/emacs-lisp/package-vc.el | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el > index 476c38916a8..c25a96ed942 100644 > --- a/lisp/emacs-lisp/package-vc.el > +++ b/lisp/emacs-lisp/package-vc.el > @@ -377,6 +377,7 @@ FILE can be an Org file, indicated by its \".org\" extension, > otherwise it's assumed to be an Info file." > (let* ((pkg-name (package-desc-name pkg-desc)) > (default-directory (package-desc-dir pkg-desc)) > + (docs-directory (expand-file-name (file-name-directory file))) > (output (expand-file-name (format "%s.info" pkg-name))) > clean-up) > (when (string-match-p "\\.org\\'" file) > @@ -389,16 +390,18 @@ otherwise it's assumed to be an Info file." > (setq clean-up t))) > (with-current-buffer (get-buffer-create " *package-vc doc*") > (erase-buffer) > - (cond > - ((/= 0 (call-process "makeinfo" nil t nil > - "--no-split" file "-o" output)) > - (message "Failed to build manual %s, see buffer %S" > - file (buffer-name))) > - ((/= 0 (call-process "install-info" nil t nil > - output (expand-file-name "dir"))) > - (message "Failed to install manual %s, see buffer %S" > - output (buffer-name))) > - ((kill-buffer)))) > + (let ((default-directory docs-directory)) > + ;; `let'-bind `default-directory' so that makeinfo resolves > + ;; relative @include statements in the docs directory > + (cond > + ((/= 0 (call-process "makeinfo" nil t nil "--no-split" file "-o" output)) > + (message "Failed to build manual %s, see buffer %S" > + file (buffer-name))) > + ((/= 0 (call-process "install-info" nil t nil > + output (expand-file-name "dir"))) > + (message "Failed to install manual %s, see buffer %S" > + output (buffer-name))) > + ((kill-buffer))))) > (when clean-up > (delete-file file))))