Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAB: using fancy-dabbrev-expand-or-indent breaks TAB on Magit #11

Closed
vindarel opened this issue Jul 22, 2021 · 4 comments
Closed

TAB: using fancy-dabbrev-expand-or-indent breaks TAB on Magit #11

vindarel opened this issue Jul 22, 2021 · 4 comments

Comments

@vindarel
Copy link

Hello,

you say:

;; If you want TAB to indent the line like it usually does when the cursor
;; is not next to an expandable word, use 'fancy-dabbrev-expand-or-indent
;; instead of `fancy-dabbrev-expand`:
(global-set-key (kbd "<tab>") 'fancy-dabbrev-expand-or-indent)

but it breaks TAB on a Magit buffer. There, TAB is bound to magit-section-toggle.

It probably breaks other modes.

I am not sure on the best fix.

Thanks for the package! cheers

@jrosdahl
Copy link
Owner

Hi there!

It doesn't break Magit for me at least (Emacs 27, Magit v3.1.1-15-g7f666751c022). Why do you think it does? Magit defines what TAB will do in its local keymaps, e.g. magit-status-mode-map, and they have priority over the global keymap.

@vindarel
Copy link
Author

I think it does because I set the global key to expand or indent, TAB on magit doesn't work, for example to show a diff: suddenly I get

buffer is read only

:] I suppose TAB must tweaked only for fancy-dabbrev-mode. If it works for you, that's good news though^^

hey have priority over the global keymap.

I didn't know that, but it doesn't seem to be the case with me, since C-h k TAB in a magit buffer to check shows it is bound to fancy-dabbrev-expand-or-indent.

Magit 20210105. I might need to update and see.

@jrosdahl
Copy link
Owner

Ah, now I understand. Emacs apparently performs translation between TAB and <tab> in a (to me) non-obvious way, and this interacts badly with Magit. See for example the comments to this stackexchange answer. And I of course use TAB instead of <tab> in my personal bindings, contrary to what I wrote as a hint in the README.

In other words, try this instead:

(global-set-key (kbd "TAB") 'fancy-dabbrev-expand-or-indent)

@vindarel
Copy link
Author

Perfect thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants