修改了配置
This commit is contained in:
parent
bfe0bbf383
commit
02046d3d41
|
@ -53,6 +53,6 @@
|
|||
(when (eq system-type 'windows-nt)
|
||||
(setq exec-path (append exec-path '("C:/softs/sqlite3"))))
|
||||
(setenv "PATH" (concat "C:/softs/sqlite3;" (getenv "PATH")))
|
||||
|
||||
(setq debug-on-error t)
|
||||
(provide 'init-custom)
|
||||
;;; init-custom.el ends here
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; 这个是基础配置部分
|
||||
(require 'project)
|
||||
|
||||
;; 配置项目根目录识别
|
||||
|
@ -11,20 +10,6 @@
|
|||
;; 设置项目列表文件
|
||||
(setq project-list-file "~/.emacs.d/projects")
|
||||
|
||||
;; 设置项目切换时的默认命令列表
|
||||
(setq project-switch-commands
|
||||
'((project-find-file "Find file")
|
||||
(project-dired "Dired")
|
||||
(project-vc-dir "VC-Dir")
|
||||
(project-shell "Shell")))
|
||||
|
||||
;; 自定义项目根目录识别函数
|
||||
(defun my/project-try-custom-root (dir)
|
||||
"Define custom project roots."
|
||||
(let ((root (locate-dominating-file dir ".project")))
|
||||
(and root (cons 'vc root))))
|
||||
(add-hook 'project-find-functions #'my/project-try-custom-root)
|
||||
|
||||
;; 手动添加项目到 project.el 的项目列表
|
||||
(defun my/add-project (dir)
|
||||
"手动将 DIR 添加到 project.el 的项目列表中。"
|
||||
|
@ -34,11 +19,34 @@
|
|||
(unless (member (list dir) projects)
|
||||
(setq projects (append projects (list (list dir))))
|
||||
(setq project--list projects)
|
||||
;; 保存到 projects 文件,而不是 custom.el
|
||||
;; 保存到项目列表文件
|
||||
(with-temp-file project-list-file
|
||||
(insert (prin1-to-string projects)))
|
||||
(message "项目 %s 已添加到 project.el 列表中" dir))))
|
||||
|
||||
;; 手动移除项目
|
||||
(defun my/remove-project (dir)
|
||||
"手动将 DIR 从 project.el 的项目列表中移除。"
|
||||
(interactive "D移除项目目录: ")
|
||||
(setq project--list (cl-remove-if (lambda (p) (string= (car p) dir)) project--list))
|
||||
(with-temp-file project-list-file
|
||||
(insert (prin1-to-string project--list)))
|
||||
(message "项目 %s 已移除" dir))
|
||||
|
||||
;; 禁用自动移除项目
|
||||
(defun project--remove-dead-projects ()
|
||||
"Override to do nothing. Prevent auto-removal of projects.")
|
||||
|
||||
;; 启动时加载项目列表
|
||||
(defun my/load-projects ()
|
||||
"从文件加载项目列表到 project--list。"
|
||||
(when (file-exists-p project-list-file)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents project-list-file)
|
||||
(setq project--list (read (buffer-string))))))
|
||||
|
||||
(my/load-projects)
|
||||
|
||||
;; 清除不存在的项目缓存
|
||||
(defun project-forget-zombie-projects ()
|
||||
"Remove non-existing projects from the known projects list."
|
||||
|
|
Loading…
Reference in New Issue
Block a user