Closed mbriggs closed 10 years ago
It might be worth adding a check whether var
already exists in js3-additional-externs
so that it doesn't get added twice.
This looks cool. Bind it to whatever works for you, following the usual Emacs conventions. If you do a pull request, please add the code under /lib
then rebuild.
I added a function for this. I'm holding off on choosing a keybinding, but feel free to suggest one or submit a pull request.
@mbriggs By the way, (beginning-of-buffer)
, (previous-line)
, and (next-line)
are intended for interactive use only (not in lisp code), and (current-line)
does not appear to be a function.
yeah, current-line was a utility function from some other random library (sorry about that). Is it bad practice to use interactive functions? They seemed more descriptive then things like (goto-char 0) and (forward-line -1)
Those particular functions are labeled as "intended for interactive use only", and they give warnings to that effect when compiling.
@mbriggs any feedback on keybinding / other concerns?
nope, i use evil-mode, so all my opinions on keybinds are horribly heretical :) better its chosen by a for-real emacs user
It might be worth adding a check whether var already exists in js3-additional-externs so that it doesn't get added twice.
@thomblake Can you reconsider this? Sometimes it makes sense to declare a name as a global in the source even if I already have it in js3-additional-externs
to make the linter happy and get rid of flymake warnings.
@osener It should definitely not add vars that are already in the globals list, but it makes sense to track that separately from js3-additional-externs.
Let me know if there's a problem with C-c C-g as a key binding
This function has been sitting my my "random defuns" file for awhile, figured it may be a nice addition to js3 mode (if you like it, just tell me where to put it and what to bind it to and I'll open a pull request)
What this will do is add the word-at-point to the list of /* global */ at the top of the file. If that directive is not there, it will add it. If the directive spans multiple lines, it will add it to the last line.
Still not that great at elisp, so if I am doing anything dumb, would be glad to hear that too :)