Thank you for Treemacs, it's really nice!
I use Treemacs to open and navigate between files and do not see much value in having single clicks set focus and instead would like them to open files for editing (or expand/collapse directories). This is similar to the single-click mode in Windows Explorer. I think that "single click to focus" would possibly be useful if there was an option to select multiple files and act on them together but this does not seem like the case at the moment. So, for the rare occasions when I want to do something else on a file or directory than opening it a context menu bound to mouse-3 or the like would be best and just have mouse-1 open the file.
Making Treemacs behave this way does not look straightforward. Any ideas on how to accomplish the above or would it require more serious hacking?
The current setup is the result of quite a few discussions and iterations. Basically the goal is to emulate the behaviour of gui apps like eclipse. For the matter of context menus there's https://github.com/Alexander-Miller/treemacs/issues/221 - it is a goal, but I'm not there yet.
The current behaviour will remain the default, keybinds are not an area where you can please everyone (I tried and it was more trouble than it's worth). You're right that changing it to the behaviour you want is not quite straightforward, but it won't require serious hacking either. You just need to combine the code of the existing single- and double-click functions. I'll go about putting this together in the next couple of days.
@Alexander-Miller Ah yes, rolling my own treemacs-leftclick-action definitely looks doable, but are you saying you will do it?
Btw, I think that treemacs-LEFTclick-action is confusing naming. I use my mouse with the left hand and have it placed on the left side of the keyboard so mouse-1 for me is actually the right button. I would suggest treemacs-singleclick-action (which is also more consistent with treemacs-doubleclick-action).
The names will be consistent when a treemacs-rightclick-action is eventually introduced. That should make clear which is which.
Is it really that different when you're left-handed? I would have assumed you're still familiar with the general terminology - that a left click selects and that a right click opens a contextual menu.
At any rate I've now added a command that manages single-click node expansion:
(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action)
Just tried it, works the way I want, thanks a bunch!
Is it really that different when you're left-handed? I would have assumed you're still familiar with the general terminology - that a left click selects and that a right click opens a contextual menu.
Indeed, I am familiar with the terminology but I guess I just find it unnecessarily confusing and Emacs itself doesn't use it either (although admittedly "mouse-1" and "mouse-3" isn't very descriptive). And for the record I am actually not even left-handed, I just choose to use the mouse with my left hand because I find very balancing and a great way to improve my left arms motor skills. To add to the confusion a colleague of mine also places his mouse on the left but doesn't remap the buttons.
FWIW, sometimes I see the terms "primary" and "secondary" mouse buttons which may or may not be useful in context of Treemacs.
Most helpful comment
The names will be consistent when a
treemacs-rightclick-actionis eventually introduced. That should make clear which is which.Is it really that different when you're left-handed? I would have assumed you're still familiar with the general terminology - that a left click selects and that a right click opens a contextual menu.
At any rate I've now added a command that manages single-click node expansion: