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

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

[elpa] externals/ergoemacs-mode 6ec72c0 86/87: Go back to ergoemacs-disp


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode 6ec72c0 86/87: Go back to ergoemacs-display-key-use-face (suggestion from emacs devs)
Date: Wed, 14 Apr 2021 18:47:14 -0400 (EDT)

branch: externals/ergoemacs-mode
commit 6ec72c02e241b8369c5958337c9560f420911a62
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>

    Go back to ergoemacs-display-key-use-face (suggestion from emacs devs)
---
 ergoemacs-component.el       |  9 +++++----
 ergoemacs-functions.el       |  4 ++--
 ergoemacs-key-description.el | 24 ++++++++++++------------
 ergoemacs-lib.el             | 11 +++++++----
 ergoemacs-mode.el            |  4 ++--
 ergoemacs-theme-engine.el    |  7 +++----
 ergoemacs-translate.el       | 21 +++++++++------------
 7 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/ergoemacs-component.el b/ergoemacs-component.el
index 6d97251..8920885 100644
--- a/ergoemacs-component.el
+++ b/ergoemacs-component.el
@@ -44,7 +44,7 @@
 (defvar ergoemacs--last-start-emacs-state-2)
 (defvar ergoemacs--start-emacs-state-2)
 (defvar ergoemacs-component-hash)
-(defvar ergoemacs-display-key-use-face-p)
+(defvar ergoemacs-display-key-use-face)
 (defvar ergoemacs-keyboard-layout)
 (defvar ergoemacs-keymap)
 (defvar ergoemacs-map-properties--known-maps)
@@ -863,7 +863,7 @@ LAYOUT is the current keyboard layout.  Defaults to
 (add-hook 'ergoemacs-mode-after-load-hook 
'ergoemacs-component-struct--add-unbound)
 
 (defun ergoemacs-component-struct--hooks (&optional obj ret)
-  "Gets a list of hooks that need to be defined eor OBJ.
+  "Gets a list of hooks that need to be defined for OBJ.
 
 You can prespecify RET so that new hooks are pushed to the list."
   (let ((obj (ergoemacs-component-struct--lookup-hash (or obj 
(ergoemacs-theme-components))))
@@ -984,7 +984,8 @@ OBJ is the current object being modified, passed to
                (ergoemacs-component-struct--composed-hook ',hook))
              ;; (push )
              (push ',hook ergoemacs-component-struct--create-hooks)
-             (add-hook ',hook #',(intern (concat "ergoemacs--" (symbol-name 
hook))))))))
+             (add-hook ',hook #',(intern (concat "ergoemacs--" (symbol-name 
hook))))))
+    t))
 
 (defun ergoemacs-component-struct--rm-hooks ()
   "Remove hooks.
@@ -1352,7 +1353,7 @@ AT-END will append a \"$\" to the end of the regular 
expression."
                (commandp tmp))
       (help-xref-button 1 'help-function tmp))
     ;; Add button properties back
-    (when (and tmp ergoemacs-display-key-use-face-p)
+    (when (and tmp ergoemacs-display-key-use-face)
       (setq tmp (point))
       (beginning-of-line)
       (while (and (not (looking-at "Relative To:")) (re-search-forward 
"\\(.*?\\)[ +]" tmp t))
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index 90692fa..258c8be 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -1323,7 +1323,7 @@ Based on the value of `major-mode' and
 (defun ergoemacs-camelize-method (s &optional char)
   "Convert under_score string S to CamelCase string."
   (mapconcat 'identity (ergoemacs-mapcar-head
-                        '(lambda (word) (downcase word))
+                        #'downcase
                         '(lambda (word) (capitalize (downcase word)))
                         (split-string s (or char "_"))) ""))
 
@@ -2431,7 +2431,7 @@ Guillemet -> quote, degree -> @, s-zed -> ss, upside-down 
?! -> ?!."
 (defun ergoemacs-shell-here-directory-change-hook ()
   "Renames buffer to reflect directory name."
   (let ((nbn (concat (cond
-                      ((eq major-mode 'eshell-mode) "*eshell@")
+                      ((derived-mode-p 'eshell-mode) "*eshell@")
                       (t (replace-regexp-in-string "\\([*][^@]*[@]\\).*" "\\1" 
(buffer-name) t)))
                      (if (eq system-type 'windows-nt)
                          (ergoemacs :w32-long-file-name (abbreviate-file-name 
default-directory)) ;; Fix case issues
diff --git a/ergoemacs-key-description.el b/ergoemacs-key-description.el
index ed75875..41ebad3 100644
--- a/ergoemacs-key-description.el
+++ b/ergoemacs-key-description.el
@@ -51,7 +51,7 @@
 (defvar ergoemacs-use-unicode-symbols)
 (defvar ergoemacs-display-unicode-characters)
 (defvar ergoemacs-display-capitalize-keys)
-(defvar ergoemacs-display-key-use-face-p)
+(defvar ergoemacs-display-key-use-face)
 (defvar ergoemacs-display-small-symbols-for-key-modifiers)
 (defvar ergoemacs-display-use-unicode-brackets-around-keys)
 (defvar ergoemacs-display-without-brackets nil
@@ -194,10 +194,10 @@ MOD ar the modifiers applied to the key."
       (setq ret (upcase (symbol-name key))))
      (t
       (setq ret (format "%s" key))))
-    (setq ret (concat (copy-sequence ret) " "))
-    (when (and ergoemacs-display-key-use-face-p
+    (setq ret (concat (copy-sequence ret) ""))
+    (when (and ergoemacs-display-key-use-face
                (not ergoemacs-display-small-symbols-for-key-modifiers))
-      (add-text-properties 0 (- (length ret) 1)
+      (add-text-properties 0 (length ret)
                            '(face ergoemacs-display-key-face)
                            ;; Need to make a copy of ret because the
                            ;; (length ret) call makes it sometimes
@@ -267,10 +267,10 @@ MOD ar the modifiers applied to the key."
       (setq ret (format "%sWin+" (ergoemacs :unicode-or-alt "⊞" "#"))))
      (t
       (setq ret (format "%s+" mod))
-      (when ergoemacs-display-key-use-face-p
+      (when ergoemacs-display-key-use-face
         (add-text-properties 0 (- (length ret) 1)
                              '(face ergoemacs-display-key-face) ret))))
-    (when (and ergoemacs-display-key-use-face-p
+    (when (and ergoemacs-display-key-use-face
                (not ergoemacs-display-small-symbols-for-key-modifiers))
       (add-text-properties 0 (- (length ret) 1)
                            '(face ergoemacs-display-key-face) ret))
@@ -292,7 +292,7 @@ MOD ar the modifiers applied to the key."
   "Create pretty keyboard bindings for menus.
 KBD is the keyboard code, LAYOUT is the keyboard layout."
   (let ((ergoemacs-display-without-brackets t)
-        (ergoemacs-display-key-use-face-p nil)
+        (ergoemacs-display-key-use-face nil)
         (ergoemacs-display-small-symbols-for-key-modifiers nil))
     (ergoemacs-key-description kbd layout)))
 
@@ -336,24 +336,24 @@ KBD is the keyboard code.  LAYOUT is the layout that is 
used."
                   (push m tmp)))
              (setq mod tmp))
             (setq tmp (format "%s%s%s%s"
-                              (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face-p) "")
+                              (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face) "")
                                   (and 
ergoemacs-display-use-unicode-brackets-around-keys (ergoemacs :unicode-or-alt 
"【" "["))
                                   "[")
                               (mapconcat #'ergoemacs-key-description--modifier
                                          mod "")
                               (ergoemacs-key-description--key ev mod)
-                              (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face-p) "")
+                              (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face) "")
                                   (and 
ergoemacs-display-use-unicode-brackets-around-keys (ergoemacs :unicode-or-alt 
"】" "]"))
                                   "]")))
-            (when (and ergoemacs-display-small-symbols-for-key-modifiers 
ergoemacs-display-key-use-face-p)
+            (when (and ergoemacs-display-small-symbols-for-key-modifiers 
ergoemacs-display-key-use-face)
               (add-text-properties 0 (length tmp)
                                    '(face ergoemacs-display-key-face) tmp))
             (setq ret (format "%s%s%s" ret
-                              (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face-p) " ")
+                              (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face) " ")
                                   (and 
ergoemacs-display-use-unicode-brackets-around-keys "")
                                   " ")
                              tmp)))
-          (substring ret (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face-p) 1)
+          (substring ret (or (and (or ergoemacs-display-without-brackets 
ergoemacs-display-key-use-face) 1)
                              (and 
ergoemacs-display-use-unicode-brackets-around-keys 0)
                              1)))))))
 
diff --git a/ergoemacs-lib.el b/ergoemacs-lib.el
index cd15574..398b8c9 100644
--- a/ergoemacs-lib.el
+++ b/ergoemacs-lib.el
@@ -26,6 +26,7 @@
 ;; (require 'guide-key nil t)
 
 (require 'cl-lib)
+(require 'find-func)
 
 (eval-when-compile
   (require 'ergoemacs-macros))
@@ -257,13 +258,13 @@ ergoemacs THEME."
   (unless (member (list option theme type remove) ergoemacs-require)
     (push (list option theme type remove) ergoemacs-require))
   (if ergoemacs-require--ini-p
-      (if (eq (type-of option) 'cons)
+      (if (consp option)
           (dolist (new-option option)
             (let (ergoemacs-mode)
               (ergoemacs-require new-option theme type)))
         (let ((option-sym
                (or (and option (stringp option) (intern option)) option)))
-          (dolist (theme (or (and theme (or (and (eq (type-of theme) 'cons) 
theme) (list theme)))
+          (dolist (theme (or (and theme (or (and (consp theme) theme) (list 
theme)))
                              (ergoemacs-theme--list)))
             (let ((theme-plist (ergoemacs-gethash (if (and theme (stringp 
theme)) theme
                                                     (symbol-name theme))
@@ -352,7 +353,8 @@ All other modes are assumed to be minor modes or 
unimportant.
                 (push first all))
               (push (list elt 'menu-item
                           name
-                          elt) ret))
+                          elt)
+                   ret))
             (push (downcase (symbol-name elt)) added-modes)
             (push elt modes)))))
     (dolist (elt (append
@@ -373,7 +375,8 @@ All other modes are assumed to be minor modes or 
unimportant.
                 (push first all))
               (push (list (cdr elt) 'menu-item
                           name
-                          (cdr elt)) ret))
+                          (cdr elt))
+                   ret))
             (push (downcase (symbol-name (cdr elt))) added-modes)
             (push (cdr elt) modes)))))
     (setq modes (sort ret (lambda(x1 x2) (string< (downcase (nth 2 x2))
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index 96db5de..a0caa1a 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -897,9 +897,9 @@ Valid values are:
   :initialize #'custom-initialize-default
   :group 'ergoemacs-display)
 
-(define-obsolete-variable-alias 'ergoemacs-pretty-key-use-face 
'ergoemacs-display-key-use-face-p "Ergoemacs-v5.16")
+(define-obsolete-variable-alias 'ergoemacs-pretty-key-use-face-p 
'ergoemacs-display-key-use-face "Ergoemacs-v5.16")
 
-(defcustom ergoemacs-display-key-use-face-p t
+(defcustom ergoemacs-display-key-use-face t
   "Use a button face for keys."
   :type 'boolean
   :set #'ergoemacs-set-default
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index 0584170..72b224d 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -135,7 +135,7 @@ This respects `ergoemacs-theme-options'."
 
 ;;;###autoload
 (defun ergoemacs-theme-set-version (version)
-  "Sets the current themes default VERSION"
+  "Sets the current themes default VERSION."
   (let (found)
     (setq ergoemacs-theme-version
           (mapcar
@@ -159,7 +159,7 @@ Uses `ergoemacs-theme-option-on'."
   "Turns OPTION on.
 When OPTION is a list turn on all the options in the list
 If OFF is non-nil, turn off the options instead."
-  (if (eq (type-of option) 'cons)
+  (if (consp option)
       (dolist (new-option option)
         (let (ergoemacs-mode)
           (ergoemacs-theme-option-on new-option no-custom off)))
@@ -407,8 +407,7 @@ When AT-END is non-nil, append a $ to the regular 
expression."
        (lambda()
          (interactive)
          (ergoemacs-save 'ergoemacs-smart-paste 'browse-kill-ring))
-       :enable (condition-case err (interactive-form 'browse-kill-ring)
-                 (error nil))
+       :enable (commandp 'browse-kill-ring)
        :button (:radio . (eq ergoemacs-smart-paste 'browse-kill-ring)))))
     (ergoemacs-sep-bash "--")
     (ergoemacs-bash
diff --git a/ergoemacs-translate.el b/ergoemacs-translate.el
index d4fcc1e..bf740a2 100644
--- a/ergoemacs-translate.el
+++ b/ergoemacs-translate.el
@@ -745,7 +745,7 @@ When NAME is a symbol, setup the translation function for 
the symbol."
        ergoemacs-translation-hash)
     (let ((name-str (and (symbolp name) (substring (symbol-name name) 1))))
       (eval
-       (macroexpand
+       (macroexpand ; Fixme why?
        `(progn
           (defvar ,(intern (concat "ergoemacs-translate--" name-str "-map")) 
(make-sparse-keymap)
             ,(concat "Ergoemacs local map for translation :"
@@ -857,7 +857,8 @@ If TYPE is unspecified, assume :normal translation"
                               ((eq 'ergoemacs-shift e) 'shift)
                               ((eq 'ergoemacs-control e) 'control)
                               (t e)))
-                           e-mod) #'string<))
+                           e-mod)
+                         #'string<))
          (special-p (memq basic (list ?m ?i ?\[)))
          (ambiguous-p (and special-p (memq 'control e-mod)))
          tmp
@@ -883,7 +884,8 @@ If TYPE is unspecified, assume :normal translation"
                  ((and special-p (display-graphic-p)
                        (memq 'control modifiers))
                   (push 'ergoemacs-gui modifiers)))
-                (throw 'found-mod t))) nil)
+                (throw 'found-mod t)))
+           nil)
       (if ambiguous-p
           (setq ret (ergoemacs-translate--event-convert-list `(control 
,@modifiers ,basic)))
         (setq ret (ergoemacs-translate--event-convert-list `(,@modifiers 
,basic)))))
@@ -891,23 +893,18 @@ If TYPE is unspecified, assume :normal translation"
 
 (defun ergoemacs-translate--no-gui (event)
   "Remove any gui elements to the EVENT.
-If there are no gui elements, retun nil."
+If there are no gui elements, return nil."
   (if (vectorp event)
-      (eval `(vector ,@(mapcar (lambda(x) (let ((ret (or 
(ergoemacs-translate--no-gui x) x)))
-                                           (if (symbolp ret)
-                                               `(quote ,ret)
-                                             ret))) event)))
+      (apply #'vector (mapcar (lambda(x) (or (ergoemacs-translate--no-gui x) 
x)) event))
     (let* ((last-event event)
           (last-mod (ergoemacs-translate--event-modifiers last-event))
           (last-basic-event (ergoemacs-translate--event-basic-type last-event))
-          new-mod
-          new-event)
+          new-mod)
       (when (memq 'ergoemacs-gui last-mod)
        (dolist (elt last-mod)
          (unless (eq elt 'ergoemacs-gui)
            (push elt new-mod)))
-       (setq new-event (ergoemacs-translate--event-convert-list `(,@new-mod 
,last-basic-event))))
-      new-event)))
+       (ergoemacs-translate--event-convert-list `(,@new-mod 
,last-basic-event))))))
 
 (defvar ergoemacs-translate--parent-map nil
   "Parent map for keymaps when completing a key sequence.")



reply via email to

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