summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2022-05-21 09:49:32 +0200
committerUlrich Müller <ulm@gentoo.org>2022-05-21 09:49:32 +0200
commita680df81380d6e4f7fdb0f431c2b4bf1d8d94579 (patch)
tree346e4db636774299d00aff94011cb47cfe51ddf5
parentTest for file name when calling an external command (diff)
downloadebuild-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--ChangeLog3
-rw-r--r--devbook-mode.el11
2 files changed, 9 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0034ee7..94c5a45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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"