diff options
author | Ulrich Müller <ulm@gentoo.org> | 2022-05-21 09:49:32 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2022-05-21 09:49:32 +0200 |
commit | a680df81380d6e4f7fdb0f431c2b4bf1d8d94579 (patch) | |
tree | 346e4db636774299d00aff94011cb47cfe51ddf5 | |
parent | Test for file name when calling an external command (diff) | |
download | ebuild-mode-a680df81380d6e4f7fdb0f431c2b4bf1d8d94579.tar.gz ebuild-mode-a680df81380d6e4f7fdb0f431c2b4bf1d8d94579.tar.bz2 ebuild-mode-a680df81380d6e4f7fdb0f431c2b4bf1d8d94579.zip |
Rework logic for guide element in devbook skeleton
* devbook-mode.el (devbook-insert-skeleton): Rework logic for
guide element.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | devbook-mode.el | 11 |
2 files changed, 9 insertions, 5 deletions
@@ -1,5 +1,8 @@ 2022-05-21 Ulrich Müller <ulm@gentoo.org> + * devbook-mode.el (devbook-insert-skeleton): Rework logic for + guide element. + * ebuild-mode.el (ebuild-run-command): Signal an error when not visiting a file. * glep-mode.el (glep-mode-format-html): Ditto. diff --git a/devbook-mode.el b/devbook-mode.el index 7fd6139..afe0e6c 100644 --- a/devbook-mode.el +++ b/devbook-mode.el @@ -46,11 +46,12 @@ nil "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<guide " - (let* ((dirname (file-name-directory buffer-file-name)) - (path (if (string-match ".*/devmanual[^/]*/\\(.*\\)" dirname) - (match-string 1 dirname) - (skeleton-read "Path: ")))) - (if (string= path "") + (let ((path (if (and buffer-file-name + (string-match "/devmanual[^/]*/\\(.*/\\)" + buffer-file-name)) + (match-string 1 buffer-file-name) + (skeleton-read "Path: ")))) + (if (string-match "\\`/*\\'" path) "root=\"true\"" (concat "self=\"" (file-name-as-directory path) "\""))) ">\n" |