Skip to content

Commit

Permalink
Pre support emacs-30
Browse files Browse the repository at this point in the history
  • Loading branch information
c0001 committed Jan 2, 2025
1 parent b828710 commit 551d5f9
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 16 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ EEMACS_SERVICE_HOST := $(XDG_CONFIG_HOME)/systemd/user
EEMACS_SERVICE_FILE = $(EEMACS_SERVICE_HOST)/eemacs-daemon.$(EEMACS_SESSION).service
EMACS := emacs
EMACS_MAJOR_VERSION := 28
EMACS_RUN = $(EMACS) -Q --eval '(setenv "EEMACS_DEBUG" DEBUG )' -l init.el
EMACS_DEBUG = $(EMACS) -Q --eval '(setenv "EEMACS_DEBUG" "1")' -l init.el --debug-init
EMACS_DEV_AND_DEBUG = $(EMACS) -Q --eval '(progn (setenv "EEMACS_DEBUG" "1") (setenv "EEMACS_DEV" "1"))' -l init.el --debug-init
EMACS_MAKE = $(EMACS) -Q --batch --eval '(setenv "EEMACS_MAKE" MAKE_TYPE )' -l init.el
TERMINATE_WARN = $(EMACS) --batch -q --eval '(or (yes-or-no-p "Remember terminate by kill -9 this make process instead of Ctrl-c since curl do not capture SIGINT") (error "force abort!"))'

Expand Down Expand Up @@ -124,4 +125,8 @@ install-systemd-service:

debug:
@$(EchoEmpty)
@$(EMACS_RUN:DEBUG="1") --debug-init
@$(EMACS_DEBUG)

dev_and_debug:
@$(EchoEmpty)
@$(EMACS_DEV_AND_DEBUG)
10 changes: 10 additions & 0 deletions elements/core/tentacles/entropy-emacs-basic.el
Original file line number Diff line number Diff line change
Expand Up @@ -3629,6 +3629,14 @@ proper cases."
'image-dired-line-up
"Rearranging image-dired thumbnails display layout")

(if (>= emacs-major-version 29)
(declare-function image-dired--file-URI "image-dired-external")
(defun image-dired--file-URI (file)
;; https://en.wikipedia.org/wiki/File_URI_scheme
(if (memq system-type '(windows-nt ms-dos))
(concat "/" file)
file)))

(when (>= emacs-major-version 29)
(define-derived-mode entropy/emacs-image-dired-display-image-mode
special-mode "image-dired-image-display"
Expand Down Expand Up @@ -3839,6 +3847,7 @@ also."
"")
window-height))
(cons ?f file)
(cons ?u (image-dired--file-URI file))
(cons ?t new-file)))
(ret
(apply #'entropy/emacs-call-process-with-tmpdir-as-fallback-directory
Expand Down Expand Up @@ -4193,6 +4202,7 @@ prevention of re-generation."
(spec `((?s . ,size) (?w . ,size) (?h . ,size)
(?m . ,modif-time)
(?f . ,original-file)
(?u . ,(image-dired--file-URI original-file))
(?q . ,thumbnail-nq8-file)
(?t . ,thumbnail-file)))
(thumbnail-dir (file-name-directory thumbnail-file))
Expand Down
20 changes: 10 additions & 10 deletions elements/core/tentacles/entropy-emacs-codeserver.el
Original file line number Diff line number Diff line change
Expand Up @@ -1008,19 +1008,19 @@ shutdown since it is managed by the customize variable

;; ********* lsp idle hook specifications
(defvar entropy/emacs-codeserver--lsp-on-idle-cases
'(
`(
;; Remove `lsp--document-highlight' when current file is not
;; writeable in which case that those clients can not parse the
;; file in where frequently errors prompted.
(lambda ()
(unless (ignore-errors
(file-writable-p
(file-truename
(buffer-file-name (current-buffer)))))
(remove-hook
'lsp-on-idle-hook
'lsp--document-highlight
t))))
,(lambda ()
(unless (ignore-errors
(file-writable-p
(file-truename
(buffer-file-name (current-buffer)))))
(remove-hook
'lsp-on-idle-hook
'lsp--document-highlight
t))))
"Cases of list of functions to run before hook `lsp-on-idle-hook' run."
)

Expand Down
2 changes: 2 additions & 0 deletions elements/core/wasteland/func-binds/entropy-emacs-defun.el
Original file line number Diff line number Diff line change
Expand Up @@ -12822,6 +12822,8 @@ thus."))
(entropy/emacs--set-user-package-dir-common "28.1"))
((= emacs-major-version 29)
(entropy/emacs--set-user-package-dir-common "29.1"))
((= emacs-major-version 30)
(entropy/emacs--set-user-package-dir-common "30.1"))
(t (error "Unsupport emacs version '%s'" emacs-version))))
(when (memq entropy/emacs-ext-elpkg-get-type
'(entropy-emacs-extenisons-project
Expand Down
8 changes: 6 additions & 2 deletions elements/core/wasteland/var-binds/entropy-emacs-defconst.el
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,17 @@ NOTE: all the key can be evaluated at run-time
(doc-sym (make-symbol "docstring"))
(detector-sym (make-symbol "detector"))
(signal-sym (make-symbol "signal"))
(just-warn-sym (make-symbol "just-warn-p"))
(default-sym (make-symbol "default"))
(warn-func-sym (make-symbol "warn-func"))
(err-sym (make-symbol "err-sym"))
(err-data-sym (make-symbol "err-data"))
(do-body-p-sym (make-symbol "do-body-p")))
`(entropy/emacs-when-let*-first
((,(or when t))
(,just-warn-sym
(if (entropy/emacs-getenv-equal-eemacs-env "EEMACS_DEV" "1")
t nil))
(,op-name-sym ,op-name)
(,type-sym ,type)
(,doc-sym ,doc)
Expand All @@ -596,14 +600,14 @@ NOTE: all the key can be evaluated at run-time
(format "%s: [type: '%s' op-name: '%s' err-msg: \"%s\"], \
see `entropy/emacs-api-restriction-detection-log' for details."
,err-sym ,type-sym ,op-name-sym ,err-data-sym)
,do-error))))
(if ,just-warn-sym nil ,do-error)))))
(unless ,default-sym
(entropy/emacs-do-eemacs-top-error
"%s"
(format "invalid eemacs api restriction type - %s"
,type-sym)))
(cond ((funcall ,detector-sym)
(setq ,do-body-p-sym nil)
(setq ,do-body-p-sym (if (or ,just-warn-sym nil) t nil))
(condition-case err
(funcall ,signal-sym)
(t
Expand Down
23 changes: 22 additions & 1 deletion elements/core/wasteland/var-binds/entropy-emacs-defvar.el
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,28 @@ is follow their original order in this hook.")
(funcall orig-func bn)
(funcall orig-func bn ibh))))
(advice-add 'get-buffer-create
:around #'entropy/emacs--get-buffer-create))
:around #'entropy/emacs--get-buffer-create)

(when (>= emacs-major-version 30)
(defun entropy/emacs--require/adv-for/load-pkg/org-compat (ofunc &rest oargs)
"For emacs-30^ org-version-9.7^, in lib `org-compat' use `subr-arity'
to distinguish function `get-buffer-create''s arguments amounts to do
its compat job of `org-get-buffer-create' like what we do as
`entropy/emacs-get-buffer-create'. But func `subr-arity' will do error
when the function is not a `subrp' routine, where `org-compat' use
`symbol-function' to get the origin function but is a mistake since
its return is a adviced lambda wrapper which is not a `subrp' routine."
(if (eq (car oargs) 'org-compat)
(progn
(advice-remove 'get-buffer-create
#'entropy/emacs--get-buffer-create)
(prog1 (apply ofunc oargs)
(advice-add 'get-buffer-create
:around #'entropy/emacs--get-buffer-create)))
(apply ofunc oargs)))
(advice-add 'require :around 'entropy/emacs--require/adv-for/load-pkg/org-compat)
(with-eval-after-load 'org-compat
(advice-remove 'require 'entropy/emacs--require/adv-for/load-pkg/org-compat))))

;; *** More file buffer metas

Expand Down
2 changes: 1 addition & 1 deletion elements/entropy-emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ distingush setenv eemacs spec env vars")
;; The eemacs specified envrionment to indicated all subprocess are
;; ran in an eemacs session, in which case all subprocess can detected
;; this variable to do some extra operations or something else.
(entropy/emacs--inner-setenv-eemacs-env "EEMACS_ENV" "TRUE")
(entropy/emacs--inner-setenv-eemacs-env "EEMACS_ENV" "1")

;; ** Start Eemacs

Expand Down

0 comments on commit 551d5f9

Please sign in to comment.