From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements Date: Sun, 07 May 2023 13:29:53 -0700 Message-ID: <87fs877tgz.fsf@breatheoutbreathe.in> References: <87fs89qg9y.fsf@breatheoutbreathe.in> <87cz3cea4k.fsf@posteo.net> <87pm7c7zfs.fsf@breatheoutbreathe.in> <83zg6gc5yp.fsf@gnu.org> <87sfc8gd9s.fsf@posteo.net> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30803"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63337@debbugs.gnu.org, Eli Zaretskii To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 07 22:55:28 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 1pvlPj-0007rT-WD for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 May 2023 22:55:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvlPN-0005Y9-35; Sun, 07 May 2023 16:55: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 1pvlPL-0005Xu-Ge for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 16:55:03 -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 1pvlPL-0006Wl-8C for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 16:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pvlPK-0003xx-Ht for bug-gnu-emacs@gnu.org; Sun, 07 May 2023 16:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 May 2023 20:55:02 +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.168349288415120 (code B ref 63337); Sun, 07 May 2023 20:55:02 +0000 Original-Received: (at 63337) by debbugs.gnu.org; 7 May 2023 20:54:44 +0000 Original-Received: from localhost ([127.0.0.1]:38585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvlP1-0003vl-9U for submit@debbugs.gnu.org; Sun, 07 May 2023 16:54:43 -0400 Original-Received: from out-22.mta1.migadu.com ([95.215.58.22]:59033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pvlOy-0003vH-De for 63337@debbugs.gnu.org; Sun, 07 May 2023 16:54:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=breatheoutbreathe.in; s=key1; t=1683492879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EsGwYCXZZ35233QucPp6cqdY/u9jH+EDlCa4EPwSzTI=; b=TfraJyzJBi0wt3dTj14ex48A1HWXoACJnWZlkYH3+qWi5M1ucqmnoTcuO7Id9gIWiTJ1KJ 9T6eATqPDKO1231lb98GwFKzKohhI6e3qVl8sqdUTdYw+o/2LBMgLgP8fpPD7URMld7nyP m3i2GO3rY/jG5Uly/k4WLfUiGsc4a0w= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <87sfc8gd9s.fsf@posteo.net> X-Migadu-Flow: FLOW_OUT 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:261278 Archived-At: --=-=-= Content-Type: text/plain 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. Joseph --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-package-vc-build-documentation-Relative-include-.patch >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)))) -- 2.39.2 --=-=-=--