* bug#73264: tree-sitter shows jit-lock-function error when i delete some code
@ 2024-09-15 6:06 vinurs
2024-09-15 6:36 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: vinurs @ 2024-09-15 6:06 UTC (permalink / raw)
To: 73264
[-- Attachment #1.1: Type: text/plain, Size: 1009 bytes --]
Hi,
I am using the latest emacs-30 https://github.com/emacs-mirror/emacs/commit/81347c1aaf25b27e78e8beee4bc818ad2c4e1b71
The min configuration is as follows:
(add-to-list 'treesit-extra-load-path (expand-file-name "tree-sitter/" user-emacs-directory))
(add-to-list 'load-path "~/.emacs.d/site-lisp/clojure-ts-mode”)
(require 'clojure-ts-mode)
;; debug
(setq debug-on-quit t)
and I only use clojure-ts-mode package
cd ~/.emacs.d/site-lisp
git clone https://github.com/clojure-emacs/clojure-ts-mode.git
Then, after opening Emacs, Open the elong.clj file, go to line 115, select the entire build-inventory-check-failure-response function, and then delete this function. You'll notice that the remaining code is no longer highlighted. Then I found the following error output in the Message buffer:
Error during redisplay: (jit-lock-function 4221) signaled (wrong-type-argument number-or-marker-p nil) [2 times
------------
Sincerely,
Haiyuan Zhang, Vinurs
[-- Attachment #1.2: Type: text/html, Size: 1777 bytes --]
[-- Attachment #2: elong.clj --]
[-- Type: application/octet-stream, Size: 6955 bytes --]
(ns server.app.web.routes.hotel-sync.elong
(:refer-clojure :exclude [])
(:require
[app.web.routes.hotel-sync.elong-get-rer-status :refer [parse-get-rer-status-rq]]
[clojure.data.xml :as xml]
[clojure.data.zip.xml :as zx]
[clojure.tools.logging :as log]
[java-time.api :as java-time]
[server.app.web.routes.hotel-sync.dossen :refer [check-hotel-price-and-cnt]]
[server.app.web.routes.hotel-sync.elong-cancel :refer [parse-cancel-rq]]
[server.app.web.routes.hotel-sync.elong-hotel-res :refer [parse-hotel-res-rq]]
[server.app.web.routes.hotel-sync.elong-inventory-check :refer [parse-inventory-check-rq]]
[server.app.web.routes.hotel-sync.elong-modify-res :refer [parse-modify-res-rq]]
[server.app.web.routes.hotel-sync.tools :refer [get-root-tag xml->map]]))
;; 同程的接口
;; 调试辅助函数:用于打印调试信息
;; (defn- debug-extract-attr
;; [zip path attr-name]
;; (let [value (apply zx/xml1-> zip (concat path [(zx/attr attr-name)]))]
;; (log/info "Extracting" attr-name "from" path ":" value)
;; value))
;; (defn- debug-extract
;; "从给定的路径中提取文本内容并记录日志"
;; [zip path]
;; (let [value (apply zx/xml1-> zip (concat path [zx/text]))]
;; (log/info "Extracting text from" path ":" value)
;; value))
(defn build-hotel-reservation-success-response
"构建酒店预订成功的响应 XML"
[{:keys [timestamp version echo-token elong-order-id supplier-order-id]}]
(xml/element
:OTA_HotelResRS
{:TimeStamp timestamp
:Version version
:EchoToken echo-token}
(xml/element
:POS
{}
(xml/element
:Source
{}
(xml/element :RequestorID {:Type "13" :ID "elong"})))
(xml/element :Success {} "success")
(xml/element
:UniqueID
{:Type "14" :ID elong-order-id}
(xml/element :CompanyName {} "elong"))
(xml/element
:UniqueID
{:Type "10" :ID supplier-order-id}
(xml/element :CompanyName {} "Jltour"))))
(comment
;; 使用示例
(let [response-xml (build-hotel-reservation-success-response
{:timestamp "2023-05-15 10:30:00"
:version "1.0"
:echo-token "e9246d3e-2807-449c-bbc5-affedee739c2"
:elong-order-id "43143215"
:supplier-order-id "s2305150001"})]
(println (xml/emit-str response-xml))))
;; 构建 OTA_InventoryCheckRS 响应 XML
(defn build-inventory-check-response
[{:keys [timestamp version echo-token hotel-id free-cancelable room-type-code
room-types rate-plans
rate-plan-code price-effect-date sale-price base-price allotment]}]
(xml/element
:OTA_InventoryCheckRS
{:TimeStamp timestamp
:Version version
:EchoToken echo-token}
(xml/element
:HotelResult
{}
(xml/element :HotelID {} hotel-id)
(xml/element
:HotelProducts
{}
(xml/element
:HotelProduct
{}
(when free-cancelable
(xml/element :FreeCancelable {:FreeCancelableVal (str free-cancelable)}))
(xml/element :RoomTypes {}
(for [room-type room-types]
(xml/element :RoomType {:RoomTypeCode (:room-type-code room-type)})))
(xml/element :RatePlans {}
(for [rate-plan rate-plans]
(xml/element :RatePlan {:RatePlanCode (:rate-plan-code rate-plan)})))
;; (xml/element :RoomTypes {} (xml/element :RoomType {:RoomTypeCode room-type-code}))
;; (xml/element :RatePlans {} (xml/element :RatePlan {:RatePlanCode rate-plan-code}))
(xml/element :Prices
{}
(xml/element :Price
{}
(xml/element :Base
{:EffectDate price-effect-date
:SalePrice sale-price
:BasePrice base-price
:Allotment allotment
:DcOverSaleAllotment allotment
:DcAddAllotment "-1"
:DcContractAllotment "-1"
:DcBuyOutAllotment "-1"}))))))))
(defn build-inventory-check-failure-response
[{:keys [echo-token timestamp version hotel-id room-types rate-plans effect-date]}]
(log/info "666" room-types)
(xml/element
:OTA_InventoryCheckRS
{:EchoToken echo-token
:TimeStamp timestamp
:Version version}
(xml/element
:HotelResult
{}
(xml/element :HotelID {} hotel-id)
(xml/element
:HotelProducts
{}
(xml/element
:HotelProduct
{}
(xml/element :RoomTypes {}
(for [room-type room-types]
(xml/element :RoomType {:RoomTypeCode (:room-type-code room-type)})))
(xml/element :RatePlans {}
(for [rate-plan rate-plans]
(xml/element :RatePlan {:RatePlanCode (:rate-plan-code rate-plan)})))
(xml/element :Prices
{}
(xml/element :Price
{}
(xml/element :Base
{:EffectDate effect-date
:SalePrice "0"
:BasePrice "0"
:Allotment "0"
:DcOverSaleAllotment "0"
:DcAddAllotment "-1"
:DcContractAllotment "-1"
:DcBuyOutAllotment "-1"}))))))))
(defn parse-req-data
"根据请求类型解析XML数据"
[req-type parsed-xml]
(condp = req-type
:OTA_HotelResRQ (parse-hotel-res-rq parsed-xml)
:OTA_CancelRQ (parse-cancel-rq parsed-xml)
:OTA_ModifyResRQ (parse-modify-res-rq parsed-xml)
:OTA_InventoryCheckRQ (parse-inventory-check-rq parsed-xml)
:OTA_GetRerStatusRQ (parse-get-rer-status-rq parsed-xml)
;; else
"未知请求"))
(defn handle-elong-order-req
"解析 XML 并提取房型、价格计划、住客人数、酒店代码等信息。"
[xml-string]
(let [req-type (get-root-tag xml-string)
parsed-xml (xml->map xml-string)
parsed-data (parse-req-data req-type parsed-xml)]
(log/debug "解析出来的 xml 数据是" parsed-xml)
(log/info "提取出来的数据\n" parsed-data)
(condp = req-type
:OTA_HotelResRQ "创建订单"
:OTA_CancelRQ "取消订单1123"
:OTA_ModifyResRQ "变更订单"
:OTA_InventoryCheckRQ 2 ; (handle-inventory-check parsed-data)
:OTA_GetRerStatusRQ "轮询获取订单状态"
;; else
"未知请求"))
"解析完成")
[-- Attachment #3: elong-1.jpg --]
[-- Type: image/jpeg, Size: 416066 bytes --]
[-- Attachment #4: elong-2.jpg --]
[-- Type: image/jpeg, Size: 438895 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#73264: tree-sitter shows jit-lock-function error when i delete some code
2024-09-15 6:06 bug#73264: tree-sitter shows jit-lock-function error when i delete some code vinurs
@ 2024-09-15 6:36 ` Eli Zaretskii
2024-09-15 7:44 ` Yuan Fu
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-09-15 6:36 UTC (permalink / raw)
To: vinurs; +Cc: 73264-done
> Date: Sun, 15 Sep 2024 14:06:22 +0800
> From: vinurs <hi@vinurs.me>
>
> I am using the latest emacs-30
> https://github.com/emacs-mirror/emacs/commit/81347c1aaf25b27e78e8beee4bc818ad2c4e1b71
>
> The min configuration is as follows:
>
> (add-to-list 'treesit-extra-load-path (expand-file-name "tree-sitter/" user-emacs-directory))
>
> (add-to-list 'load-path "~/.emacs.d/site-lisp/clojure-ts-mode”)
>
> (require 'clojure-ts-mode)
>
> ;; debug
>
> (setq debug-on-quit t)
>
> and I only use clojure-ts-mode package
>
> cd ~/.emacs.d/site-lisp
>
> git clone https://github.com/clojure-emacs/clojure-ts-mode.git
>
> Then, after opening Emacs, Open the elong.clj file, go to line 115, select the entire
> build-inventory-check-failure-response function, and then delete this function. You'll notice that the remaining
> code is no longer highlighted. Then I found the following error output in the Message buffer:
>
> Error during redisplay: (jit-lock-function 4221) signaled (wrong-type-argument number-or-marker-p nil) [2
> times
Thanks.
Since clojure-ts-mode is not part of Emacs, please report this to the
developers of clojure-ts-mode instead.
I'm therefore closing this bug. If the developers of clojure-ts-mode
conclude that the underlying problem is in core Emacs, we can reopen
this bug with the details of their analysis and conclusions.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#73264: tree-sitter shows jit-lock-function error when i delete some code
2024-09-15 6:36 ` Eli Zaretskii
@ 2024-09-15 7:44 ` Yuan Fu
0 siblings, 0 replies; 3+ messages in thread
From: Yuan Fu @ 2024-09-15 7:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73264-done, vinurs
> On Sep 14, 2024, at 11:36 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> Date: Sun, 15 Sep 2024 14:06:22 +0800
>> From: vinurs <hi@vinurs.me>
>>
>> I am using the latest emacs-30
>> https://github.com/emacs-mirror/emacs/commit/81347c1aaf25b27e78e8beee4bc818ad2c4e1b71
>>
>> The min configuration is as follows:
>>
>> (add-to-list 'treesit-extra-load-path (expand-file-name "tree-sitter/" user-emacs-directory))
>>
>> (add-to-list 'load-path "~/.emacs.d/site-lisp/clojure-ts-mode”)
>>
>> (require 'clojure-ts-mode)
>>
>> ;; debug
>>
>> (setq debug-on-quit t)
>>
>> and I only use clojure-ts-mode package
>>
>> cd ~/.emacs.d/site-lisp
>>
>> git clone https://github.com/clojure-emacs/clojure-ts-mode.git
>>
>> Then, after opening Emacs, Open the elong.clj file, go to line 115, select the entire
>> build-inventory-check-failure-response function, and then delete this function. You'll notice that the remaining
>> code is no longer highlighted. Then I found the following error output in the Message buffer:
>>
>> Error during redisplay: (jit-lock-function 4221) signaled (wrong-type-argument number-or-marker-p nil) [2
>> times
>
> Thanks.
>
> Since clojure-ts-mode is not part of Emacs, please report this to the
> developers of clojure-ts-mode instead.
>
> I'm therefore closing this bug. If the developers of clojure-ts-mode
> conclude that the underlying problem is in core Emacs, we can reopen
> this bug with the details of their analysis and conclusions.
(Cough cough) Actually that’s my fault. But I’ve now fixed it on emacs-30 and added some more tests. Thanks for the report!
Yuan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-15 7:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-15 6:06 bug#73264: tree-sitter shows jit-lock-function error when i delete some code vinurs
2024-09-15 6:36 ` Eli Zaretskii
2024-09-15 7:44 ` Yuan Fu
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).