-
Notifications
You must be signed in to change notification settings - Fork 3
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
Build general dispatch function for Casual porcelains #26
Comments
@minad Thanks for the suggestion! To help clarify thinking here, I think there are two issues you raise.
With your proposal for I’m not sure it is desirable for a globally bound function (in this case the proposed That said, I think streamlining installation and configuration would be a good thing. Here’s a quick and dirty example I’ve pulled together. ;; Example installer for Casual Suite.
(defun casual-suite-install (main)
"Installer for Casual Suite with binding MAIN.
- MAIN binding specified for Casual main menu for specific mode."
(keymap-set calc-mode-map main #'casual-calc-tmenu)
(keymap-set dired-mode-map main #'casual-dired-tmenu)
(keymap-set dired-mode-map "s" #'casual-dired-sort-by-tmenu)
(keymap-set isearch-mode-map "<f2>" #'cc-isearch-menu-transient)
(keymap-set ibuffer-mode-map main #'casual-ibuffer-tmenu)
(keymap-set ibuffer-mode-map "F" #'casual-ibuffer-filter-tmenu)
(keymap-set ibuffer-mode-map "s" #'casual-ibuffer-sortby-tmenu)
(keymap-set Info-mode-map main #'casual-info-tmenu)
(keymap-global-set "M-g" #'casual-avy-tmenu)) With such a function ( (require 'casual-suite)
(casual-suite-install "C-o") The benefit of the above approach is that it requires no global-binding yet offers the same user experience. It is also optional, so that users who want finer grained control can continue to install each package individually. I’d be interested in your thoughts on this and come up with a clear set of requirements before moving forward. Thanks! |
Not necessarily. My proposal is to only add some kind of dispatching command which makes the whole suite a little easier to use. I only call
No, I don't think the setup should be streamlined. I just thought it would be neat to have an abstract single entry point
I don't really like the setup function approach for various reasons. Such setup functions don't interact nicely with lazy loading. Setup functions are less transparent and creates clutter across various maps. Also a user may not want to install all the bindings. In this sense a setup function takes control away from the user. My preference would be to have a single casual entry point which one could invoke everywhere. So my proposal is really that specific. I am just mentioning this (but I also think it wouldn't be great) - a better, cleaner alternative than a setup function would be a global minor mode which can be used to globally activate/deactivate the entry points. However I also dislike global minor modes which do nothing else than adding bindings. In summary, I consider both setup functions and keybinding-only minor modes malpractices. So I hope you are not going to add a setup function or a minor mode as the result of my proposal... ;)
Why do you feel like that? The command would be quite simple. It could look up the appropriate command in a mode/command alist. However if you don't like this idea, let's just close this and do nothing. :) |
@minad Thanks for your clarifying thoughts, particularly around setup functions and minor modes. So I suppose you’re looking for something like this behavior? (defun casual-tmenu ()
"Dispatcher for the Casual main menu of a supported mode."
(let ((current-mode major-mode))
(cond
((equal current-mode 'calc-mode) (call-interactively #'casual-calc-tmenu))
((equal current-mode 'dired-mode) (call-interactively #'casual-dired-tmenu))
((equal current-mode 'Info-mode) (call-interactively #'casual-info-tmenu))
((equal current-mode 'ibuffer-mode) (call-interactively #'casual-ibuffer-tmenu))
(t (message "Casual does not support this mode."))))) Sidestepping an implementation using an alist and other implementation details like how the Avy and I-Search menus really aren’t mode specific, if this is what you’re looking for then I’d be open to putting this in. |
Yes, like this - a simple Casual DWIM comand. I'd prefer an alist for config, but this is really just an implementation detail. As a special case, Isearch could also be handled by checking if I am unsure about |
@minad Give |
No, the implementation you've given in #26 wouldn't violate lazy loading. I only proposed this, given the possibility of lazy loading. I am generally averse to patterns which do not work lazily and I also avoid such patterns in my packages. But anyway, it is okay to not implement this, if it doesn't fit into your overall design. Thanks for consideration. |
In general, better to use |
For the suite I'd like to propose adding a general
casual-tmenu
command which could be bound to a key likeC-c c
(C-c a
,C-c t
,C-c m
, ...) to open the Casual transient menu corresponding to the currently active mode. Do you think this would make sense? I've seen you currently useC-o
everywhere, binding it in the mode maps separately.The text was updated successfully, but these errors were encountered: