Subject: Re: bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements

From: Joseph Turner <[email-masked]>
Date: Sun, 07 May 2023 11:40:46 -0700

Philip Kaludercic <[email-masked]> writes:

> Joseph Turner <[email-masked]> writes:
>
>> Hello!
>>
>> Because package-vc--build-documentation exports the texinfo manual to a
>> temp file inside /tmp/ , any @include statements with relative paths
>> break the makeinfo call.
>>
>> I noticed this issue when attempting to use package-vc to install
>> org-transclusion, whose manual contains the line
>>
>> #+texinfo: @include fdl.texi
>>
>> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>>
>> The attached patch solves this problem by passing the -I flag to
>> makeinfo. From makeinfo --help:
>>
>> -I DIR                        append DIR to the @include search path.
>
> Good catch, this should be applied to emacs-29.
>
>> Best,
>>
>> Joseph
>>
>> From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <[email-masked]>
>> 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 | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index 489610e2a1e..63c10285ca7 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -381,6 +381,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)
>> @@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
>>        (erase-buffer)
>>        (cond
>>         ((/= 0 (call-process "makeinfo" nil t nil
>> -                            "--no-split" file "-o" output))
>> +                            "-I" docs-directory
>
> 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.

In the attached diff, I have changed -I to -P.

>> +                            "--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

>From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
From: Joseph Turner <[email-masked]>
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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 489610e2a1e..63c10285ca7 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -381,6 +381,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)
@@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
       (erase-buffer)
       (cond
        ((/= 0 (call-process "makeinfo" nil t nil
-                            "--no-split" file "-o" output))
+                            "-P" docs-directory
+                            "--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
-- 
2.39.2