Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: color-rg-project-root-dir in emacs 29 #72

Merged
merged 2 commits into from
Jul 5, 2022

Conversation

C1tas
Copy link
Contributor

@C1tas C1tas commented Jul 4, 2022

27+ should use (car (last project)) to get project dir str
so switch the condition

29运行时发现此处的版本判断顺序应当调整一下,或直接调整if代码块中内容,但调整判断顺序更为便捷

27+ should use (car (last project)) to get project dir str
so switch the condition
@manateelazycat
Copy link
Owner

请测试一下 emacs28, 我发现 emacs28 和 emacs29 很不一样。

@C1tas
Copy link
Contributor Author

C1tas commented Jul 5, 2022

测试环境
"GNU Emacs 28.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
of 2022-07-05"

"GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)
of 2022-04-19"

看能否采取如下复合判断策略,单一 version< 可能导致低版本判断错误

(defun color-rg-project-root-dir ()
  (let ((project (project-current)))
    (if project
        (cond
         ;; 27 <= <= 28
         ((and
           (version< "27" emacs-version)
           (version< emacs-version "29")) (expand-file-name (cdr project)))
         ;; >= 29
         ((version<= "29" emacs-version) (expand-file-name (car (last project))))
         (t default-directory)))))

目前这28,29两个版本测试 color-rg-seach-input-in-project 表现正常

@manateelazycat manateelazycat merged commit 4565103 into manateelazycat:master Jul 5, 2022
@manateelazycat
Copy link
Owner

谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants