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

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

[elpa] externals/ergoemacs-mode 347070d 76/87: Some changes


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode 347070d 76/87: Some changes
Date: Wed, 14 Apr 2021 18:47:11 -0400 (EDT)

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

    Some changes
---
 ergoemacs-command-loop.el | 20 ++++++++++++--------
 ergoemacs-component.el    | 15 ++++++++-------
 ergoemacs-functions.el    | 13 ++++++++++---
 3 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/ergoemacs-command-loop.el b/ergoemacs-command-loop.el
index 8628dbb..e6f9f8e 100644
--- a/ergoemacs-command-loop.el
+++ b/ergoemacs-command-loop.el
@@ -105,11 +105,12 @@
 (defvar ergoemacs-command-loop--mark-active nil
   "Determines if mark was active before ergoemacs command loop.")
 
+(define-obsolete-variable-alias 'ergoemacs-universal-fns 
'ergoemacs-command-loop--universal-functions)
+
 
 (defvar ergoemacs-command-loop--universal-functions '(universal-argument 
ergoemacs-universal-argument ergoemacs-command-loop--universal-argument)
   "List of `ergoemacs-mode' recognized functions.")
 
-(define-obsolete-variable-alias 'ergoemacs-universal-fns 
'ergoemacs-command-loop--universal-functions)
 
 (defvar ergoemacs-command-loop--next-key-hash
   (let ((hash (make-hash-table)))
@@ -129,14 +130,14 @@
 
 (defvar ergoemacs-command-loop--help-last-key nil)
 
+(define-obsolete-variable-alias 'ergoemacs-read-key-delay 
'ergoemacs-command-loop--decode-event-delay)
+
 (defvar ergoemacs-command-loop--decode-event-delay 0.01
   "Timeout for `ergoemacs-command-loop--decode-event'.
 This is to distinguish events in a terminal, like xterm.
 
 It needs to be less than `ergoemacs-command-loop-blink-rate'.")
 
-(define-obsolete-variable-alias 'ergoemacs-read-key-delay 
'ergoemacs-command-loop--decode-event-delay)
-
 (defvar ergoemacs-command-loop--history nil
   "History of command loop locations.")
 
@@ -384,7 +385,8 @@ Ergoemacs-mode sets up: :ctl-to-alt :unchorded :normal."
               (message "Dummy Function for %s" (ergoemacs :modifier-desc ,(nth 
1 arg))))
             (defalias ',(intern (concat "ergoemacs-read-key-force-" 
(symbol-name (nth 0 arg)))) ',(intern (concat "ergoemacs-command-loop--force-" 
(symbol-name (nth 0 arg)))))
             (puthash ',(intern (concat "ergoemacs-command-loop--force-" 
(symbol-name (nth 0 arg)))) '(,(nth 1 arg) :force) 
ergoemacs-command-loop--next-key-hash)
-            (puthash ',(intern (concat "ergoemacs-read-key-force-" 
(symbol-name (nth 0 arg)))) '(,(nth 1 arg) :force) 
ergoemacs-command-loop--next-key-hash)))))
+            (puthash ',(intern (concat "ergoemacs-read-key-force-" 
(symbol-name (nth 0 arg)))) '(,(nth 1 arg) :force) 
ergoemacs-command-loop--next-key-hash)
+           t))))
 
 (defvar ergoemacs-last-command-event nil
   "`ergoemacs-mode' command loop last read command.")
@@ -1659,10 +1661,12 @@ instead of `format'."
          (when (not ergoemacs-command-loop--spinner-list)
            (setq ergoemacs-command-loop--spinner-list (nth 1 (assoc 
ergoemacs-command-loop-spinner ergoemacs-command-loop-spinners))
                  ergoemacs-command-loop--spinner-i 0))
-         (ergoemacs-command-loop--message "%s%s" (nth (mod (setq 
ergoemacs-command-loop--spinner-i (+ 1 ergoemacs-command-loop--spinner-i))
-                                                           (length 
ergoemacs-command-loop--spinner-list))
-                                                      
ergoemacs-command-loop--spinner-list)
-                                          rest))))))
+         (ergoemacs-command-loop--message
+          "%s%s" (nth (mod (setq ergoemacs-command-loop--spinner-i
+                                 (+ 1 ergoemacs-command-loop--spinner-i))
+                           (length ergoemacs-command-loop--spinner-list))
+                      ergoemacs-command-loop--spinner-list)
+          rest))))))
 
 (defun ergoemacs-command-loop--spinner-end ()
   "Cancel the `ergoemacs-command-loop--spinner' timer."
diff --git a/ergoemacs-component.el b/ergoemacs-component.el
index 3740e57..6d97251 100644
--- a/ergoemacs-component.el
+++ b/ergoemacs-component.el
@@ -169,11 +169,7 @@ if the package is deferred."
           (unless (or defer (featurep package))
             (require package nil t))
           (when (and package (not (featurep package)) (numberp defer))
-            (run-with-idle-timer defer nil #'require package  ;; `(lambda()
-                           ;; (message ,(format "Defer: %s %s" package defer))
-                           ;; (require ,package)
-                                 ;; (ergoemacs-component-struct--apply-inits))
-                                )
+            (run-with-idle-timer defer nil #'require package)
             )
           (when (and defer autoloads)
             (dolist (c autoloads)
@@ -981,6 +977,8 @@ OBJ is the current object being modified, passed to
   "Gets a list of hooks that need to be defined eor OBJ."
   (dolist (hook (ergoemacs-component-struct--hooks obj))
     (eval `(progn
+            ;; FIXME: Since Emacs-25 we could use a closure with a computed 
docstring,
+            ;; using (:documentation <exp>).
              (defun ,(intern (concat "ergoemacs--" (symbol-name hook))) ()
                ,(format "`ergoemacs-mode' hook for `%s'" (symbol-name hook))
                (ergoemacs-component-struct--composed-hook ',hook))
@@ -1132,7 +1130,10 @@ to prevent infinite recursion."
          ((and ensure (symbolp ensure))
           (ergoemacs-component-struct--ensure ensure defer autoloads))
         ((and (consp ensure) (memq (car ensure) '(memq member and or if when = 
string= not string< eq equal)))
-         (when (ignore-errors (eval ensure))
+         ;; FIXME: avoid `eval', e.g. by making
+          ;; ergoemacs-component-struct-ensure hold a function rather than
+         ;; an expression.
+         (when (ignore-errors (eval ensure t))
            (ergoemacs-component-struct--ensure package-name defer autoloads)))
          ((consp ensure)
           (dolist (elt ensure)
@@ -1212,7 +1213,7 @@ to prevent infinite recursion."
                           (nth 3 init))))
                  (t
                   (condition-case err
-                      (eval (nth 0 init))
+                      (eval (nth 0 init) t)
                     (error (progn
                             (ergoemacs-warn "%s while evaluating %s" err (nth 
0 init))
                             (debug err))))
diff --git a/ergoemacs-functions.el b/ergoemacs-functions.el
index 5c46645..257148a 100644
--- a/ergoemacs-functions.el
+++ b/ergoemacs-functions.el
@@ -357,8 +357,12 @@ If TERMINAL is non-nil, run the terminal version"
 
 (defun ergoemacs-emacs-exe ()
   "Get the Emacs executable for testing purposes."
-  (let* ((emacs-exe (invocation-name))
-         (emacs-dir (invocation-directory))
+  ;; FIXME: The quotes can't be quite right; better use something like
+  ;; `shell-quote-argument'.
+  (let* ((emacs-exe (if (fboundp 'invocation-name) (invocation-name)
+                      (if (boundp 'invocation-name) invocation-name)))
+         (emacs-dir (if (fboundp 'invocation-directory) (invocation-directory)
+                      (if (boundp 'invocation-directory) 
invocation-directory)))
          (full-exe (concat "\"" (expand-file-name emacs-exe emacs-dir)
                            "\"")))
     full-exe))
@@ -1611,7 +1615,10 @@ by `ergoemacs-maximum-number-of-files-to-open'.
     (let ((process-connection-type nil))
       (start-process "" nil "xdg-open" ".")))))
 
-(defvar ergoemacs-recently-closed-buffers (cons nil nil) "A list of recently 
closed buffers. The max number to track is controlled by the variable 
`ergoemacs-recently-closed-buffers-max'.")
+;; FIXME: Why default to (cons nil nil) instead of just nil?
+(defvar ergoemacs-recently-closed-buffers (cons nil nil)
+  "A list of recently closed buffers. The max number to track is controlled by 
the variable `ergoemacs-recently-closed-buffers-max'.")
+
 (defvar ergoemacs-recently-closed-buffers-max 30 "The maximum length for 
`ergoemacs-recently-closed-buffers'.")
 
 ;; note: emacs won't offer to save a buffer that's



reply via email to

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