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

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

[nongnu] elpa/pacmacs 09c0a15f40 217/472: Get pacmacs--object-at-p back


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 09c0a15f40 217/472: Get pacmacs--object-at-p back (#122)
Date: Thu, 6 Jan 2022 21:59:26 -0500 (EST)

branch: elpa/pacmacs
commit 09c0a15f40280f67e166f3a83bb7735ffc8fb9b8
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Get pacmacs--object-at-p back (#122)
---
 pacmacs-board.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/pacmacs-board.el b/pacmacs-board.el
index 837dfa91f6..68e5714c1a 100644
--- a/pacmacs-board.el
+++ b/pacmacs-board.el
@@ -69,6 +69,20 @@
                (equal object-type type)))
            cell)))
 
+(defun pacmacs--object-at-p (board row column objects)
+  (plist-bind ((width :width)
+               (height :height))
+      board
+    (let ((wrapped-row (mod row height))
+          (wrapped-column (mod column width)))
+      (-find (-lambda (object)
+               (plist-bind ((object-row :row)
+                            (object-column :column))
+                   object
+                 (and (= object-row wrapped-row)
+                      (= object-column wrapped-column))))
+             objects))))
+
 (defun pacmacs--step-point (board row column direction)
   (plist-bind ((width :width)
                (height :height))



reply via email to

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