-
Notifications
You must be signed in to change notification settings - Fork 112
[Fix #305] Don't call lookup-alias for keywords #311
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
Conversation
@@ -2199,6 +2199,12 @@ the alias in the project." | |||
(-when-let (long (cljr--aget cljr-magic-require-namespaces short)) | |||
(list short (list long)))))))) | |||
|
|||
(defun cljr--in-keyword-p () | |||
(cljr--is-keyword? | |||
(buffer-substring-no-properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument here is just cider-symbol-at-point
.
Since we already have cljr--is-keyword?
perhaps we should make s
optional and act on the symbol at point otherwise? I also think we should rename cljr--is-keyword
ro just cljr--keyword?
so it makes what we have everywhere else.
@@ -2199,6 +2200,12 @@ the alias in the project." | |||
(-when-let (long (cljr--aget cljr-magic-require-namespaces short)) | |||
(list short (list long)))))))) | |||
|
|||
(defun cljr--in-sans-ns-keyword-p () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike this name. I think a better name would be cljr--in-keyword-sans-alias?
. We're using ?
for predicates everywhere else, so we should be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not married to this name. cljr--in-keyword-sans-alias?
it is then.
apparently it is consistent with the cider naming (already ;) ):
(not (cider-in-comment-p))
(not (cider-in-string-p))
not married to this either tho. happy to rename if you insist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should probably have some docstring.
As for predicates - you should really adopt the Emacs conventions as you're writing Emacs Lisp, not Clojure. @magnars is one of the few Elisp hackers who uses ?
, but in dash.el
even he added the traditional names as aliases. I profoundly dislike violating established conventions for no good reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I prefer the -p
style preds. But really don't want to go down the rabbit hole of renaming all our foo?
style preds in this PR.
- will create a separate PR replacing all our own
?
predicates with-p
ones - keep this fn
-p
style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me. I was merely pointing out a related observation.
On 25 March 2016 at 20:49, Benedek Fazekas notifications@github.com wrote:
In clj-refactor.el
#311 (comment)
:@@ -2199,6 +2200,12 @@ the alias in the project."
(-when-let (long (cljr--aget cljr-magic-require-namespaces short))
(list short (list long))))))))+(defun cljr--in-sans-ns-keyword-p ()
ok I rather prefer the -p style preds. But really don't want to go down
the rabbit hole of renaming all our foo? style preds in this PR.
- will create a separate PR replacing all our own ? predicates with -p
ones- keep this fn -p style
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/clojure-emacs/clj-refactor.el/pull/311/files/5f2adca5f6175d34508f83ea951cb48356fbb4c0#r57476657
Best Regards,
Bozhidar Batsov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for doing that @bbatsov :)
6da1995
to
02c7a97
Compare
As discussed in #311 `-p` style predicates are more consistent with the rest of clojure-emacs projects and the language in general. cljr predicates renamed - cljr--use-multiple-cursors? - cljr--comment-line? - cljr--whitespace? - cljr--inside-prefixed-libspec-vector? - cljr--even? - cljr--op-supported? - cljr--cljs-file? - cljr--cljc-file? - cljr--clj-file? - cljr--dash-in-file-name? - cljr--already-declared? - cljr--existing-group-of-defs? - cljr--point-in-reader-conditional? - cljr--point-in-reader-conditional-branch? - cljr--clj-context? - cljr--in-namespace-declaration? - cljr--excluded-from-project-clean? - cljr--empty-buffer? - cljr--end-of-buffer? - cljr--qualified-symbol? - cljr--is-keyword? - cljr--symbol? - cljr--keyword-lookup? - cljr--defn? - cljr--call-site? - cljr--no-changes-to-parameter-order? - cljr--apply-call-site? - cljr--partial-call-site? - cljr--ignorable-occurrence? predicates renamed from dependencies - -contains? (dash) - -every? (dash) - s-contains? (s) - s-starts-with? (s) - s-ends-with? (s) - s-equals (s) - s-matches? (s) predicates not renamed as there is no suitable alias - s-blank? (s) - s-present? (s) - s-uppercase? (s)
This looks good now! 👍 |
Don't call lookup-alias for non namespaced keywords at all when slash is typed. However trigger lookup alias with the leading :: stripped off the prefix if the keyword is namespaced. - fix bug in `cljr--keyword?` so it recognises aliased, `::` keywords
As discussed in #311 `-p` style predicates are more consistent with the rest of clojure-emacs projects and the language in general. cljr predicates renamed - cljr--use-multiple-cursors? - cljr--comment-line? - cljr--whitespace? - cljr--inside-prefixed-libspec-vector? - cljr--even? - cljr--op-supported? - cljr--cljs-file? - cljr--cljc-file? - cljr--clj-file? - cljr--dash-in-file-name? - cljr--already-declared? - cljr--existing-group-of-defs? - cljr--point-in-reader-conditional? - cljr--point-in-reader-conditional-branch? - cljr--clj-context? - cljr--in-namespace-declaration? - cljr--excluded-from-project-clean? - cljr--empty-buffer? - cljr--end-of-buffer? - cljr--qualified-symbol? - cljr--is-keyword? - cljr--symbol? - cljr--keyword-lookup? - cljr--defn? - cljr--call-site? - cljr--no-changes-to-parameter-order? - cljr--apply-call-site? - cljr--partial-call-site? - cljr--ignorable-occurrence? predicates renamed from dependencies - -contains? (dash) - -every? (dash) - s-contains? (s) - s-starts-with? (s) - s-ends-with? (s) - s-equals (s) - s-matches? (s) predicates with extra hypen - cljr--toplevel-p - cljr--whitespace-p - cljr--defn-p - cljr--asts-p predicates not renamed as there is no suitable alias - s-blank? (s) - s-present? (s) - s-uppercase? (s)
As discussed in #311 `-p` style predicates are more consistent with the rest of clojure-emacs projects and the language in general. cljr predicates renamed - cljr--use-multiple-cursors? - cljr--comment-line? - cljr--whitespace? - cljr--inside-prefixed-libspec-vector? - cljr--even? - cljr--op-supported? - cljr--cljs-file? - cljr--cljc-file? - cljr--clj-file? - cljr--dash-in-file-name? - cljr--already-declared? - cljr--existing-group-of-defs? - cljr--point-in-reader-conditional? - cljr--point-in-reader-conditional-branch? - cljr--clj-context? - cljr--in-namespace-declaration? - cljr--excluded-from-project-clean? - cljr--empty-buffer? - cljr--end-of-buffer? - cljr--qualified-symbol? - cljr--is-keyword? - cljr--symbol? - cljr--keyword-lookup? - cljr--defn? - cljr--call-site? - cljr--no-changes-to-parameter-order? - cljr--apply-call-site? - cljr--partial-call-site? - cljr--ignorable-occurrence? predicates renamed from dependencies - -contains? (dash) - -every? (dash) - s-contains? (s) - s-starts-with? (s) - s-ends-with? (s) - s-equals (s) - s-matches? (s) predicates with extra hypen - cljr--toplevel-p - cljr--whitespace-p - cljr--defn-p - cljr--asts-p predicates not renamed as there is no suitable alias - s-blank? (s) - s-present? (s) - s-uppercase? (s)
No description provided.