From 514db268c275f4b14bc762e6c7d4485c6a6dc68a Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 3 Jun 2024 20:09:38 -0700 Subject: [PATCH] define the deprecated enable functions with the macro --- exwm-background.el | 7 ------- exwm-core.el | 42 ++++++++++++++++++++++++------------------ exwm-randr.el | 7 ------- exwm-systemtray.el | 7 ------- exwm-xim.el | 7 ------- exwm-xsettings.el | 7 ------- 6 files changed, 24 insertions(+), 53 deletions(-) diff --git a/exwm-background.el b/exwm-background.el index e4bebc5..73c9933 100644 --- a/exwm-background.el +++ b/exwm-background.el @@ -194,13 +194,6 @@ may kill this connection when they replace it.") (exwm--define-global-minor-mode background "Global minor mode for toggling EXWM background support.") -(defun exwm-background-enable () - "Enable background support for EXWM." - (add-hook 'exwm-init-hook #'exwm-background-mode) - (add-hook 'exwm-exit-hook (apply-partially #'exwm-background-mode -1)) - (when exwm--connection (exwm-background-mode))) -(make-obsolete #'exwm-background-enable "Use `exwm-background-mode' instead." "0.40") - (provide 'exwm-background) ;;; exwm-background.el ends here diff --git a/exwm-core.el b/exwm-core.el index 06c80e2..a8f8c4b 100644 --- a/exwm-core.el +++ b/exwm-core.el @@ -412,24 +412,30 @@ One of `line-mode' or `char-mode'.") "Define global minor mode named exwm-NAME-mode. EXWM's init-hook and exit-hook are modified to call INIT and EXIT functions. If an X connection exists, the mode is immediately enabled or disabled." - (declare (indent 1) (debug t)) - (let ((mode (intern (format "exwm-%s-mode" name))) - (init (or init (intern (format "exwm-%s--init" name)))) - (exit (or exit (intern (format "exwm-%s--exit" name))))) - `(define-minor-mode ,mode - ,doc - :global t - :group 'exwm - (exwm--log) - (cond - (,mode - (add-hook 'exwm-init-hook #',init) - (add-hook 'exwm-exit-hook #',exit) - (when exwm--connection (,init))) - (t - (remove-hook 'exwm-init-hook #',init) - (remove-hook 'exwm-exit-hook #',exit) - (when exwm--connection (,exit))))))) + (declare (doc-string 2) (indent 1) (debug t)) + (let* ((mode (intern (format "exwm-%s-mode" name))) + (enable (intern (format "exwm-%s-enable" name))) + (enabledoc (format "Enable %s support for EXWM." name)) + (deprecation (format "Use `%s' instead." mode)) + (init (or init (intern (format "exwm-%s--init" name)))) + (exit (or exit (intern (format "exwm-%s--exit" name))))) + `(prog1 + (define-minor-mode ,mode + ,doc + :global t + :group 'exwm + (exwm--log) + (cond + (,mode + (add-hook 'exwm-init-hook #',init) + (add-hook 'exwm-exit-hook #',exit) + (when exwm--connection (,init))) + (t + (remove-hook 'exwm-init-hook #',init) + (remove-hook 'exwm-exit-hook #',exit) + (when exwm--connection (,exit))))) + (defun ,enable () ,enabledoc (,mode 1)) + (make-obsolete #',enable ,deprecation "0.40")))) (provide 'exwm-core) diff --git a/exwm-randr.el b/exwm-randr.el index bfda67e..9d42f1d 100644 --- a/exwm-randr.el +++ b/exwm-randr.el @@ -360,13 +360,6 @@ Refresh when any RandR 1.5 monitor changes." (exwm--define-global-minor-mode randr "Global minor mode for toggling EXWM RandR support.") -(defun exwm-randr-enable () - "Enable RandR support for EXWM." - (add-hook 'exwm-init-hook #'exwm-randr-mode) - (add-hook 'exwm-exit-hook (apply-partially #'exwm-randr-mode -1)) - (when exwm--connection (exwm-randr-mode))) -(make-obsolete #'exwm-randr-enable "Use `exwm-randr-mode' instead." "0.40") - (provide 'exwm-randr) diff --git a/exwm-systemtray.el b/exwm-systemtray.el index 1a6507e..89ed97d 100644 --- a/exwm-systemtray.el +++ b/exwm-systemtray.el @@ -686,13 +686,6 @@ Argument DATA contains the raw event data." (exwm--define-global-minor-mode systemtray "Global minor mode for toggling EXWM systemtray.") -(defun exwm-systemtray-enable () - "Enable system tray support for EXWM." - (add-hook 'exwm-init-hook #'exwm-systemtray-mode) - (add-hook 'exwm-exit-hook (apply-partially #'exwm-systemtray-mode -1)) - (when exwm--connection (exwm-systemtray-mode))) -(make-obsolete #'exwm-systemtray-enable "Use `exwm-systemtray-mode' instead." "0.40") - (provide 'exwm-systemtray) diff --git a/exwm-xim.el b/exwm-xim.el index 52dc06f..98f6650 100644 --- a/exwm-xim.el +++ b/exwm-xim.el @@ -801,13 +801,6 @@ Such event would be received when the client window is destroyed." (exwm--define-global-minor-mode xim "Global minor mode for toggling EXWM XIM support.") -(defun exwm-xim-enable () - "Enable XIM support for EXWM." - (add-hook 'exwm-init-hook #'exwm-xim-mode) - (add-hook 'exwm-exit-hook (apply-partially #'exwm-xim-mode -1)) - (when exwm--connection (exwm-xim-mode))) -(make-obsolete #'exwm-xim-enable "Use `exwm-xim-mode' instead." "0.40") - (provide 'exwm-xim) diff --git a/exwm-xsettings.el b/exwm-xsettings.el index e438474..1969cb5 100644 --- a/exwm-xsettings.el +++ b/exwm-xsettings.el @@ -331,13 +331,6 @@ SERIAL is a sequence number." (exwm--define-global-minor-mode xsettings "Global minor mode for toggling EXWM Xsettings support.") -(defun exwm-xsettings-enable () - "Enable xsettings support for EXWM." - (add-hook 'exwm-init-hook #'exwm-xsettings-mode) - (add-hook 'exwm-exit-hook (apply-partially #'exwm-xsettings-mode -1)) - (when exwm--connection (exwm-xsettings-mode))) -(make-obsolete #'exwm-xsettings-enable "Use `exwm-xsettings-mode' instead." "0.40") - (provide 'exwm-xsettings) ;;; exwm-xsettings.el ends here