Skip to content

Commit 851ab40

Browse files
committed
Extract regexp for .ipkg sourcedir option to constant and
update the regexp to include also double quotes. Why: In Idris2 the sourcedir option has double quotes. Relates to: idris-hackers#624
1 parent aa580b6 commit 851ab40

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: idris-ipkg-mode.el

+5-4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
(defconst idris-ipkg-font-lock-defaults
8787
`(,idris-ipkg-keywords))
8888

89+
(defconst idris-ipkg-sourcedir-re
90+
"^sourcedir\\s-*=\\s-*\"?\\([a-zA-Z/0-9]+\\)\"?")
91+
;; "^\\s-*sourcedir\\s-*=\\s-*\\(\\sw+\\)"
8992

9093
;;; Completion
9194

@@ -142,7 +145,7 @@
142145
(goto-char (point-min))
143146
(when (and (file-exists-p src-dir)
144147
(file-directory-p src-dir)
145-
(re-search-forward "^sourcedir\\s-*=\\s-*\\([a-zA-Z/0-9]+\\)" nil t))
148+
(re-search-forward idris-ipkg-sourcedir-re nil t))
146149
(let ((start (match-beginning 1))
147150
(end (match-end 1))
148151
(map (make-sparse-keymap)))
@@ -304,9 +307,7 @@ arguments."
304307
(save-excursion
305308
(goto-char (point-min))
306309
(let ((found
307-
(re-search-forward "^\\s-*sourcedir\\s-*=\\s-*\\(\\sw+\\)"
308-
nil
309-
t)))
310+
(re-search-forward idris-ipkg-sourcedir-re nil t)))
310311
(if found
311312
(let ((subdir (buffer-substring-no-properties (match-beginning 1) (match-end 1))))
312313
(concat (file-name-directory basename) subdir))

0 commit comments

Comments
 (0)