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: Wed, 10 May 2023 06:51:53 +0000 Message-ID: <87lehwfzli.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> <875y936iec.fsf@posteo.net> <87y1lyhbfy.fsf@breatheoutbreathe.in> <83sfc6azol.fsf@gnu.org> <87bkitgj3c.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="20004"; 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 Wed May 10 08:53:25 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 1pwdhU-0004zx-H8 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 May 2023 08:53:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwdhD-0005DV-DN; Wed, 10 May 2023 02:53:07 -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 1pwdhB-0005DM-3V for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 02:53:05 -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 1pwdh9-0006Mi-PX for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 02:53:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pwdh8-0002io-Er for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 02:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 May 2023 06:53: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.168370152410377 (code B ref 63337); Wed, 10 May 2023 06:53:02 +0000 Original-Received: (at 63337) by debbugs.gnu.org; 10 May 2023 06:52:04 +0000 Original-Received: from localhost ([127.0.0.1]:45058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwdgC-0002hJ-CV for submit@debbugs.gnu.org; Wed, 10 May 2023 02:52:04 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:48943) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwdg8-0002gl-JF for 63337@debbugs.gnu.org; Wed, 10 May 2023 02:52:02 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 810F3240937 for <63337@debbugs.gnu.org>; Wed, 10 May 2023 08:51:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683701514; bh=9pvLpr5W54+07RyeoyKucin0QWIq1+sXQsP/MQtnerg=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=nGKL87Zl43zUfnP9L4vofYfguA3wVpw2AAjACZxL4lRZtf1mm3zqFmfFU6ObHftqW MMfLCBx9R4odY7uS32Vqu4ASuM9neG0B/PyiKao3cAQSGMw+houki+OTrJUbLtqzBj fJjxJj44qipyK/FB+0eKEyoK7nRNS8EAhnVS3XLlAkVkPajmRAdCqcx0kqxR6eDStA VrD1hKDqmCKEz54hTkWY+0SxHsrKmId7twKKSCz3IS/tOyyc2X2xydaeX6ng116dov GCV8BDitlPiOBE/6ZnvlvnxcDIzWYY64rJw8JwIM13Qu8ux3i/HdrPmpRhOTAyHR1G imETrtIM0iuIQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QGQgG072Jz9rxG; Wed, 10 May 2023 08:51:53 +0200 (CEST) In-Reply-To: <87bkitgj3c.fsf@breatheoutbreathe.in> (Joseph Turner's message of "Tue, 09 May 2023 16:49:24 -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:261470 Archived-At: Joseph Turner writes: > Eli Zaretskii writes: > >>> From: Joseph Turner >>> Cc: Eli Zaretskii , 63337@debbugs.gnu.org >>> Date: Mon, 08 May 2023 12:05:51 -0700 >>> >>> Note about the following two lines: >>> >>> + (file-path (expand-file-name file (package-desc-dir pkg-desc))) >>> + (default-directory (expand-file-name (file-name-directory file-path))) >>> >>> (package-desc-dir pkg-desc) may return a relative path with or without a >>> directory, e.g. "doc/manual.org" or "manual.org". In the latter case, >>> (file-name-directory "manual.org") would return `nil' and >>> (expand-file-name nil) would signal an error. >>> >>> Therefore, in the `file-path' `let'-binding, we first expand the return >>> value of (package-desc-dir pkg-desc) to ensure that it contains a directory. >> >> Please don't use "path" for anything that is not a PATH-style list of >> directory: the GNU Coding Standards frown on such usage. We use >> file-name instead. For the same reasons, please don't give your >> variables names that include "path" unless they are lists of >> directories. > > Good to know, thank you! I changed `file-path' to `file-name'. > >>> --- a/lisp/emacs-lisp/package-vc.el >>> +++ b/lisp/emacs-lisp/package-vc.el >>> @@ -376,14 +376,17 @@ Package specs are loaded from trusted package archives." >>> 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)) >>> + (file-path (expand-file-name file (package-desc-dir pkg-desc))) >>> + ;; `let'-bind `default-directory' to the directory containing the .org or .info FILE >>> + ;; so that makeinfo can resolve relative @include statements in the docs directory. >>> + (default-directory (expand-file-name (file-name-directory file-path))) >> >> There should be no reason to call expand-file-name in the last line, >> since the argument of file-name-directory is already expanded. > > Good catch! Fixed. > >> Also, please make the comment lines shorter, preferably less than 75 >> columns. > > Done. > > Thank you!! > > Joseph Ok, do you have a few example repositories that we can use to test edge-cases?