next-line is very slow, and this is creating problems. I'll give some background then explain why.
By default, linum.el treats a wrapped line as a single line, and it takes into account hidden lines when numbering. I need it to number visual lines only - i.e. it should ignore hidden lines, and count wrapped lines as multiple lines.
For example, this is how it works by default:
1 This is a line. 2 This is a long line which has been auto-wrapped >by emacs. 3 This is another line. This is the behaviour I want:
1 This is a line. 2 This is a long line which has been auto-wrapped 3>by emacs. 4 This is another line. I have this behaviour working, but it's very slow. By default, linum.el uses forward-line to number each line. This is the code that actually moves down by one line and increments the line counter:
(let ((inhibit-point-motion-hooks t)) (forward-line)) (setq line (1+ line)) I modified it to use next-line:
(let ((inhibit-point-motion-hooks t)) ;; (forward-line) (next-line)) (setq line (1+ line)) This works, but next-line is very slow in comparison to forward-line. Line numbers must be updated frequently so this slows down Emacs considerably.
I don't actually need to number every line. I am happy to use forward-line and number only the beginning of lines, as so:
1 This is a line. 2 This is a long line which has been auto-wrapped >by emacs. 4 This is another line. But if I want to do this, I need to be able to check how many screen lines I moved when I called forward-line.
Does anyone have any ideas on how to solve this?