namespace caching breaks updating namespace name
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- emacs-lisp
- 領域
- tooling
調査の方向性
まず clojure-update-ns と clojure-find-ns を読み、特に cached ブランチと replace-match で使用される match データを確認してください。namespace の更新中に clojure-cache-ns を有効にして、失敗を再現してください。namespace の更新が成功し、キャッシュされた namespace が一貫して更新されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
(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.
- 主要言語
- Emacs Lisp
- スター
- 1k
- フォーク
- 249
- 平均マージ
- 1日 6時間
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
clojure-emacs/clojure-mode のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
clojure-emacs/clojure-mode#699 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
clojure-emacs/clojure-mode#660 · コメント 5 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
clojure-emacs/clojure-mode#647 · コメント 1 件 ·
-
bug help wanted indentation
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
clojure-emacs/clojure-mode#620 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
clojure-emacs/clojure-mode#613 · リアクション 1 件 ·
clojure-emacs/clojure-mode の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
clojure-emacs/cider#4235 ·
メンテナーはふだん 1 日以内に返信
-
[Request]: Winc対応中かも @chenyme が今日担当しました。 オープンpackage-request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ScoopInstaller/Extras#19476 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
promplate/code-review#158 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信