@@ -1087,19 +1087,22 @@ If CLJS? is T we insert in the cljs part of the ns declaration."
1087
1087
1088
1088
(defun cljr--cljs-file-p (&optional buf )
1089
1089
" Is BUF, or the current buffer, visiting a cljs file?"
1090
- (string-equal (file-name-extension (buffer-file-name (or buf (current-buffer ))))
1091
- " cljs" ))
1090
+ (when-let ((bfn (buffer-file-name (or buf (current-buffer )))))
1091
+ (string-equal (file-name-extension bfn)
1092
+ " cljs" )))
1092
1093
1093
1094
(defun cljr--cljc-file-p (&optional buf )
1094
1095
" Is BUF, or the current buffer, visiting a cljc file?"
1095
- (string-equal (file-name-extension (buffer-file-name (or buf (current-buffer ))))
1096
- " cljc" ))
1096
+ (when-let ((bfn (buffer-file-name (or buf (current-buffer )))))
1097
+ (string-equal (file-name-extension bfn)
1098
+ " cljc" )))
1097
1099
1098
1100
(defun cljr--clj-file-p (&optional buf )
1099
1101
" Is BUF, or the current buffer, visiting a clj file?"
1100
1102
(or (eq major-mode 'clojure-mode )
1101
- (string-equal (file-name-extension (buffer-file-name (or buf (current-buffer ))))
1102
- " clj" )))
1103
+ (when-let ((bfn (buffer-file-name (or buf (current-buffer )))))
1104
+ (string-equal (file-name-extension bfn)
1105
+ " clj" ))))
1103
1106
1104
1107
(defun cljr--add-test-declarations ()
1105
1108
(save-excursion
@@ -2042,7 +2045,10 @@ is not set to `:prompt'."
2042
2045
(gethash :cljs aliases))))
2043
2046
2044
2047
(defun cljr--js-alias-p (alias )
2045
- (and (cljr--cljs-file-p)
2048
+ (and (member " cljs" (condition-case nil
2049
+ (cljr--language-context-at-point) ; ; it shouldn't fail, but we can leave it like this until consideredfully time-proven.
2050
+ (error (when (cljr--cljs-file-p)
2051
+ '(" cljs" )))))
2046
2052
(string-equal " js" alias)))
2047
2053
2048
2054
(defun cljr--ns-alias-at-point ()
0 commit comments