Subject: bug#36337: 26.1; XBM images are sometimes not displayed correctly

From: Pip Cet <[email-masked]>
Date: Fri, 28 Jun 2019 08:29:04 +0000

On Fri, Jun 28, 2019 at 7:58 AM Eli Zaretskii <[email-masked]> wrote:
> > From: Pip Cet <[email-masked]>
> > Date: Sun, 23 Jun 2019 19:16:04 +0000
> > Cc: [email-masked], [email-masked]
> >
> > > Or maybe we should have a variant of make-bool-vector that accepts 2
> > > dimension s instead of just one?
> >
> > I don't really see how that would be generally useful, to be honest.
>
> For one, it would be useful in this particular case.  Or would you
> rather require the width of XBM be an integral multiple of 8?

Having thought about it, I would rather require the bool vector passed
to XBM to be in the right format: the width can be 100, but the
stride, specified by a new :stride argument, must be the smallest
multiple of 8 greater or equal to the width. If you don't want that,
pass a vector of bool vectors which is copied together, but let's not
pretend we can take a 10,000-bit bool vector and display it
efficiently.

I think my mistake was not to distinguish between stride and width,
but we can easily do so. Shall I prepare a patch?

> > In fact, I just played around with removing bool vector support
> > entirely.

> I'm sorry, but I object to removing a feature that has been with us
> since Emacs 19

Okay. Thanks for taking the time to explain. One serious question,
though unrelated to the current bug: do you think it is just the Lisp
API that we're stuck with for eternity, or is the C representation of
bool vectors forbidden territory as well?

> , for which we installed new operations just recently in Emacs 24.

If we add new features for bool vectors, they might stick out less.
People might actually start using them. That would invalidate my
earlier argument.

> What you propose is not what I think I had in mind.  I meant to extend
> make-bool-vector (or make a new function, if extending proves
> inconvenient or inelegant) that generates a bool-vector given 2
> dimensions, not one.  Then such vectors could be used to create XBM
> images of arbitrary dimensions.  We could even call this new function
> something like make-xbm-data or somesuch, if its utility is limited to
> XBM images.

How is a vector of bool vectors different from a 2-dimensional bool
vector, from the point of view of Lisp? If I understand you correctly,
you would like two-dimensional bool vectors to be represented in
memory in the XBM format.

As for the problem at hand, how would you feel about adding a :stride
argument which must be a multiple of 8 and ensures that the bool
vector passed to the XBM code has the right memory layout?