[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fun with *zwei-comtab*

In article <900625122321.891820@DOCKMASTER.NCSC.MIL> Arbaugh@DOCKMASTER.NCSC.MIL writes:
>I'm using a Sun with the UX board and like it a great deal.  There is
>one nagging problem, however.  In zmacs, the line feed key acts as the
>line key.  This key is to small- so I normally end up hitting return and
>then tab.  In my attempts to reduce keystrokes, I've tried the
>Set package zwei ;; Note I'll use a $ instead of a sharp sign- mulitcs
>doesn't like sharps (set-comtab *zmacs-comtab* '($\line com-insert-crs))
>(set-comtab *zmacs-comtab* '($\return com-indent-new-line)) ;; This
>basically should switch the two keys- or am I doing something silly?  ;;
>When I move to zmacs and hit $\return- I end up in the debugger with ;;
>an error I can't remember at the moment.  ;; If I hit $\line, no
>problem.  It works like it should, i.e.  $\return.
>Any ideas?  And no- I don't want to buy a symbolics keyboard for the
>                   Many thanks, Bill


The problem seems to be that ZMACS handles RETURN in a special way.

But, don't despair.  Following is a hack that I wrote for a friend who
wanted the same functionality.  RETURN-TAB-MODE is minor mode in which the
(standard) functionality of RETURN and LINEFEED are exchanged.

(I originally wrote it in ~7.0, but it still seems to work in 8.0)

Hope this helps

;;; -*- Syntax: Zetalisp; Mode: LISP; Package: ZWEI; Base: 8 -*-
	  "Return-and-Tab mode.
Reverses the normal behavior of <RETURN> and <LINE>." ()
			      #\Line COM-INSERT-CRS)))

;;; Hacked version of COM-INDENT-NEW-LINE to make it compatible
	"Starts a new line, indenting the new line as appropriate for the major mode.
For modes in which comments have explicit end strings, you can use this command
before the end of the comment and the comment end does not move to the new line." ()
  (WHEN (FIND-COMMENT-START (BP-LINE (POINT)))	;only when there is a comment on this line
    (LET ((CANDIDATE (STRING-TRIM '(#\SPACE #\TAB)	;survive some random spaces
      (IF (AND (> (STRING-LENGTH *COMMENT-END*) 0)	;only when nontrivial comment ender
	       (STRING-EQUAL CANDIDATE *COMMENT-END*))	;does remainder of line match?
	  (MOVE-POINT (END-LINE (POINT))))))		;so fool it by moving point to end
	*CURRENT-COMMAND-TYPE*)			;Don't be fooled
	     (LET ((*NUMERIC-ARG-P*) (*NUMERIC-ARG* 1))
	   (KEY-EXECUTE #\TAB)))))