From 947ee69d9d34d9b20e206b4c224c49022082d8b8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 29 Jun 2023 00:51:04 +1000 Subject: emacs 29 conditionals (time-stamp and tree-sitter) --- emacs/.emacs.d/init/ycp-editing.el | 4 +++- emacs/.emacs.d/init/ycp-prog.el | 39 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el index bddd955..351fe2e 100644 --- a/emacs/.emacs.d/init/ycp-editing.el +++ b/emacs/.emacs.d/init/ycp-editing.el @@ -138,7 +138,9 @@ (add-to-list 'auto-mode-alist '("\\(README\\|CHANGELOG\\|COPYING\\|LICENSE\\)\\'" . text-mode)) -(add-hook 'before-save-hook 'time-stamp) +;; https://lists.gnu.org/archive/html/emacs-devel/2023-06/msg00113.html +(when (string< emacs-version "29") + (add-hook 'before-save-hook 'time-stamp)) (save-place-mode 1) diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el index 003e862..cb061b2 100644 --- a/emacs/.emacs.d/init/ycp-prog.el +++ b/emacs/.emacs.d/init/ycp-prog.el @@ -426,25 +426,26 @@ (setq coq-diffs 'on) (setq proof-three-window-enable nil)) -;;; tree-sitter -(add-to-list 'load-path (locate-user-emacs-file "lisp/elisp-tree-sitter/core")) -(add-to-list 'load-path (locate-user-emacs-file "lisp/elisp-tree-sitter/lisp")) -(my-package tree-sitter - (:delay 30) - (require 'tree-sitter-hl) - (require 'tree-sitter-langs) - (require 'tree-sitter-debug) - (require 'tree-sitter-query) - (add-to-list 'tree-sitter-major-mode-language-alist - '(haskell-mode . haskell)) - (add-to-list 'tree-sitter-major-mode-language-alist - '(phps-mode . php)) - ;; disable tree sitter for c/c++ and use eglot instead - ;; FIXME: make it so it is only disabled with eglot on - (add-to-list 'tree-sitter-major-mode-language-alist - '(c-mode)) - (global-tree-sitter-mode) - (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)) +;;; tree-sitter is built-in in emacs 29 +(when (string< emacs-version "29") + (add-to-list 'load-path (locate-user-emacs-file "lisp/elisp-tree-sitter/core")) + (add-to-list 'load-path (locate-user-emacs-file "lisp/elisp-tree-sitter/lisp")) + (my-package tree-sitter + (:delay 30) + (require 'tree-sitter-hl) + (require 'tree-sitter-langs) + (require 'tree-sitter-debug) + (require 'tree-sitter-query) + (add-to-list 'tree-sitter-major-mode-language-alist + '(haskell-mode . haskell)) + (add-to-list 'tree-sitter-major-mode-language-alist + '(phps-mode . php)) + ;; disable tree sitter for c/c++ and use eglot instead + ;; FIXME: make it so it is only disabled with eglot on + (add-to-list 'tree-sitter-major-mode-language-alist + '(c-mode)) + (global-tree-sitter-mode) + (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))) ;;; sml (my-package sml-mode -- cgit v1.2.3