branch: externals/xelb commit 27c463b8cb819f4d28eedbf51d30c757efa7ec14 Author: Chris Feng <chris.w.f...@gmail.com> Commit: Chris Feng <chris.w.f...@gmail.com>
Fixes for compatibility and compilation issues * xcb-types.el: Backport the version of `with-slots' from Emacs 25 to 24. * xcb-keysyms.el (xcb:keysyms:init): Remove error logs which break after compilation. * el_client.el: Eliminate a compilation warning. --- el_client.el | 8 ++++---- xcb-keysyms.el | 4 ---- xcb-types.el | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/el_client.el b/el_client.el index d487a27..178fb0c 100644 --- a/el_client.el +++ b/el_client.el @@ -66,6 +66,10 @@ "Return the tag name of node NODE." (car node)) +(defsubst xelb-node-attr (node attr) + "Return the attribute ATTR of node NODE." + (cdr (assoc attr (cadr node)))) + (defsubst xelb-node-type (node) "Return the type of node NODE." (let ((type-name (xelb-node-attr node 'type)) @@ -93,10 +97,6 @@ ;; Not defined. (error "Undefined type :%s" type-name)))))) -(defsubst xelb-node-attr (node attr) - "Return the attribute ATTR of node NODE." - (cdr (assoc attr (cadr node)))) - (defsubst xelb-escape-name (name) "Replace underscores in NAME with dashes." (replace-regexp-in-string "_" "-" name)) diff --git a/xcb-keysyms.el b/xcb-keysyms.el index 83ef346..dc8198c 100644 --- a/xcb-keysyms.el +++ b/xcb-keysyms.el @@ -76,13 +76,9 @@ This method must be called before using any other method in this module." (cond ((= request xcb:Mapping:Modifier) ;; Modifier keys changed - (xcb:-log "Update modifier mapping") (xcb:keysyms:update-modifier-mapping ,obj)) ((= request xcb:Mapping:Keyboard) ;; Update changed keys - (xcb:-log "Update keyboard mapping: %s - %s" - first-keycode - (+ first-keycode count -1)) (xcb:keysyms:update-keyboard-mapping ,obj first-keycode count))))))))))) diff --git a/xcb-types.el b/xcb-types.el index 35d2fba..ad02739 100644 --- a/xcb-types.el +++ b/xcb-types.el @@ -55,6 +55,22 @@ ;;;; Fix backward compatibility issues with Emacs < 25 +(eval-and-compile + (when (< emacs-major-version 25) + ;; Copied from Emacs 25 with documentation and comments stripped. + ;; The version of `with-slots' in Emacs 24 is buggy and inefficient. + (defmacro with-slots (spec-list object &rest body) + (declare (indent 2) (debug (sexp sexp def-body))) + (require 'cl-lib) + (macroexp-let2 nil object object + `(cl-symbol-macrolet + ,(mapcar (lambda (entry) + (let ((var (if (listp entry) (car entry) entry)) + (slot (if (listp entry) (cadr entry) entry))) + (list var `(slot-value ,object ',slot)))) + spec-list) + ,@body))))) + ;; Backport some new functions from Emacs 25 (eval-and-compile