branch: externals/xelb commit 2f9c5e55b50b898235be5666192d4fade0930e91 Author: Chris Feng <chris.w.f...@gmail.com> Commit: Chris Feng <chris.w.f...@gmail.com>
Enable XKB module * .elpaignore: Unblock almost all files. * el_client.el (xelb-excluded-replies<25): New constants storing replies that should not be loaded on Emacs 24. (xelb-parse-request): Prevent loading replies stored in `xelb-excluded-replies<25' on Emacs 24. * xcb-xkb.el: Regenerated. --- .elpaignore | 5 ----- el_client.el | 16 +++++++++++++++- xcb-xkb.el | 12 ++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.elpaignore b/.elpaignore index 319bcbf..b43bf86 100644 --- a/.elpaignore +++ b/.elpaignore @@ -1,6 +1 @@ -Makefile README.md -el_client.el - -# Exclude xcb-xkb.el for now, as it does not work on Emacs 24 -xcb-xkb.el diff --git a/el_client.el b/el_client.el index 02d78ad..1a0f300 100644 --- a/el_client.el +++ b/el_client.el @@ -45,6 +45,9 @@ ;;;; Variables +(defconst xelb-excluded-replies<25 '(xcb:xkb:GetKbdByName~reply) + "Excluded replies for Emacs < 25 (they're too long to load/compile).") + (defvar xelb-prefix "xcb:" "Namespace of this module.") (make-variable-buffer-local 'xelb-prefix) @@ -362,10 +365,21 @@ The `combine-adjacent' attribute is simply ignored." `(cl-defmethod xcb:marshal ((obj ,name)) nil ,@expressions (cl-call-next-method obj))) + ,(when (memq reply-name xelb-excluded-replies<25) + ;; Redefine `defclass' as no-op. + '(eval-and-compile + (when (< emacs-major-version 25) + (fset 'xcb:-defclass (symbol-function 'defclass)) + (defmacro defclass (&rest _args))))) ;; The optional reply body ,(when reply-name (delq nil reply-contents) - `(defclass ,reply-name (xcb:-reply) ,reply-contents)))))) + `(defclass ,reply-name (xcb:-reply) ,reply-contents)) + ,(when (memq reply-name xelb-excluded-replies<25) + ;; Bring back the original defination of `defclass'. + '(eval-and-compile + (when (< emacs-major-version 25) + (fset 'defclass (symbol-function 'xcb:-defclass))))))))) (defun xelb-parse-event (node) "Parse <event>. diff --git a/xcb-xkb.el b/xcb-xkb.el index 4d77cc2..46aad34 100644 --- a/xcb-xkb.el +++ b/xcb-xkb.el @@ -1712,6 +1712,13 @@ (want :initarg :want :type xcb:CARD16) (load :initarg :load :type xcb:BOOL) (pad~0 :initform 1 :type xcb:-pad))) +(eval-and-compile + (when + (< emacs-major-version 25) + (fset 'xcb:-defclass + (symbol-function 'defclass)) + (defmacro defclass + (&rest _args)))) (defclass xcb:xkb:GetKbdByName~reply (xcb:-reply) ((deviceID :initarg :deviceID :type xcb:CARD8) @@ -1973,6 +1980,11 @@ (baseColorNdx :initarg :baseColorNdx :type xcb:CARD8) (labelColorNdx :initarg :labelColorNdx :type xcb:CARD8) (labelFont :initarg :labelFont :type xcb:xkb:CountedString16))) +(eval-and-compile + (when + (< emacs-major-version 25) + (fset 'defclass + (symbol-function 'xcb:-defclass)))) (defclass xcb:xkb:GetDeviceInfo (xcb:-request)