]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/xpm/xpm-m2z.el
Merge commit 'e342c330807fdd09adba974611122d1c95bdf07d' from hydra
[gnu-emacs-elpa] / packages / xpm / xpm-m2z.el
index c9124f97a47bcd8f83d3081955b92dac9b10f05b..25d56fa569c3b16ef9e8dee4d9ae9d3b05d715c7 100644 (file)
@@ -2,6 +2,9 @@
 
 ;; Copyright (C) 2014  Free Software Foundation, Inc.
 
+;; Author: Thien-Thi Nguyen <ttn@gnu.org>
+;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org>
+
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
@@ -31,7 +34,6 @@
 
 (require 'artist)
 (require 'cl-lib)
-(eval-when-compile (require 'cl))
 
 ;;;###autoload
 (defun xpm-m2z-ellipse (cx cy rx ry)
@@ -50,10 +52,12 @@ RX and RY, respectively.  For example:
  X   -3    6    10
  Y    0    7     8
 
-The span is always an even number.  As a special case,
-if RX or RY is less than 1, the value is nil."
-  (assert (not (integerp cx)))
-  (assert (not (integerp cy)))
+The span is always an even number.  As a special case, if the
+absolute value of RX or RY is less than 1, the value is nil."
+  (cl-assert (and (not (integerp cx))
+                  (not (integerp cy)))
+             nil "Integer component in center coordinate: (%S,%S)"
+             cx cy)
   (unless (or (> 1 (abs rx))
               (> 1 (abs ry)))
     (cl-flet*
@@ -67,23 +71,25 @@ if RX or RY is less than 1, the value is nil."
          (placed (origin scale n)
                  (truncate (+ origin (* scale n))))
          (orient (coords quadrant)
-                 (loop with (sx . sy) = quadrant
-                       for (x . y) in coords
-                       collect (cons (placed cx sx x)
-                                     (placed cy sy y)))))
+                 (cl-loop
+                  with (sx . sy) = quadrant
+                  for (x . y) in coords
+                  collect (cons (placed cx sx x)
+                                (placed cy sy y)))))
       (delete-dups
-       (loop with coords = (mapcar
-                            #'normal
-                            (artist-ellipse-generate-quadrant
-                             ;; Specify row first; artist.el is like that.
-                             ;; (That's why ‘normal’ does what it does...)
-                             ry rx))
-             for quadrant               ; these are in order: I-IV
-             in '(( 1 .  1)             ; todo: "manually" remove single
-                  (-1 .  1)             ;       (border point) overlaps;
-                  (-1 . -1)             ;       avoid ‘delete-dups’
-                  ( 1 . -1))
-             append (orient coords quadrant))))))
+       (cl-loop
+        with coords = (mapcar
+                       #'normal
+                       (artist-ellipse-generate-quadrant
+                        ;; Specify row first; artist.el is like that.
+                        ;; (That's why ‘normal’ does what it does...)
+                        ry rx))
+        for quadrant                    ; these are in order: I-IV
+        in '(( 1 .  1)                  ; todo: "manually" remove single
+             (-1 .  1)                  ;       (border point) overlaps;
+             (-1 . -1)                  ;       avoid ‘delete-dups’
+             ( 1 . -1))
+        append (orient coords quadrant))))))
 
 ;;;###autoload
 (defun xpm-m2z-circle (cx cy radius)