Skip to content

Commit

Permalink
Merge pull request #627 from keram/issue-624-pack
Browse files Browse the repository at this point in the history
Extract regexp for .ipkg sourcedir option to constant and update the regexp to include also double quotes.
  • Loading branch information
jfdm authored Jun 10, 2024
2 parents aa580b6 + 851ab40 commit 334fef6
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 334fef6

Please sign in to comment.