LispWorks Editor User Guide > 6 Advanced Features > 6.3 Programming the editor > 6.3.16 Examples

NextPrevUpTopContentsIndex Example 1

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)
             (if (editor:point> cpoint svpoint)
             (unless (editor:next-line-command nil)
             (incf count))
          (editor:move-point cpoint svpoint)
          (editor:message "Current Line Number: ~S " count)))

LispWorks Editor User Guide (Windows version) - 22 Dec 2009