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

semi-colon parsing



    Date: Mon 23 Jan 84 20:29:50-EST
    From: SAZ@MIT-OZ
    Does it strike anybody as annoying that control-E takes you to
    the end of a commented line (ie to the end of the comment) rather
    than just the end of the final s-expr on the line?  I know I sure
    do. 
    How about a control-E that takes you to the end of the final bit
    of CODE on the line, then, if another control-E is done, you can
    access the end of the comment text?  IE, if I already am at the
    following place: (cursorpos <== *)

    hsdofh ihofdh)))*	;This function just dies every time

    and I do a control-E, the cursor will move to the end of the word
    "time"...

Well, it's a half-good idea, at least.  I just put the following
into my LISPM-INIT.  I wouldn't want to change what c-E does, since
it's so fundamental (and symetric with c-A).  I made the analogy be
with m-;, m-N, and m-P, for s-;, s-N, and s-P.

You could easily change this to check your current position, and move to
the end of the line if you're already at the position determined here.

zwei:
(defcom com-end-of-expression-line
	"Go to the end of a line, or the last expression before the comments."
  (km)
  (let* ((line (bp-line (point)))
	 (comment (find-comment-start line))
	 (end (1+ (if comment
		      (string-reverse-search-not-set *blanks* line comment)
		    (1- (line-length line))))))
    (move-bp (point) line end))
  dis-bps)

zwei:
(defcom com-down-expression-line
	"Go to the end of the next line, before the comments."
  (km r)
  (com-down-real-line)
  (com-end-of-expression-line))

zwei:
(defcom com-up-expression-line
	"Go to the end of the previous line, before the comments."
  (km -r)
  (com-up-real-line)
  (com-end-of-expression-line))

(zwei:set-comtab zwei:*standard-comtab* '(#\s-/; zwei:com-end-of-expression-line
					  #\s-N zwei:com-down-expression-line
					  #\s-P zwei:com-up-expression-line))