diff options
author | Ulrich Müller <ulm@gentoo.org> | 2022-05-21 09:47:04 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2022-05-21 09:47:04 +0200 |
commit | 13de5bc7d76498c27f5b9f340541cd3d0a221c55 (patch) | |
tree | 6b5df0b147d448185cb2ab6ad3e80bdcecb8c98a | |
parent | Version 1.59 released (diff) | |
download | ebuild-mode-13de5bc7d76498c27f5b9f340541cd3d0a221c55.tar.gz ebuild-mode-13de5bc7d76498c27f5b9f340541cd3d0a221c55.tar.bz2 ebuild-mode-13de5bc7d76498c27f5b9f340541cd3d0a221c55.zip |
Test for file name when calling an external command
* ebuild-mode.el (ebuild-run-command): Signal an error when not
visiting a file.
* glep-mode.el (glep-mode-format-html): Ditto.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ebuild-mode.el | 2 | ||||
-rw-r--r-- | glep-mode.el | 2 |
3 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2022-05-21 Ulrich Müller <ulm@gentoo.org> + + * ebuild-mode.el (ebuild-run-command): Signal an error when not + visiting a file. + * glep-mode.el (glep-mode-format-html): Ditto. + 2022-05-20 Ulrich Müller <ulm@gentoo.org> * Version 1.59 released. diff --git a/ebuild-mode.el b/ebuild-mode.el index 3f922bf..c246a29 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -373,6 +373,8 @@ If nil, `compilation-mode' will be used.") nil t))) (or (member command ebuild-commands-list) (error "Ebuild command \"%s\" not known" command)) + (or buffer-file-name + (error "No file for this buffer")) (let* ((file (file-relative-name buffer-file-name)) (shell-command (format "ebuild %s %s" file command)) (process-environment (cons "NOCOLOR=true" process-environment)) diff --git a/glep-mode.el b/glep-mode.el index c70e76b..82cf643 100644 --- a/glep-mode.el +++ b/glep-mode.el @@ -174,6 +174,8 @@ to `font-lock-end'." (interactive) "Generate HTML from reStructuredText GLEP file. Calls the external \"glep\" command." + (or buffer-file-name + (error "No file for this buffer")) (let* ((rst-file (file-relative-name buffer-file-name)) (html-file (concat (file-name-sans-extension rst-file) ".html"))) (compile (format "glep %s %s" rst-file html-file)))) |