all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* puzzle.el.
@ 2004-07-17 11:55 Matt Hodges
  2004-07-19  9:10 ` puzzle.el Kim F. Storm
  2004-07-19 17:40 ` puzzle.el Kevin Rodgers
  0 siblings, 2 replies; 13+ messages in thread
From: Matt Hodges @ 2004-07-17 11:55 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 2798 bytes --]

After playing around with insert-sliced-image, I wrote a slide puzzle
program (see attached).

If the number of image slices is too large, Emacs can crash in the
redisplay code. Evaluating the following:

    (let ((puzzle-max-rows-columns 25)
          (puzzle-rows 25)
          (puzzle-columns 25))
      (fset 'puzzle-randomize (lambda ()))
      (puzzle))

leads to a segmentation fault, and the following backtrace:

    #0  0x080aaa21 in display_line (it=0xbfffe490) at xdisp.c:14527
    #1  0x080a5e48 in try_window (window=141168948, pos={charpos = -1073748848, bytepos = 1}) at xdisp.c:12219
    #2  0x080a56c4 in redisplay_window (window=141168948, just_this_one_p=0) at xdisp.c:11861
    #3  0x080a1833 in redisplay_window_0 (window=2761) at xdisp.c:10587
    #4  0x08189a54 in internal_condition_case_1 (bfun=0x80a1800 <redisplay_window_0>, arg=141168948, handlers=138528965, hfun=0x80a17e0 <redisplay_window_error>) at eval.c:1376
    #5  0x080a17de in redisplay_windows (window=141168948) at xdisp.c:10566
    #6  0x080a0949 in redisplay_internal (preserve_echo_area=0) at xdisp.c:10151
    #7  0x0809f802 in redisplay () at xdisp.c:9385
    #8  0x08129a65 in read_char (commandflag=1, nmaps=2, maps=0xbffff3ec, prev_event=138502161, used_mouse_menu=0xbffff428) at keyboard.c:2518
    #9  0x08130553 in read_key_sequence (keybuf=0xbffff550, bufsize=30, prompt=138502161, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:8810
    #10 0x08126593 in command_loop_1 () at keyboard.c:1512
    #11 0x0818994e in internal_condition_case (bfun=0x81263d0 <command_loop_1>, handlers=138563089, hfun=0x8125e90 <cmd_error>) at eval.c:1335
    #12 0x081261fe in command_loop_2 () at keyboard.c:1293
    #13 0x0818948b in internal_catch (tag=2761, func=0x81261d0 <command_loop_2>, arg=138502161) at eval.c:1096
    #14 0x081261a3 in command_loop () at keyboard.c:1272
    #15 0x08125c14 in recursive_edit_1 () at keyboard.c:978
    #16 0x08125d51 in Frecursive_edit () at keyboard.c:1039
    #17 0x08124410 in main (argc=5, argv=0xbffffc04) at emacs.c:1687

In the code, I create a blank image with the following:

    (create-image "" 'xpm nil :width (/ width puzzle-columns)
                              :height (/ height puzzle-rows))

which does what I want, but complains with:

    Cannot find image file `'

which seems fair enough. Is there a better way to do this?

On an unrelated note, I find the doc string for random to be
confusing:

    With positive integer argument n, return random number in interval
    [0,n).

Does this really mean between 0 and (n - 1)? The info documentation is
clearer:

    If LIMIT is a positive integer, the value is chosen to be
    nonnegative and less than LIMIT.

Thanks for any feedback on these issues.

Matt


[-- Attachment #2: slide puzzle. --]
[-- Type: application/emacs-lisp, Size: 12823 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

end of thread, other threads:[~2004-07-22 22:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-17 11:55 puzzle.el Matt Hodges
2004-07-19  9:10 ` puzzle.el Kim F. Storm
2004-07-19  9:35   ` puzzle.el Matt Hodges
2004-07-19 18:44   ` puzzle.el Richard Stallman
2004-07-19 19:39     ` puzzle.el Miles Bader
2004-07-21 21:33       ` puzzle.el Kim F. Storm
2004-07-21 21:31     ` puzzle.el Kim F. Storm
2004-07-22  1:57       ` puzzle.el Miles Bader
2004-07-22  7:33         ` puzzle.el Miles Bader
2004-07-22 21:38       ` puzzle.el Richard Stallman
2004-07-22 22:14         ` puzzle.el David Kastrup
2004-07-19 17:40 ` puzzle.el Kevin Rodgers
2004-07-19 19:04   ` puzzle.el Matt Hodges

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.