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

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

[nongnu] elpa/haskell-tng-mode dbb2b7a 350/385: block / return-from inst


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode dbb2b7a 350/385: block / return-from instead of catch / throw
Date: Wed, 6 Oct 2021 00:00:02 -0400 (EDT)

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

    block / return-from instead of catch / throw
---
 haskell-tng-hsinspect.el |  3 +++
 haskell-tng-layout.el    | 18 +++++++++++-------
 haskell-tng-util.el      |  7 ++++---
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/haskell-tng-hsinspect.el b/haskell-tng-hsinspect.el
index 8227d09..d856644 100644
--- a/haskell-tng-hsinspect.el
+++ b/haskell-tng-hsinspect.el
@@ -14,6 +14,9 @@
 ;; TODO this file needs tests, if not testing calling hsinspect then at least
 ;; with pre-canned data.
 
+(eval-when-compile
+  (require 'cl))
+
 (require 'array)
 (require 'subr-x)
 (require 'tar-mode)
diff --git a/haskell-tng-layout.el b/haskell-tng-layout.el
index 9107d00..fbfaa3e 100644
--- a/haskell-tng-layout.el
+++ b/haskell-tng-layout.el
@@ -27,6 +27,9 @@
 ;; Galaxy brain caching would use properties and put dirty markers on inserted
 ;; or deleted regions. Would give fast lookup at point.
 
+(eval-when-compile
+  (require 'cl))
+
 (require 'haskell-tng-util)
 
 ;; A alist of lists of (OPEN . (CLOSE . SEPS)) positions, keyed by (START . 
END)
@@ -170,7 +173,7 @@ using a cache if available."
           value)))))
 
 (defun haskell-tng--layout-next-wldo (limit)
-  (catch 'wldo
+  (block wldo
     (while (< (point) limit)
       (forward-comment limit)
       (cond
@@ -181,9 +184,10 @@ using a cache if available."
         (goto-char (match-end 0))
         (forward-comment limit)
         (unless (looking-at "{")
-          (throw 'wldo (haskell-tng--layout-wldo
-                        (min (or (haskell-tng--util-paren-close) (point-max))
-                             limit)))))
+          (return-from wldo
+            (haskell-tng--layout-wldo
+             (min (or (haskell-tng--util-paren-close) (point-max))
+                  limit)))))
 
        (t (skip-syntax-forward "^-"))))))
 
@@ -197,7 +201,7 @@ WLDO that is using the offside rule."
     (let* ((open (point))
            seps
            (level (current-column))
-           (close (catch 'closed
+           (close (block closed
                     (while (< (point) limit)
                       (forward-line)
                       (forward-comment limit)
@@ -207,9 +211,9 @@ WLDO that is using the offside rule."
                                        (rx bol (or "," ")" "]" "}")))))
                         (push (point) seps))
                       (when (<= limit (point))
-                        (throw 'closed limit))
+                        (return-from closed limit))
                       (when (< (current-column) level)
-                        (throw 'closed (point))))
+                        (return-from closed (point))))
                     limit)))
       `(,open . (,close . ,(reverse seps))))))
 
diff --git a/haskell-tng-util.el b/haskell-tng-util.el
index 02fc271..75f4b01 100644
--- a/haskell-tng-util.el
+++ b/haskell-tng-util.el
@@ -11,6 +11,8 @@
 
 ;; TODO move things to single use sites (twas premature abstraction!)
 
+(eval-when-compile
+  (require 'cl))
 (require 'subr-x)
 (require 'xdg)
 
@@ -30,11 +32,10 @@
   (save-excursion
     (goto-char (or pos (point)))
     (let ((level (current-column)))
-      (catch 'closed
+      (block closed
         (while (and (forward-line) (not (eobp)))
           (when (<= (current-indentation) level)
-            (throw 'closed (point))))
-        nil))))
+            (return-from closed (point))))))))
 
 (defun haskell-tng--util-type-ender (&optional pos)
   ;; trivial, should just be called as an inline regexp



reply via email to

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