summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-06-26 21:36:44 +0200
committerUlrich Müller <ulm@gentoo.org>2024-06-28 17:07:31 +0200
commit32bde6512c7b24240782743aab75e4015f89eb3e (patch)
tree43f3069c63720073fbbbb27999793ad2ddc85f48
parentDeactivate some menu entries for eclasses (diff)
downloadebuild-mode-32bde6512c7b24240782743aab75e4015f89eb3e.tar.gz
ebuild-mode-32bde6512c7b24240782743aab75e4015f89eb3e.tar.bz2
ebuild-mode-32bde6512c7b24240782743aab75e4015f89eb3e.zip
Improve error reporting in ebuild-mode-find-workdir
* ebuild-mode.el (ebuild-mode-find-workdir): Display a separate error message when the file is not an ebuild. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--ChangeLog3
-rw-r--r--ebuild-mode.el10
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 60e32d6..c366b70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2024-06-26 Ulrich Müller <ulm@gentoo.org>
+ * ebuild-mode.el (ebuild-mode-find-workdir): Display a separate
+ error message when the file is not an ebuild.
+
* ebuild-mode.el (ebuild-mode-menu): Deactivate entries that are
not useful in ebuild-eclass-mode.
diff --git a/ebuild-mode.el b/ebuild-mode.el
index 68da594..4ad5275 100644
--- a/ebuild-mode.el
+++ b/ebuild-mode.el
@@ -568,14 +568,14 @@ With prefix argument OTHER-WINDOW, visit the directory in another window."
(catdir (directory-file-name (file-name-directory pkgdir)))
(category (file-name-nondirectory catdir))
(pn (file-name-nondirectory pkgdir))
- (pf (file-name-sans-extension
- (file-name-nondirectory buffer-file-name))))
+ (basename (file-name-nondirectory buffer-file-name))
+ (pf (file-name-sans-extension basename)))
;; sanity check
+ (unless (string-match "\\.ebuild\\'" (file-name-sans-versions basename))
+ (error "Filename \"%s\" does not end in \".ebuild\"" basename))
(unless (and (file-exists-p
(expand-file-name "../profiles/repo_name" catdir))
- (string-match (concat "\\`" (regexp-quote pn) "-") pf)
- (string-match "\\.ebuild\\'"
- (file-name-sans-versions buffer-file-name)))
+ (string-match (concat "\\`" (regexp-quote pn) "-") pf))
(error "This doesn't look like an ebuild repository"))
(let ((workdir (concat (file-name-as-directory ebuild-mode-portage-tmpdir)
(file-name-as-directory category)