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

NextPrevUpTopContentsIndex Example 2

This example creates a new editor command called Goto Line which moves the current point to the specified line number.

(editor:defcommand "Goto Line" (p)
   "Moves the current point to a specified line number.
    The number can either be supplied via the prefix
    argument, or, if this is nil, it is prompted for."
   "Moves the current point to a specified line number."
   (let ((line-number  
          (or p (editor:prompt-for-integer  
                 :prompt "Line number: "
                 :help "Type in the number of the line to
                  go to"))))
        (editor:beginning-of-buffer-command nil)
        (editor:next-line-command line-number)))

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