Skip to content

Instantly share code, notes, and snippets.

@rexim
Created October 25, 2015 09:02
Show Gist options
  • Save rexim/038cbc751bcb81f7c0c9 to your computer and use it in GitHub Desktop.
Save rexim/038cbc751bcb81f7c0c9 to your computer and use it in GitHub Desktop.
Emacs Windows XBM bug
;;; -*- lexical-binding: t -*-
;; 1. Copy this code to an Emacs buffer
;; 2. M-x eval-buffer
(let ((width 90)
(height 90)
(tiles-column-count 3)
(tiles-row-count 3)
(foreground-color "red")
(background-color "blue"))
(let* ((tile-width (floor (/ width (float tiles-column-count))))
(tile-height (floor (/ height (float tiles-row-count))))
(bits (apply #'vector
(mapcar (lambda (init)
(make-bool-vector width init))
(make-list height nil)))))
(let ((current-color t))
(dotimes (row tiles-row-count)
(dotimes (column tiles-column-count)
(dotimes (i tile-height)
(dotimes (j tile-width)
(let ((y (+ (* row tile-height) i))
(x (+ (* column tile-width) j)))
(aset (aref bits y) x current-color))))
(setq current-color (not current-color)))))
(insert-image
(create-image bits 'xbm t
:width width :height height
:foreground foreground-color
:background background-color)
" ")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment