The following simple example creates a new editor command called Current
Line
.
(editor:defcommand "Current Line" (p)
"Computes the line number of the current point and
prints it in the Echo Area"
"Prints the line number of the current point"
(let* ((cpoint (editor:current-point))
(svpoint (editor:copy-point cpoint))
(count 0))
(editor:beginning-of-buffer-command nil)
(loop
(if (editor:point> cpoint svpoint)
(return))
(unless (editor:next-line-command nil)
(return))
(incf count))
(editor:move-point cpoint svpoint)
(editor:message "Current Line Number: ~S " count)))