1

I use the linum-relative package to get line numbers relative to the cursor in the margin. The reason this is useful to me is I drive emacs with speech recognition, and the speech recognizer has a specialized more accurate mode for numbers than it does for general speech, so I try to navigate using commands based on numbers where possible. So with relative line numbers I can say "up 5" or "down 29" and know exactly where I will end up. Relative numbers are better than absolute because they are smaller and easier to say; if I'm in the middle of a big file and I want to go down 3 lines I don't want to say "goto line three thousand four hundred and twenty six." I just want to say, "down 3".

Now I'm trying to give helm a spin and I noticed that when I use helm-M-x the relative line numbers don't work. They appear, but always consider the first line of the buffer to be 0 regardless of where the cursor is. That is until you scroll down past the end of the window, then they move again but stay still after that until you go outside the window boundary again.

Is there anyway to get relative line numbers working with helm-M-x? I'm guessing that helm is listening directly to input events to drive the menu rather than really moving the cursor, but I haven't dug into the code.

  • 1
    In helm, your cursor are actually staying at the MiniBuffer mainly, not the helm completion buffer, that is the reason why it doesn't work as your expect. You can update position of the point in helm completion buffer from some hook such as helm-move-selection-after-hook, but the performance of linum-mode/linum-relative in helm maybe very bad since the content of helm completion buffer changes dramatically, I think your request looks reasonable and it should be better to implement from helm. – xuchunyang Oct 7 '15 at 17:34
  • @xuchunyang I already have linum recalculating on a slight delay to keep it performant for large files, so that could maybe be made to work. Do you know how to get the position where I would tell temporarily move point before telling linum to update? I'm trawling through helm.el right now but it's not obvious. – Joseph Garvin Oct 7 '15 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.