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

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

[nongnu] elpa/idris-mode 2fab0a7ea9 2/3: Extract `idris-highlight-source


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode 2fab0a7ea9 2/3: Extract `idris-highlight-source-file` from `idris-load-file`
Date: Thu, 1 Dec 2022 17:59:43 -0500 (EST)

branch: elpa/idris-mode
commit 2fab0a7ea9948da02d2e7e56dddf37bf7debd44a
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>

    Extract `idris-highlight-source-file` from `idris-load-file`
---
 idris-commands.el        | 26 +-------------------------
 idris-highlight-input.el | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/idris-commands.el b/idris-commands.el
index daa51c463a..9b8eb7ee32 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -231,31 +231,7 @@ A prefix argument forces loading but only up to the 
current line."
            (lambda (result)
              (pcase result
                (`(:highlight-source ,hs)
-                (cl-loop
-                 for h in hs
-                 do (pcase h
-                      (`(((:filename ,fn)
-                          (:start ,start-line-raw ,start-col-raw)
-                          (:end ,end-line-raw ,end-col-raw))
-                         ,props)
-                       (when (string= (file-name-nondirectory fn)
-                                      (file-name-nondirectory 
(buffer-file-name)))
-                         (let ((start-line (if (>=-protocol-version 2 1)
-                                               (1+ start-line-raw)
-                                             start-line-raw))
-                               (start-col  (if (>=-protocol-version 2 1)
-                                               (1+ start-col-raw)
-                                             start-col-raw))
-                               (end-line   (if (>=-protocol-version 2 1)
-                                               (1+ end-line-raw)
-                                             end-line-raw))
-                               (end-col    (if (>= idris-protocol-version 1)
-                                               (1+ end-col-raw)
-                                             end-col-raw)))
-                           (idris-highlight-input-region (current-buffer)
-                                                         start-line start-col
-                                                         end-line end-col
-                                                         props)))))))
+                (idris-highlight-source-file hs))
                (_ (idris-make-clean)
                   (idris-update-options-cache)
                   (setq idris-currently-loaded-buffer (current-buffer))
diff --git a/idris-highlight-input.el b/idris-highlight-input.el
index f3191b08dd..521e4b0399 100644
--- a/idris-highlight-input.el
+++ b/idris-highlight-input.el
@@ -84,6 +84,32 @@ See Info node `(elisp)Overlay Properties' to understand how 
ARGS are used."
                    end-line end-col
                    highlight ))))))
 
+(defun idris-highlight-source-file (hs)
+  (cl-loop
+   for h in hs
+   do (pcase h
+        (`(((:filename ,fn)
+            (:start ,start-line-raw ,start-col-raw)
+            (:end ,end-line-raw ,end-col-raw))
+           ,props)
+         (when (string= (file-name-nondirectory fn)
+                        (file-name-nondirectory (buffer-file-name)))
+           (let ((start-line (if (>=-protocol-version 2 1)
+                                 (1+ start-line-raw)
+                               start-line-raw))
+                 (start-col  (if (>=-protocol-version 2 1)
+                                 (1+ start-col-raw)
+                               start-col-raw))
+                 (end-line   (if (>=-protocol-version 2 1)
+                                 (1+ end-line-raw)
+                               end-line-raw))
+                 (end-col    (if (>= idris-protocol-version 1)
+                                 (1+ end-col-raw)
+                               end-col-raw)))
+             (idris-highlight-input-region (current-buffer)
+                                           start-line start-col
+                                           end-line end-col
+                                           props)))))))
 
 (provide 'idris-highlight-input)
 ;;; idris-highlight-input.el ends here



reply via email to

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