最近想试下lsp-bridge,但是安装就出了问题:No compression program defined,我已经给jka-compr-compression-info-list 加了一个条目,针对dz文件的解压,代码如下:
;; 配置bz压缩文件
(add-to-list 'jka-compr-compression-info-list
["\\.dz\\'" nil nil nil "uncompressing" "7z"
("-c" "-q" "-d")
nil t "\037\213"])
(jka-compr-update)
但是还是有下面这个问题,需要怎么改呢?
系统是windows 11,emacs版本:29.1
Debugger entered--Lisp error: (error "No compression program defined")
error("No compression program defined")
jka-compr-write-region(nil nil "c:/softs/msys2/home/myhfs/.emacs.d/straight/links/..." nil 0 "c:/softs/msys2/home/myhfs/.emacs.d/straight/links/..." nil)
jka-compr-handler(write-region nil nil "c:/softs/msys2/home/myhfs/.emacs.d/straight/links/..." nil 0 "c:/softs/msys2/home/myhfs/.emacs.d/straight/links/..." nil)
write-region(nil nil "c:/softs/msys2/home/myhfs/.emacs.d/straight/links/..." nil 0)
straight--symlink-recursively("c:/softs/msys2/home/myhfs/.emacs.d/straight/repos/..." "c:/softs/msys2/home/myhfs/.emacs.d/straight/build/...")
straight--symlink-recursively("c:/softs/msys2/home/myhfs/.emacs.d/straight/repos/..." "c:/softs/msys2/home/myhfs/.emacs.d/straight/build/...")
straight--symlink-package((:type git :host github :repo "manateelazycat/lsp-bridge" :files (:defaults "*.rs" "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources") :build (:not compile) :package "lsp-bridge" :local-repo "lsp-bridge"))
straight--build-package((:type git :host github :repo "manateelazycat/lsp-bridge" :files (:defaults "*.rs" "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources") :build (:not compile) :package "lsp-bridge" :local-repo "lsp-bridge") nil)
#f(compiled-function () #<bytecode 0x307af261b55b712>)()
straight--transaction-exec(use-package-\"0cece0d7e832ee2dc114fe24f5ea8808\"-nil-nil :now #f(compiled-function () #<bytecode 0x307af261b55b712>))
straight-use-package((lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge" :files (:defaults "*.rs" "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources") :build (:not compile)))
load-with-code-conversion("c:/softs/msys2/home/myhfs/.emacs.d/lisp/init-compl..." "c:/softs/msys2/home/myhfs/.emacs.d/lisp/init-compl..." nil t)
require(init-complete)
load-with-code-conversion("c:/softs/msys2/home/myhfs/.emacs.d/init.el" "c:/softs/msys2/home/myhfs/.emacs.d/init.el" t t)
load("c:/softs/msys2/home/myhfs/.emacs.d/init" noerror nomessage)
startup--load-user-init-file(#f(compiled-function () #<bytecode -0x1bd0aa94963aef16>) #f(compiled-function () #<bytecode -0x1f3c61addc0c4f35>) t)
command-line()
normal-top-level()
;;; init -- 初始化配置
;;; Commentary:
;;; Code:
(add-to-list 'load-path "~/.emacs.d/lisp")
(require 'init-package) ; 配置包管理器
(require 'init-keymap) ; 配置自定义快捷键
(require 'init-custom) ; 自定义的一些配置
(require 'init-theme) ; 配置主题色
(require 'init-window) ; 窗口的一些配置
(require 'init-project) ; 项目管理的一些配置
(require 'init-dashboard) ; 首页的配置
;; 使用工具的一些配置
(require 'init-magit) ; git配置
(require 'init-org) ; org配置
;; ide
(require 'init-ide) ; lsp,treesit等配置
(require 'init-complete) ; lsp-bridge自动提示
(provide 'init)
;;; init.el ends here
;; 关闭自动生成备份文件
(setq make-backup-files nil)
;;全屏
(custom-set-variables
'(initial-frame-alist (quote ((fullscreen . maximized)))))
;; 配置编码
(set-language-environment "UTF-8")
(set-default-coding-systems 'utf-8)
;; 配置whitespace
(global-whitespace-mode t)
(setq whitespace-line-column 10000)
;; 配置yes和no的别名
(defalias 'yes-or-no-p 'y-or-n-p)
;; 选中的内容可以C-d删除
(delete-selection-mode 1)
;; 选中的内容可以粘贴覆盖
(cua-selection-mode 1)
;; 关闭启动帮助文档
(setq inhibit-splash-screen 1)
;; 配置bz压缩文件
(add-to-list 'jka-compr-compression-info-list
["\\.dz\\'" nil nil nil "uncompressing" "7z"
("-c" "-q" "-d")
nil t "\037\213"])
(jka-compr-update)
(provide 'init-custom)
;;; init-custom.el ends here
不是很懂…
就我所知,straight.el 和 lsp-bridge 都没有压缩或解压缩文件的需求。结合 debugger 信息来看应该是 write-region 之后通过某种方法触发了 jka 的某个 handler 然后调用了 jka-compr-write-region。
在 straight–symlink-recursively 实现中使用了 with-temp-file
,可能是 kill-buffer-hook
塞进去了额外的函数,能看一下你的 emacs 中 kill-buffer-hook
打印结果吗
lsp-bridge中有,~/.emacs.d/straight/build/lsp-bridge/resources下面有个pinyin.dict.dz这个文件…我手动解压都不行,它会自动删掉这个目录,然后重新下载,自己解压…
…
那你尝试过直接下载 lsp-bridge 然后添加到 load-path 吗,不是很懂 lsp-bridge
简单看了下 lsp-bridge 的代码,那个 dz 压缩文件不由 emacs 端处理,你添加的 jka 部分代码可能不是必要的,试着在配置中去掉顶楼部分代码再启动 emacs 看看。
当然只是一种猜测,我不作回复了
1 个赞
(use-package lsp-bridge
:straight '(lsp-bridge :type git :host github :repo “manateelazycat/lsp-bridge”
:files (:defaults “.el" ".py” “acm” “core” “langserver” “multiserver” “resources”)
:build (:not compile))
:init
(global-lsp-bridge-mode))
我没有设置任何jka-compr-comression-info-list相关的东西
和你的错误一摸一样,lsp-bridge没有正确的被build
请问你是怎么解决的?
整个lsp-bridge就是照抄GITHUB的(use-package :straight …)的代码
系统,WIN10, 7Z安装了,且已经设入了PATH环境变量
WSRer
18
我的解决方法如下:
(defadvice jka-compr-info-compress-args (around eval-args activate)
"Evaluate program arguments"
(setq ad-return-value (mapcar 'eval (aref info 3))))
(defadvice jka-compr-info-uncompress-args (around eval-args activate)
"Evaluate program arguments"
(setq ad-return-value (mapcar 'eval (aref info 6))))
(add-to-list 'jka-compr-compression-info-list ["\\.dz\\'" "7z" "7z" ("-")
"dz uncompress" "7z" (filename) nil t ""])
(add-to-list 'auto-mode-alist '("\\.dz\\'" nil jka-compr))
(add-to-list 'file-name-handler-alist '("\\.dz\\'" . jka-compr-handler))
(use-package lsp-bridge
:straight '(lsp-bridge :host github :repo "manateelazycat/lsp-bridge"
:files (:defaults "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources")
:build (:not compile))
; :init
; (global-lsp-bridge-mode)
)