tags:

views:

154

answers:

2

I am trying to set the current line number to a variable in Elisp but keep getting a void-variable error!

The code is:

(setq x what-line)

I'd also like to set the total number of lines in the buffer to a variable as well, but get the same error?!

+1  A: 
(setq x (what-line))
Mike Douglas
+2  A: 
(setq x (line-number-at-pos)
      y (line-number-at-pos (point-max)))

How to find out this kind of things? Try M-x find-function RET what-line RET to see the source code of what-line. Reading simple.el (the file in which what-line is defined) is a good way to get familiar with elementary elisp programming.

Jouni K. Seppänen