Skip to content

Commit

Permalink
Extract regexp for .ipkg sourcedir option to constant and
Browse files Browse the repository at this point in the history
update the regexp to include also double quotes.

Why:
In Idris2 the sourcedir option has double quotes.

Relates to:
#624
  • Loading branch information
keram committed Jun 8, 2024
1 parent aa580b6 commit 851ab40
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions idris-ipkg-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
(defconst idris-ipkg-font-lock-defaults
`(,idris-ipkg-keywords))

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

;;; Completion

Expand Down Expand Up @@ -142,7 +145,7 @@
(goto-char (point-min))
(when (and (file-exists-p src-dir)
(file-directory-p src-dir)
(re-search-forward "^sourcedir\\s-*=\\s-*\\([a-zA-Z/0-9]+\\)" nil t))
(re-search-forward idris-ipkg-sourcedir-re nil t))
(let ((start (match-beginning 1))
(end (match-end 1))
(map (make-sparse-keymap)))
Expand Down Expand Up @@ -304,9 +307,7 @@ arguments."
(save-excursion
(goto-char (point-min))
(let ((found
(re-search-forward "^\\s-*sourcedir\\s-*=\\s-*\\(\\sw+\\)"
nil
t)))
(re-search-forward idris-ipkg-sourcedir-re nil t)))
(if found
(let ((subdir (buffer-substring-no-properties (match-beginning 1) (match-end 1))))
(concat (file-name-directory basename) subdir))
Expand Down

0 comments on commit 851ab40

Please sign in to comment.