namespace caching breaks updating namespace name
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- emacs-lisp
- Área
- tooling
Línea de trabajo
Empieza leyendo clojure-update-ns y clojure-find-ns, especialmente la rama cached y los datos de coincidencia que utiliza replace-match. Reproduce el fallo con clojure-cache-ns habilitado mientras actualizas un namespace. Se considera terminado cuando la actualización del namespace tiene éxito y el namespace almacenado en caché se actualiza de forma coherente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
(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.
- Lenguaje dominante
- Emacs Lisp
- Estrellas
- 1k
- Forks
- 249
- Merge medio
- 1 d 6 h
- PR fusionados (30 d)
- 6
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de clojure-emacs/clojure-mode
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
clojure-emacs/clojure-mode#699 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
clojure-emacs/clojure-mode#660 · 5 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
clojure-emacs/clojure-mode#647 · 1 comentario ·
-
bug help wanted indentation
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
clojure-emacs/clojure-mode#620 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
clojure-emacs/clojure-mode#613 · 1 reacción ·
Todos los issues de clojure-emacs/clojure-mode
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
clojure-emacs/cider#4235 ·
Los mantenedores suelen responder en 1 día
-
[Request]: WincPosiblemente ocupada @chenyme la tomó hoy. Abiertopackage-request
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ScoopInstaller/Extras#19476 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
promplate/code-review#158 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día