Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 846569 - app-emacs/ebuild-mode-1.56 interferes with the nov.el emacs package
Summary: app-emacs/ebuild-mode-1.56 interferes with the nov.el emacs package
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: GNU Emacs project
URL:
Whiteboard:
Keywords: InVCS, UPSTREAM
Depends on:
Blocks:
 
Reported: 2022-05-20 13:08 UTC by Francesco Turco
Modified: 2022-05-21 11:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,4.00 KB, text/plain)
2022-05-20 13:09 UTC, Francesco Turco
Details
backtrace.txt (backtrace.txt,914 bytes, text/plain)
2022-05-20 13:10 UTC, Francesco Turco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Turco 2022-05-20 13:08:49 UTC
I'm running app-editors/emacs-27.2-r5, app-emacs/ebuild-mode-1.56 and app-emacs/nov-0.4.0 (the latter from my personal Gentoo overlay).

Link to my personal Gentoo overlay: https://git.sr.ht/~fturco/gentoo.

When I try opening an EPUB book with nov.el, emacs complains with the following error message:

> Wrong type argument: stringp, nil

You can find the emacs backtrace as an attachment to this bug report.

As far as I can understand, the problem is in the ebuild-repo-mode-maybe-enable function in ebuild-mode.el. The buffer for the EPUB book does not have a corresponding file, because EPUB books are basically ZIP archives that are extracted on the fly by nov.el in order to access book chapters. For this reason, the buffer-file-name function will return nil. But then the locate-dominating-file function will get nil as its first argument instead of a string, and will fail.

I discussed the problem in the #emacs channel on Libera, and they told me that we should probably replace the following line:

> (and (locate-dominating-file buffer-file-name "profiles/repo_name")

with:

> (and buffer-file-name (locate-dominating-file buffer-file-name "profiles/repo_name")

After copying the function ebuild-repo-mode-maybe-enable function to the scratch buffer, fixing it and loading it with eval-defun, I can successfully open EPUB books with nov.el.

I'm no emacs expert, so I'm not sure if this fix is the best possible one, but at least it does the job.
Comment 1 Francesco Turco 2022-05-20 13:09:34 UTC
Created attachment 779612 [details]
emerge-info.txt

emerge --info
Comment 2 Francesco Turco 2022-05-20 13:10:13 UTC
Created attachment 779615 [details]
backtrace.txt

emacs backtrace
Comment 3 Larry the Git Cow gentoo-dev 2022-05-20 16:33:29 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/ebuild-mode.git/commit/?id=46dd6ccf03f5dab9d86a6eca160ca94f2b67024c

commit 46dd6ccf03f5dab9d86a6eca160ca94f2b67024c
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-05-20 16:31:00 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-05-20 16:31:00 +0000

    Protect against buffer-file-name being nil
    
    * ebuild-mode.el (ebuild-mode, ebuild-repo-mode-maybe-enable):
    Protect against buffer-file-name being nil. Bug 846569.
    
    Bug: https://bugs.gentoo.org/846569
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 ChangeLog      |  5 +++++
 ebuild-mode.el | 14 ++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
Comment 4 Ulrich Müller gentoo-dev 2022-05-20 16:35:25 UTC
I'll make a new release today or tomorrow.
Comment 5 Larry the Git Cow gentoo-dev 2022-05-20 18:25:45 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30a94b889a925b22540dc8e7282c0c248d07421e

commit 30a94b889a925b22540dc8e7282c0c248d07421e
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-05-20 18:15:43 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-05-20 18:25:27 +0000

    app-emacs/ebuild-mode: Version bump to 1.59
    
    Closes: https://bugs.gentoo.org/846569
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 app-emacs/ebuild-mode/Manifest                |  1 +
 app-emacs/ebuild-mode/ebuild-mode-1.59.ebuild | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
Comment 6 Ulrich Müller gentoo-dev 2022-05-20 18:39:24 UTC
Thanks for reporting!

Please test ebuild-mode-1.59.
Comment 7 Francesco Turco 2022-05-21 11:06:01 UTC
I confirm that ebuild-mode-1.59 works fine now. Thank you!