coldnew / linum-relative

display relative line number in the left margin in emacs
169 stars 20 forks source link

New mode to enable linum-relative in helm. #29

Closed thierryvolpiatto closed 8 years ago

thierryvolpiatto commented 8 years ago

Hi, would you be ok to add a specific mode to allow users enabling easily linum-relative in helm ? See https://github.com/emacs-helm/helm/issues/1257https://github.com/emacs-helm/helm/issues/1257 and https://github.com/emacs-helm/helm/wiki#linum-relative

Thanks.

coldnew commented 8 years ago

Hi @thierryvolpiatto , I add this in commit cbc43a1, very thanks for your help :).

thierryvolpiatto commented 8 years ago

Yen-Chin,Lee notifications@github.com writes:

Hi @thierryvolpiatto , I add this in commit cbc43a1, very thanks for your help :).

Great! many thanks to add this.

PS: Just the autoload cookie is missing for helm-linum-relative-mode.

Thierry

coldnew commented 8 years ago

Thanks, I fixed it in ed3fccc.

zzantares commented 8 years ago

@coldnew for the ones that don't want linum-relative in helm, what we could do to disable it?

Thanks

thierryvolpiatto commented 8 years ago

César Antáres notifications@github.com writes:

@coldnew for the ones that don't want linum-relative in helm, what we could do to disable it?

You do nothing, it is not enabled by default.

Otherwise it is helm-linum-relative-mode.

Thierry

zzantares commented 8 years ago

Thanks @thierryvolpiatto , I'm new to emacs, and have linum-relative enabled like this:

(require 'linum-relative)
(global-linum-mode t)
(setq linum-relative-current-symbol "")

And is showing also on helm. Can you help me?

coldnew commented 8 years ago

@thierryvolpiatto Can you help me to verify this issue? I didn't find where caused linum-relative show on helm-mode :(

Maybe, I should look these code later..

thierryvolpiatto commented 8 years ago

Yen-Chin,Lee notifications@github.com writes:

@thierryvolpiatto Can you help me to verify this issue? I didn't find where caused linum-relative show on helm-mode :(

I think some weird setting of user. He is calling global-linum-mode which should not enable linum-relative.

To enable globally one should use linum-relative-global-mode, however when using this mode, it enable linum-relative in helm without the proper configuration helm-linum-relative-mode provide, and linum-relative showup in helm-buffer's but without effect.

One fix should be:

(define-global-minor-mode linum-relative-global-mode
    linum-relative-mode (lambda () (unless (linum-relative-in-helm-p)
                                     (linum-relative-mode 1))))

which will enable linum-relative in all buffers but helm ones. If user want to enable/disable in helm it should use helm-linum-relative-mode

Maybe, I should look these code later..

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub*

Thierry

coldnew commented 8 years ago

@ZzAntares Can you verify the latest commit if it works?

thierryvolpiatto commented 8 years ago

César Antáres notifications@github.com writes:

Thanks @thierryvolpiatto , I'm new to emacs, and have linum-relative enabled like this:

(require 'linum-relative)

Not needed as all linum-relative commands are autoloaded.

(global-linum-mode t)

This have nothing to do with linum-relative and will enable line numbering (but not relative) in all emacs buffers even helm one's. What you want is linum-relative-global-mode which will enable linum-relative in all buffers but helm one's (You have to update to very last version of linum-relative).

(setq linum-relative-current-symbol "")

By using this, I guess you defeat the purpose of linum-relative, IOW, don't do that.

Thierry

zzantares commented 8 years ago

Hi, sorry the late response, I can confirm it now works well, I no longer see the linum in helm. I want to clarify that indeed (as @thierryvolpiatto) I posted a misconfiguration but it was by error of mine, the real settings that I had were:

(require 'linum-relative)
(linum-relative-global-mode t)
(setq linum-relative-current-symbol "")

With that linum was still showing in helm, but that's no longer the case, its all good now! :+1:

coldnew commented 8 years ago

@thierryvolpiatto @ZzAntares thaks :)