dockerfile-mode icon indicating copy to clipboard operation
dockerfile-mode copied to clipboard

Feature suggestion: convenience access to silex/docker functions from keymap

Open pataquets opened this issue 3 years ago • 2 comments

I'm using heavily dockerfile-mode. I've found it awesomely useful! Thanks for sharing. I use it under Spacemacs's docker layer, which neatly merges dockerfile-mode with silex's docker package.

Based on daily usage, I have some suggestions to save a few keystrokes:

  • Add a key bind (eg. C-d) to quickly access docker main command transient.
  • Adding key binding for some docker-* commands, at least those closely related to building (eg docker-containers and docker-images), useful for tidyng up after long working sessions.
  • Should docker package had any keymap of its own, nesting it in our keymap would be also great. Adding such a keymap on docker package looks like not a big deal, I guess.

It might sound overlapping/mixing packages, but having docker-* commands handy right in the Dockerfile sounds quite reasonable to me. Just asking for feedback, although I might take a stab at it, once I up a little more my elisp-fu. :grin:

pataquets avatar Mar 05 '22 18:03 pataquets

C-d is already bound to delete-key, but C-c C-d could work

If you look where docker-file-mode-map, you can see the existing keybinding and add more.

You could consider adding dockerfile-mode-hook so that instead of baking it into the mode, you could hook into it in your .emacs file to add whatever you like. I'm a little surprised I didn't add it when I wrote this. (e.g. for another mode, this is how the hook is defined -> https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/m4-mode.el#L93)

As to nesting keymaps, I've never done it myself, nor do I know how atm.

PRs welcome for any/all of the above.

drewcsillag avatar Mar 05 '22 19:03 drewcsillag

Thanks for the quick feedback, @drewcsillag . Indeed, I was meaning C-c C-d for the binding. Sorry for not being clear. Thank you very much for the pointers. I've mostly solved it under Spacemacs, but it's nice to see you're open to PRs. EDIT: I acknowledge that the natural place to have it implemented is in this package, instead of Spacemacs. If I find some spare time, I'd like to upstream my solution to this package.

pataquets avatar Mar 05 '22 20:03 pataquets