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

NextPrevUpTopContentsIndex

6.3.16.1 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)
          (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)))

LispWorks Editor User Guide (Windows version) - 3 May 2011

NextPrevUpTopContentsIndex