namespace caching breaks updating namespace name
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- emacs-lisp
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu bằng cách đọc clojure-update-ns và clojure-find-ns, đặc biệt là nhánh cached và dữ liệu khớp được replace-match sử dụng. Tái hiện lỗi khi clojure-cache-ns được bật trong lúc cập nhật một namespace. Được coi là hoàn tất khi việc cập nhật namespace thành công và namespace được lưu trong bộ nhớ đệm được làm mới nhất quán.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
(defun clojure-update-ns ()
"Update the namespace of the current buffer.
Useful if a file has been renamed."
(interactive)
(let ((nsname (funcall clojure-expected-ns-function)))
(when nsname
(save-excursion
(save-match-data
(if (clojure-find-ns)
(progn
(replace-match nsname nil nil nil 4)
(message "ns form updated to `%s'" nsname)
(setq clojure-cached-ns nsname))
(error "Namespace not found")))))))
This is the helpful function to update the namespace and reset the cache for namespaces. Unfortunately it relies on the replace match generated in clojure-find-ns. The problem is that this match does not happen if namespace caching is enbled.
(defun clojure-find-ns ()
"Return the namespace of the current Clojure buffer.
Return the namespace closest to point and above it. If there are
no namespaces above point, return the first one in the buffer.
The results will be cac(match-string-no-properties 4)hed if `clojure-cache-ns' is set to t."
(if (and clojure-cache-ns clojure-cached-ns)
clojure-cached-ns
(let ((ns (save-excursion
(save-restriction
(widen)
;; Move to top-level to avoid searching from inside ns
(ignore-errors (while t (up-list nil t t)))
;; The closest ns form above point.
(when (or (re-search-backward clojure-namespace-name-regex nil t)
;; Or any form at all.
(and (goto-char (point-min))
(re-search-forward clojure-namespace-name-regex nil t)))
(match-string-no-properties 4))))))
(setq clojure-cached-ns ns)
ns)))
Note the top level bails if the cache is already set and therefore does not call (match-string-no-properties 4) yielding an error.
This leaves an unfortunate catch-22: if you use the cache, you need to update it with update-ns. If you update the ns with the cache on, it doesn't create the match to update the cache.
- Ngôn ngữ chính
- Emacs Lisp
- Star
- 1k
- Fork
- 249
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của clojure-emacs/clojure-mode
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
clojure-emacs/clojure-mode#699 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
clojure-emacs/clojure-mode#660 · 5 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
clojure-emacs/clojure-mode#647 · 1 bình luận ·
-
bug help wanted indentation
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
clojure-emacs/clojure-mode#620 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
clojure-emacs/clojure-mode#613 · 1 reaction ·
Tất cả issue của clojure-emacs/clojure-mode
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
clojure-emacs/cider#4235 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Request]: WincCó thể đã có người làm @chenyme đã nhận hôm nay. Đang mởpackage-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ScoopInstaller/Extras#19476 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
promplate/code-review#158 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày