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

Scala: Document the “Prefix Command” groups #2713

Closed
Profpatsch opened this issue Aug 21, 2015 · 15 comments
Closed

Scala: Document the “Prefix Command” groups #2713

Profpatsch opened this issue Aug 21, 2015 · 15 comments

Comments

@Profpatsch
Copy link
Contributor

i.e. give them names, like SPC m r: refactor

@justbur
Copy link
Contributor

justbur commented Aug 22, 2015

Why don't you propose a list of names for the missing prefixes?

@Profpatsch
Copy link
Contributor Author

@justbur The list is here: https://github.com/syl20bnr/spacemacs/tree/master/contrib/!lang/scala

I’m not sure how to tag prefix commands, though.

@justbur
Copy link
Contributor

justbur commented Aug 22, 2015

I think you want spacemacs/declare-prefix-for-mode

@Profpatsch
Copy link
Contributor Author

@justbur That function doesn’t exist anymore, and spacemacs/declare-prefix is the wrong one. Looking through other language files I can’t find how to declare names for prefixes.

@justbur
Copy link
Contributor

justbur commented Aug 23, 2015

What do you mean? It's defined here https://github.com/syl20bnr/spacemacs/blob/develop/spacemacs/funcs.el#L83

@Profpatsch
Copy link
Contributor Author

Oh, there was an issue with it (23533d0) and it got reactivated.

Yet, it’s used (and commented out) only in two places: https://github.com/syl20bnr/spacemacs/search?q=declare-prefix-for-mode&type=Code&utf8=%E2%9C%93
And my Emacs doesn’t know about it, which is strange.

@Profpatsch
Copy link
Contributor Author

Ah, it’s only in develop branch for now, grrr git-flow.

Still, not sure if it does what you think it does?

  "Declare a prefix PREFIX. MODE is the mode in which this prefix command should
be added. PREFIX is a string describing a key sequence. NAME is a symbol name
used as the prefix command."

@justbur
Copy link
Contributor

justbur commented Aug 23, 2015

Oh that's right. I forgot it was commented out for a while. I guess you're out of luck for the master branch right now. You could use define-prefix-command directly. I'm going to try and streamline the prefix stuff, so it doesn't require a declaration, but that will take a little work.

@Profpatsch
Copy link
Contributor Author

@justbur I’m still not sure how I can add a label when the function only takes a mode, a prefix and a name.

@justbur
Copy link
Contributor

justbur commented Aug 23, 2015

Try copying that function into your dotspacemacs/config function and then adding a declaration, so something like this

(defun spacemacs/declare-prefix-for-mode (mode prefix name)
  ;;   "Declare a prefix PREFIX. MODE is the mode in which this prefix command should
  ;; be added. PREFIX is a string describing a key sequence. NAME is a symbol name
  ;; used as the prefix command."
  (let ((command (intern (concat spacemacs/prefix-command-string name))))
    (define-prefix-command command)
    (evil-leader/set-key-for-mode mode prefix command)))
(spacemacs/declare-prefix-for-mode 'scala-mode2 "mr" "refactor")

I don't use scala or the master branch, but I don't see why that won't work.

@Profpatsch
Copy link
Contributor Author

Uhm, if I understand correctly: NAME is a symbol name used as the prefix command.

So this doesn’t work, since it wants a function name, like 'myfunc.

@justbur
Copy link
Contributor

justbur commented Aug 24, 2015

Did you try it? If you look at the function definition name is used as a string and then interned.

@Profpatsch
Copy link
Contributor Author

Hm, you are right. Silly me, coming from statically typed languages …

@justbur
Copy link
Contributor

justbur commented Aug 24, 2015

Actually, that would explain why the docstring is commented out. It might have applied to a previous version.

@syl20bnr
Copy link
Owner

Those functions should be moved to core-funcs.el, weird to have them in spacemacs layer.

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

No branches or pull requests

4 participants