define the deprecated enable functions with the macro

This commit is contained in:
Steven Allen 2024-06-03 20:09:38 -07:00
parent 74e4443a08
commit 514db268c2
6 changed files with 24 additions and 53 deletions

View file

@ -194,13 +194,6 @@ may kill this connection when they replace it.")
(exwm--define-global-minor-mode background (exwm--define-global-minor-mode background
"Global minor mode for toggling EXWM background support.") "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) (provide 'exwm-background)
;;; exwm-background.el ends here ;;; exwm-background.el ends here

View file

@ -412,11 +412,15 @@ One of `line-mode' or `char-mode'.")
"Define global minor mode named exwm-NAME-mode. "Define global minor mode named exwm-NAME-mode.
EXWM's init-hook and exit-hook are modified to call INIT and EXIT functions. 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." If an X connection exists, the mode is immediately enabled or disabled."
(declare (indent 1) (debug t)) (declare (doc-string 2) (indent 1) (debug t))
(let ((mode (intern (format "exwm-%s-mode" name))) (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)))) (init (or init (intern (format "exwm-%s--init" name))))
(exit (or exit (intern (format "exwm-%s--exit" name))))) (exit (or exit (intern (format "exwm-%s--exit" name)))))
`(define-minor-mode ,mode `(prog1
(define-minor-mode ,mode
,doc ,doc
:global t :global t
:group 'exwm :group 'exwm
@ -429,7 +433,9 @@ If an X connection exists, the mode is immediately enabled or disabled."
(t (t
(remove-hook 'exwm-init-hook #',init) (remove-hook 'exwm-init-hook #',init)
(remove-hook 'exwm-exit-hook #',exit) (remove-hook 'exwm-exit-hook #',exit)
(when exwm--connection (,exit))))))) (when exwm--connection (,exit)))))
(defun ,enable () ,enabledoc (,mode 1))
(make-obsolete #',enable ,deprecation "0.40"))))
(provide 'exwm-core) (provide 'exwm-core)

View file

@ -360,13 +360,6 @@ Refresh when any RandR 1.5 monitor changes."
(exwm--define-global-minor-mode randr (exwm--define-global-minor-mode randr
"Global minor mode for toggling EXWM RandR support.") "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) (provide 'exwm-randr)

View file

@ -686,13 +686,6 @@ Argument DATA contains the raw event data."
(exwm--define-global-minor-mode systemtray (exwm--define-global-minor-mode systemtray
"Global minor mode for toggling EXWM 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) (provide 'exwm-systemtray)

View file

@ -801,13 +801,6 @@ Such event would be received when the client window is destroyed."
(exwm--define-global-minor-mode xim (exwm--define-global-minor-mode xim
"Global minor mode for toggling EXWM XIM support.") "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) (provide 'exwm-xim)

View file

@ -331,13 +331,6 @@ SERIAL is a sequence number."
(exwm--define-global-minor-mode xsettings (exwm--define-global-minor-mode xsettings
"Global minor mode for toggling EXWM Xsettings support.") "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) (provide 'exwm-xsettings)
;;; exwm-xsettings.el ends here ;;; exwm-xsettings.el ends here