emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ergoemacs-mode 91b273c 236/325: Remove ergoemacs-compon


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode 91b273c 236/325: Remove ergoemacs-component-struct--define-key
Date: Sat, 23 Oct 2021 18:49:01 -0400 (EDT)

branch: externals/ergoemacs-mode
commit 91b273cd9b1757e74db526e94ec425ff792d393f
Author: Walter Landry <wlandry@caltech.edu>
Commit: Walter Landry <wlandry@caltech.edu>

    Remove ergoemacs-component-struct--define-key
---
 ergoemacs-component.el | 110 -------------------------------------------------
 1 file changed, 110 deletions(-)

diff --git a/ergoemacs-component.el b/ergoemacs-component.el
index bda4235..02aeb5c 100644
--- a/ergoemacs-component.el
+++ b/ergoemacs-component.el
@@ -259,116 +259,6 @@ with the label, and then return."
         (setf (ergoemacs-component-struct-map obj) map)
         map)))
 
-(defun ergoemacs-component-struct--define-key (keymap key def &optional object)
-  "In KEYMAP, define KEY to be DEF for OBJECT.
-If not specified, OBJECT is `ergoemacs-component-struct--define-key-current'."
-  (cond
-   ((and (not ergoemacs-component-struct--define-key-current) (not object)) ;; 
Old
-    (error "`ergoemacs-component-struct--define-key' is confused"))
-   (t
-    (let ((obj (or object ergoemacs-component-struct--define-key-current))
-          (key (or (and (consp key) (memq (car key) '(kbd read-kbd-macro))
-                        (stringp (nth 1 key)) (read-kbd-macro (nth 1 key)))
-                   key))
-          (def (ergoemacs-component-struct--define-key-get-def def)))
-      (if (not (ergoemacs-component-struct-p obj))
-          (error "OBJECT not a ergoemacs-component-structure")
-        (setq key (vconcat key))
-        (let* ((global-map-p (or (eq keymap 'global-map) (eq keymap 
'ergoemacs-mode-map)
-                                 (eq keymap 'ergoemacs-keymap)))
-               (when-condition (ergoemacs-component-struct-when-condition obj))
-               (hook (ergoemacs-component-struct-hook obj))
-               (cur-map (or (and global-map-p (not when-condition)
-                                 (ergoemacs-component-struct--ini-map obj))
-                            (and (not when-condition) (ergoemacs-gethash 
keymap (ergoemacs-component-struct-maps obj)))
-                            (and global-map-p when-condition 
(ergoemacs-gethash when-condition (ergoemacs-component-struct-cond-maps obj)))
-                            (and when-condition hook (ignore-errors 
(ergoemacs-gethash keymap (ergoemacs-gethash hook 
(ergoemacs-component-struct-hook-maps obj)))))))
-               (package-name (ergoemacs-component-struct-package-name obj))
-               fn-lst
-               (key (or (and (vectorp key) key)
-                        (and (stringp key) (vconcat key))))
-               tmp)
-          (cond
-           ((and (not cur-map) (not when-condition))
-            (cl-pushnew keymap ergoemacs-map-properties--known-maps)
-           (cl-pushnew keymap ergoemacs-map-properties--label-atoms-maps)
-            (setq cur-map (make-sparse-keymap))
-            (puthash keymap cur-map (ergoemacs-component-struct-maps obj)))
-           ((and (not cur-map) when-condition global-map-p)
-            (setq cur-map (make-sparse-keymap))
-            (puthash when-condition cur-map 
(ergoemacs-component-struct-cond-maps obj)))
-           ((and (not cur-map) when-condition hook)
-            (unless (ergoemacs-gethash hook 
(ergoemacs-component-struct-hook-maps obj))
-              (puthash hook (make-hash-table) 
(ergoemacs-component-struct-hook-maps obj)))
-            (cl-pushnew keymap ergoemacs-map-properties--known-maps)
-           (cl-pushnew keymap ergoemacs-map-properties--label-atoms-maps)
-            (setq cur-map (make-sparse-keymap))
-            (puthash keymap cur-map (ergoemacs-gethash hook 
(ergoemacs-component-struct-hook-maps obj)))))
-          (cond
-           ((and global-map-p (not when-condition) (not def) (setq tmp 
(lookup-key (ergoemacs-component-struct-map obj) key))
-                 (not (integerp tmp)))
-            ;; Remove the key from the keymap, do not set it to
-            ;; nil; Its as if it was never defined
-            (setq ergoemacs-component-struct--define-key-temp-map 
(make-sparse-keymap))
-            (ergoemacs-timing remove-global-map-map-keymap
-              (ergoemacs-map-keymap
-               (lambda (cur-key item)
-                 (if (consp cur-key)
-                     (ergoemacs-warn "Keymap range currently not supported %s 
%s" cur-key item)
-                   (unless (eq item 'ergoemacs-prefix)
-                     (unless (equal key cur-key)
-                       (ergoemacs :define-key 
ergoemacs-component-struct--define-key-temp-map cur-key item)))))
-               cur-map))
-            (setf (ergoemacs-component-struct-map obj)
-                  (copy-keymap 
ergoemacs-component-struct--define-key-temp-map))
-            (setq ergoemacs-component-struct--define-key-temp-map nil))
-           ((and global-map-p (not (eq keymap 'global-map)) (not 
when-condition) (not def));; Add to unbind keys
-            (unless (member key (ergoemacs-component-struct-unbind obj))
-              (push key (ergoemacs-component-struct-unbind obj))))
-           ((and global-map-p (not when-condition) (not def)) ;; Add to 
undefined keys
-            (unless (member key (ergoemacs-component-struct-undefined obj))
-              (push key (ergoemacs-component-struct-undefined obj))))
-           ((and (not when-condition) (lookup-key cur-map key) (not def))
-            ;; Remove the key from the keymap.  Do not set it to nil.
-            ;; Its as if it was never defined.
-            (setq ergoemacs-component-struct--define-key-temp-map 
(make-sparse-keymap))
-            (ergoemacs-timing remove-local-keymap-map-keymap
-              (ergoemacs-map-keymap
-               (lambda (cur-key item)
-                 (if (consp cur-key)
-                     (message "Key range not supported %s, %s" cur-key item)
-                   (unless (eq item 'ergoemacs-prefix)
-                     (unless (equal key cur-key)
-                       (ergoemacs :define-key 
ergoemacs-component-struct--define-key-temp-map cur-key item)))))
-               cur-map))
-            (puthash keymap (copy-keymap 
ergoemacs-component-struct--define-key-temp-map) 
(ergoemacs-component-struct-maps obj))
-            (setq ergoemacs-component-struct--define-key-temp-map nil))
-           ((and (consp def) (stringp (nth 0 def)) (symbolp (nth 1 def)) (eq 
(nth 1 def) 'keymap))
-            (ergoemacs :define-key cur-map key def))
-           ((and (consp def) (symbolp (nth 1 def))) ;; (fn1 fn2 fn3 fn4)
-            (unless (catch 'found-fn
-                      (dolist (cur-def def)
-                        (if (not (commandp cur-def t))
-                            (push cur-def fn-lst)
-                          (if (ergoemacs-keymapp cur-def)
-                             (ergoemacs :define-key cur-map key (copy-keymap 
cur-def))
-                           (ergoemacs :define-key cur-map key cur-def))
-                          (throw 'found-fn t)))
-                      nil)
-              ;; Not found
-              (ergoemacs :define-key cur-map key `(lambda() (interactive) 
(error ,(format "This key is undefined without one of the following functions: 
%s" fn-lst)))))
-            (when fn-lst ;; Test for later
-              (push (list keymap key fn-lst)
-                    (ergoemacs-component-struct-dynamic-keys obj))))
-           (t
-            (if (ergoemacs-keymapp def)
-               (ergoemacs :define-key cur-map key (copy-keymap def))
-             (ergoemacs :define-key cur-map key def))
-            (when (and package-name def (not (fboundp def)))
-              ;; Create autoload.
-              (autoload def (format "%s" package-name) nil t)
-              (push (cons def package-name) 
(ergoemacs-component-struct-autoloads obj)))))))))))
-
 (defun ergoemacs-component-struct--clear-cache (struct-map)
   "Clears STRUCT-MAP's cache of keymaps.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]