unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Alignment and images
@ 2016-06-28 13:32 Lars Magne Ingebrigtsen
  2016-06-28 16:24 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-06-28 13:32 UTC (permalink / raw)
  To: emacs-devel

I wanted to implement a file browser for image files, and I wanted to
display them in a grid.

But images have different widths, so I need some magic to line them up
like this:

[ ] [  ] [ ]
[ ] [ ]  [ ]
[ ] [ ]  [ ]

I want the user to be able to use normal navigation commands to traverse
the grid, so no special commands.

My first attempt was a loop like this:

      (unless (bolp)
        (insert (propertize " " 'display
                            `(space :align-to (,(* (mod i width) pixels)))
                            'intangible t)))
      (insert-image (create-image file 'imagemagick nil
                                  :max-width pixels
                                  :max-height pixels)
                    " ")

This gives me a nice grid visually, but when moving around in the grid,
every other <right> lands me on the align-to space thing, which doesn't
feel very nice.  I thought that the 'intangible should make that effect
disappear, but it didn't.  Is that a bug?  Or am I doing something
wrong?

The second attempt was to add both the image and the align-to to the
same display property.  Kinda like this:

(insert (propertize " " 'display
                        `(,(create-image file 'imagemagick nil
                                  :max-width pixels
                                  :max-height pixels)
                          :align-to (,(* (mod i width) pixels)))))

That didn't work at all, but I didn't really expect it to.  :-)

Does anybody have any thoughts on this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-09-01 18:10 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28 13:32 Alignment and images Lars Magne Ingebrigtsen
2016-06-28 16:24 ` Eli Zaretskii
2016-06-28 16:28   ` Lars Magne Ingebrigtsen
2016-06-28 16:39     ` Eli Zaretskii
2016-06-28 16:50       ` Lars Magne Ingebrigtsen
2016-06-28 17:43         ` Eli Zaretskii
2016-06-28 17:51           ` Lars Magne Ingebrigtsen
2016-06-28 18:12             ` Eli Zaretskii
2016-06-28 18:17               ` Lars Magne Ingebrigtsen
2016-06-28 18:23                 ` Eli Zaretskii
2016-06-30 15:14             ` Ted Zlatanov
2016-06-30 15:40               ` Lars Magne Ingebrigtsen
2016-09-01 18:10             ` Alp Aker
2016-06-28 17:44 ` Eli Zaretskii
2016-06-28 17:53   ` Lars Magne Ingebrigtsen
2016-06-28 21:17 ` Glenn Morris
2016-06-28 22:00   ` Lars Magne Ingebrigtsen
2016-08-30 13:01     ` Mathias Dahl
2016-09-01 15:43       ` Lars Ingebrigtsen
2016-09-01 16:18         ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).