#! emacs --script ;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/script/box.el ;; ;; usage: ;; $ box.el 13 3 ;; +-----------+ ;; | | ;; +-----------+ (require 'cl-lib) (defun box (&optional xc yc) (or xc (setq xc 74)) (or yc (setq yc 25)) (when (and (<= 3 xc) (<= 3 yc)) (let* ((yb ?\|) (xb ?\-) (cb ?\+) (bb ?\s) (xci (- xc 2)) (yci (- yc 2)) (tl (format "%c%s%c" cb (make-string xci xb) cb)) (xl (format "%c%s%c" yb (make-string xci bb) yb)) (all `(,tl ,@(make-list yci xl) ,tl)) (str (string-join all "\n"))) (message str)))) (apply #'box (mapcar #'string-to-number (last command-line-args 2)))