emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode ee1fb28 345/385: small cleanup


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode ee1fb28 345/385: small cleanup
Date: Wed, 6 Oct 2021 00:00:01 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit ee1fb28821240c3b91def9f32ce13f027cbe9b0c
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    small cleanup
---
 haskell-tng-hsinspect.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index 7914431..9795c48 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -71,10 +71,7 @@ definition of the symbol in the build tool's source archive."
           (error "%s is defined in a local package" qualified)
         (when-let* ((srcid (or internal-srcid (alist-get 'srcid pkg-entry)))
                     (module (or internal-module (alist-get 'module 
module-entry)))
-                    (file (concat
-                           ;; TODO string-replace would be nice...
-                           (mapconcat 'identity (split-string module (rx ".")) 
"/" )
-                           ".hs"))
+                    (file (concat (haskell-tng--string-replace module "." "/") 
".hs"))
                     (tarball (haskell-tng--hsinspect-srcid-source srcid)))
           (when (not (file-exists-p tarball))
             ;; We can't expect stack to reveal source locations because it
@@ -108,6 +105,9 @@ definition of the symbol in the build tool's source 
archive."
              (re-search-forward (rx-to-string `(: (| bol "= " "| " "data " 
"type " "class ") ,name symbol-end)) nil t)
              (re-search-forward (rx-to-string `(: symbol-start ,name 
symbol-end))))))))))
 
+(defun haskell-tng--string-replace (str from to)
+  (mapconcat 'identity (split-string str (regexp-quote from)) to))
+
 (defun haskell-tng--string-split-last (str sep)
   "Return `(front . back)' of a STR split on the last SEP."
   ;; TODO optimise



reply via email to

[Prev in Thread] Current Thread [Next in Thread]