Better HN
topnewbestaskshowjobs
Log inSign up

tabemacsthrow

5 karma · joined Dec 29, 2021 (4y ago) · 9 submissions

Submissions

comment 4y ago · link · parent

I doubt that he was already as rich as he became last year otherwise why only buy an expensive house only now?

I don't think it's necessarily a bad thing but it is an important fact that is being left out.

comment 4y ago · link · parent

Moxie presumably got rich from MobileCoin, it was reported that he recently bought an expensive house in Los Angeles.

comment 4y ago · link · parent

We've hit comment depth limit, but check out M-i (tab-to-tab-stop), other people seem to declare that that is the solution for them (and they rebind it to tab per mode).

comment 4y ago · link · parent

In the docs it says that (for some reason) C has its own separate variable c-tab-always-indent.

Also, does M-i (tab-to-tab-stop) do what you want?

comment 4y ago · link · parent

Someone above pointed out that you can remap it for prog-mode which (I think) programming modes derive from so (again, I think) if you remapped it there you would cover the programming modes. Then you could add the few other modes that aren't covered. You would define a list of the modes and loop over them in your init.el to remap them.

The other thing you might want to try is to remap the function indent-for-tab-command to insert-tab.

comment 4y ago · link · parent

I think the problem in your lobste.rs post is that you have (bind-key* "Tab" ...) instead of (bind-key* (kbd "tab") ...). I don't think your define-key solution works because I think it can be rebound by major or minor modes. I think bind-key.el is required by use-package so if you have use-package you should have it. If you don't have use-package you should install it.

I'm not at a computer with an emacs installation so I can't try it out myself. I would try binding to a regular key (e.g. "q") while debugging to try to reduce the possible problems.

I think you'll find that remapping tab everywhere like that is going to break a lot of things though (navigating fields/links, expanding sections, etc). You might want to just remap the key by explicitly listing the modes you care about.

The #emacs channel on libera (previously freenode) used to be amazing but since IRC waned it's become less good but if you're lucky and during busy times you might still find someone there that can give you a better solution.

comment 4y ago · link · parent

No, bind-key* should do this for you automatically. If you wanted to do it yourself you would make a minor-mode manually.

There's also general-override-mode-map from the "general" package.

edit: Looking at the code I don't think bind-key* creates a minor-mode but it still does what you want (and is probably the recommended way).

comment 4y ago · link · parent

You want to create a minor mode (minor mode overrides major mode key bindings) and have the minor mode enabled globally. use-package has a bind-key* function that does this I think. Something like (check the syntax, I haven't tested it)

      (require 'bind-key)
      (bind-key* (kbd "tab") (lambda () (insert "    ")))
And you should probably construct the number of spaces from the tab-width variable.