[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 -*-
(defminor COM-RETURN-TAB-MODE RETURN-TAB-MODE "ReturnTab" 6
Reverses the normal behavior of <RETURN> and <LINE>." ()
(set-comtab *MODE-COMTAB* '(#\Return COM-INDENT-NEW-LINE-IN-RETURN-TAB-MODE
;;; Hacked version of COM-INDENT-NEW-LINE to make it compatible
;;; with RETURN-TAB-MODE.
"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
(SUBSTRING (BP-LINE (POINT)) (BP-INDEX (POINT))))))
(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
(MOVE-POINT (DELETE-BACKWARD-OVER *BLANKS* (POINT)))
(LET ((*LAST-COMMAND-TYPE* 'INDENT-NEW-LINE)
*CURRENT-COMMAND-TYPE*) ;Don't be fooled
(MAX (IF *INDENT-NEW-LINE-NEW-LINE-FUNCTION*
;;;NLC24MAR88 (KEY-EXECUTE #\RETURN *NUMERIC-ARG-P* *NUMERIC-ARG*)
(KEY-EXECUTE #\Line *NUMERIC-ARG-P* *NUMERIC-ARG*))
(LET ((*NUMERIC-ARG-P*) (*NUMERIC-ARG* 1))