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

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

[nongnu] elpa/idris-mode 0cae4b8086 3/3: Merge pull request #575 from ke


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode 0cae4b8086 3/3: Merge pull request #575 from keram/idris1-highlight-fix
Date: Thu, 1 Dec 2022 17:59:43 -0500 (EST)

branch: elpa/idris-mode
commit 0cae4b8086aaba21a9279bc9e15471efe119d688
Merge: d08fd3ec78 2fab0a7ea9
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #575 from keram/idris1-highlight-fix
    
    Fix code highlighting for Idris 1 protocol >= 1and
---
 idris-commands.el        | 27 +--------------------------
 idris-highlight-input.el | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/idris-commands.el b/idris-commands.el
index d8ae22a7b1..9b8eb7ee32 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -231,34 +231,9 @@ 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 2 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))
                   (when (member 'warnings-tree idris-warnings-printing)
                     (idris-list-compiler-notes))
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]