Skip to content

Commit aceca6b

Browse files
committed
fix: the tags-path-value in case of relative symbols of tags
1 parent 2284d53 commit aceca6b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: lisp/init-tags.el

+11-11
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Updated: 2023-10-20"
6161
(tags-filename (if (string-equal tags-format "etags")
6262
(if (string-equal tag-relative "y") "TAGS" "TAGS_ABS")
6363
(if (string-equal tag-relative "y") "tags" "tags_abs"))))
64-
(list (read-directory-name "Enter the directory for creating tags file: ")
64+
(list (expand-file-name (read-directory-name "Enter the directory for creating tags file: "))
6565
tags-format
6666
tag-relative
6767
(read-string "Enter the desired tags filename: " tags-filename)
@@ -75,15 +75,15 @@ Updated: 2023-10-20"
7575
)
7676
(if (boundp 'process-name) process-name "create tags"))))
7777

78-
(let* ((target-dir-value (if (string= "" dir-name)
79-
default-directory
80-
(if (eq system-type 'windows-nt)
81-
;; if the dir-name already start with "/d", just use it
82-
(if (string-prefix-p "/d" dir-name)
83-
dir-name
84-
;; fix changing dir across different drives issue on Windows
85-
(concat "/d " dir-name))
86-
(expand-file-name dir-name))))
78+
;; debug,
79+
;; (message "dir-name: %s" dir-name)
80+
81+
(let* ((target-dir-value (cond
82+
((string-empty-p dir-name) default-directory)
83+
((and (eq system-type 'windows-nt) (not (string-prefix-p "/d" dir-name)))
84+
;; On Windows, add "/d " if switching across drives
85+
(concat "/d " dir-name))
86+
(t dir-name)))
8787

8888
(tags-format-value (if (string-equal tags-format 'ctags) "" "-e"))
8989

@@ -97,7 +97,7 @@ Updated: 2023-10-20"
9797

9898
(tags-path-value
9999
(if (string= tag-relative 'y)
100-
(expand-file-name tags-filename target-dir-value)
100+
(expand-file-name tags-filename dir-name)
101101
(or tags-path
102102
(expand-file-name tags-filename
103103
(read-directory-name

0 commit comments

Comments
 (0)