[net.emacs] Bug in Unipress Emacs

thomas%UTAH-GR@utah-cs@sri-unix.UUCP (07/27/83)

From:  thomas%UTAH-GR@utah-cs (Spencer W. Thomas)

I just got core dumped out of my emacs doing something that used to work.
I have two-line minibuffer, and I had typed "a^O^Nb^O^N".  At the second ^N,
it dumped me out (segmentation fault).  Well, sdb shows it in setpos at
line 220 (p = DesiredScreen[row]) -> hash = 0;
with row = 71.  Now it seems to me that this is an improbable value, 
since I'm using a 24 line screen (but what do I know about the guts of
the display code?).  Anybody out there (JG?) know why it bombed me out
like this, and what I can do to fix it?

When I get a couple hours, I could probably run a diff between the old
and new (the old did this just fine) and maybe track it down, but if
somebody more familiar with the code can tell me what's wrong, I would
surely be grateful.

=Spencer

thomas%UTAH-GR@utah-cs@sri-unix.UUCP (07/27/83)

From:  thomas%UTAH-GR@utah-cs (Spencer W. Thomas)

A little more information on the bug I just reported:  It seems to be
associated with the new optimizations.  It looks as if DoDsp doesn't
expect you to be moving the cursor off the bottom of the screen.  This
is my guess, anyway.  All of the Cant* variables seem to be 0.

=Spencer

koomen@rochester.UUCP (Hans Koomen) (07/30/83)

From: Hans.Koomen
Yeah, I've often wondered about that wrap feature myself.
Here's my solution:

****************
(defun					; "HaKo 05-12-83"
    (window-width 80)	; should be built-in a la (window-height) !@#$%!

    (line-to-bottom-of-window	curpos prevpos nextpos
				lines2skip chars2skip physlines
	(setq chars2skip (window-width))
	(setq lines2skip (window-height))
	(setq curpos (dot))
	(line-to-top-of-window)
	(beginning-of-line)
	(setq nextpos (dot))
	(setq physlines  (+ 1 (/ (- curpos nextpos) chars2skip)))
	(setq lines2skip (- lines2skip physlines))
	(while (> lines2skip 0)
	       (previous-line)
	       (beginning-of-line)
	       (setq prevpos nextpos)
	       (setq nextpos (dot))
	       (setq physlines  (+ 1 (/ (- prevpos nextpos) chars2skip)))
	       (setq lines2skip (- lines2skip physlines)))
	(line-to-top-of-window)
	(goto-character curpos)
	(if (< lines2skip 0)
	    (scroll-one-line-up))))

****************

I use this function to force the last line in the shell buffer to stay
at the bottom of the window (simulating usual scrolling). Just in case
you wonder how: (process.ml)

****************
(defun
    (pr-newline
	(end-of-line)
	(if (eobp)
	    (newline)
	    (progn com
		   (beginning-of-line)
		   (if (looking-at shell-prompt) (region-around-match 0)
		       (looking-at lisp-prompt) (region-around-match 0))
		   (set-mark)
		   (end-of-line)
		   (forward-character)
		   (setq com (region-to-string))
		   (end-of-file)
		   (set-mark)
		   (insert-string com)
	    )
	)
	(line-to-bottom-of-window)	; "HaKo 05-12-83"
	(setq last-line (region-to-string))
	(region-to-process (active-process))
	(set-mark)
    )

    (shell
	(pop-to-buffer "shell")
	(setq needs-checkpointing 0)
	(if (< (process-status "shell") 0)
	    (start-filtered-process "csh -i" "shell" "more-shell-stuff"))
;	    (start-process "csh -i" "shell"))	; "HaKo 05-12-83"
	(local-bind-to-key "pr-newline" '^m')
	(local-bind-to-key "send-eot" '')
	(local-bind-to-key "send-int-signal" '')
	(local-bind-to-key "send-quit-signal" '^\')
	(local-bind-to-key "grab-last-line" "\e=")
;	(local-bind-to-key "stop-shell" "\e\^Z")
	(end-of-file)
	(novalue)
    )

    (more-shell-stuff				; "HaKo 05-12-83"
	(if (= (current-buffer-name) "shell")
	    (progn (end-of-file)
		   (insert-string (process-output))
		   (set-mark)
		   (line-to-bottom-of-window)
		   (sit-for 0))
	    (save-excursion 
		(temp-use-buffer "shell")
	    	(end-of-file)
	    	(insert-string (process-output))
	    	(set-mark)))))

****************


I know, it's a crock. Enjoy, anyway!

-- Hans  (Koomen@Rochester or ..!seismo!rochester!koomen)