all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: 63337@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
Date: Sun, 07 May 2023 13:29:53 -0700	[thread overview]
Message-ID: <87fs877tgz.fsf@breatheoutbreathe.in> (raw)
In-Reply-To: <87sfc8gd9s.fsf@posteo.net>

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Eli Zaretskii <eliz@gnu.org> 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" <bug-gnu-emacs@gnu.org>
>>>
>>> > 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 2344 bytes --]

From 7ddfd7ab08820eef159b21047194aaaf4c8841f7 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
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


  reply	other threads:[~2023-05-07 20:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06 20:54 bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07  9:58 ` Philip Kaludercic
2023-05-07 10:56   ` Eli Zaretskii
2023-05-07 18:40   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07 19:11     ` Eli Zaretskii
2023-05-07 19:19       ` Philip Kaludercic
2023-05-07 20:29         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-05-08 13:51           ` Philip Kaludercic
2023-05-08 19:05             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  1:34               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  2:48                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  4:36               ` Eli Zaretskii
2023-05-09 23:49                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10  6:51                   ` Philip Kaludercic
2023-05-11  2:04                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-12  6:51                       ` Philip Kaludercic
2023-05-12  7:14                         ` Eli Zaretskii
2023-05-12  7:35                           ` Philip Kaludercic
2023-05-13  5:54                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-12  6:56                       ` Philip Kaludercic
2023-05-13  5:47                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13  8:41     ` Philip Kaludercic
2023-05-13 16:38       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13 17:14         ` Philip Kaludercic
2023-05-13 18:31           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fs877tgz.fsf@breatheoutbreathe.in \
    --to=bug-gnu-emacs@gnu.org \
    --cc=63337@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.