ergoemacs/ergoemacs-mode

Load ergoemacs functions as a normal minor mode; dont use delays

abelardojarab opened this issue · 4 comments

Hi,
I hope you are very well.
Ergoemacs used to be amazing package but I see it has gone down and added several codebase's that do not follow good Emacs programming. Please do not be offended; I wish ergoemacs could go back to what it is: best menu/bindings for Emacs.

  1. Load ergoemacs-mode as a normal standard well written minor-mode; for example in ergoemacs-mode we have this code by the end:
(defvar ergoemacs-mode-started-p nil)
(defun ergoemacs-mode-after-init-emacs ()
  "Start `ergoemacs-mode' after loading Emacs."
  (unless ergoemacs-mode--start-p
    (ergoemacs-timing ergoemacs-mode-after-init-emacs
      (setq ergoemacs-mode--start-p t)
      (ergoemacs-mode ergoemacs-mode)
      (run-hooks 'ergoemacs-mode-init-hook)
      (add-hook 'after-load-functions #'ergoemacs-mode-after-startup-run-load-hooks))
    (let* ((time1 ergoemacs--load-time)
           (time2 (aref (gethash 'ergoemacs-mode-after-init-emacs ergoemacs-timing-hash) 1))
           (time3 (+ time1 time2)))
      (message "Started `ergoemacs-mode'. Total startup time %f (Load: %f, Initialize:%f%s)"
               time3 time1 time2 (or (and ergoemacs-mode--fast-p ", cached") ""))))
  (setq ergoemacs-mode-started-p t))


(run-with-idle-timer 0.05 nil #'ergoemacs-mode-after-init-emacs)
(add-hook 'emacs-startup-hook #'ergoemacs-mode-after-init-emacs)
  1. Next ergoemacs launches a new session of emacs in the background??
(defun ergoemacs-map-properties--get-original-global-map ()
  "Load/Create the default global map information."
  (if ergoemacs-mode--fast-p
      (progn
	(setq ergoemacs-map-properties--known-maps ergoemacs-map-properties--label-atoms-maps)
	(ergoemacs-map-properties--label-known))
      ;; (ergoemacs-map-properties--label-atoms)
    (ergoemacs-timing get-original-global-map
      ;; (ergoemacs-map-properties--label-atoms)
      (if (file-readable-p (ergoemacs-map-properties--default-global-file))
          (progn
	    (load (ergoemacs-map-properties--default-global-file))
	    (setq ergoemacs-map-properties--known-maps ergoemacs-map-properties--label-atoms-maps)
	    (message "Breadcrumb %s" (ergoemacs-gethash 'describe-european-environment-map ergoemacs-breadcrumb-hash))
	    (ergoemacs-map-properties--label-known)
            (ergoemacs-map-properties--protect-global-map))
        (if noninteractive
            (ergoemacs-warn "Could not find global map information")
          (ergoemacs-timing ergoemacs-create-global
            (let* ((emacs-exe (ergoemacs-emacs-exe))
                   (default-directory (expand-file-name (file-name-directory (locate-library "ergoemacs-mode"))))
                   (cmd (format "%s -L %s --batch --load \"ergoemacs-mode\" -Q --eval \"(ergoemacs-map-properties--default-global-gen) (kill-emacs)\"" emacs-exe default-directory)))
              (message "%s" (shell-command-to-string cmd))
              (ergoemacs-map-properties--get-original-global-map))))))))

(add-hook 'ergoemacs-mode-intialize-hook 'ergoemacs-map-properties--get-original-global-map)

Cant we dont get just the global-map using elisp without leaving emacs??

  1. So many defadvice over defadvice over defadvice; helm gives me spcl max depth nest has been exceeded.

In fact, some helm-* commands fail because of so many defadvices...
I used ergoemacs-mode in the past and all these things were not present.

I have fork ergoemacs-mode so I disabled most of the defadvices and didnt lose functionality; neither I had to launch a background emacs to get the global map....

Please dont get angry with this comment; but this is with good intention.
You guys are awesome but it is becoming harder and harder to use ergoemacs....

I understand your concern.

I can explain why the first two things are done, and please let me know what you think.

Item 1 -- This is loaded after emacs runs because all the keymaps in emacs are remapped to ergoemacs-mode one. Therefore, in theory, all keymaps should be supported.

Item 2 --The true global map without any changes cannot be obtained without a fresh emacs. Pepole modify the global map all the time. In order to compare what has happenend with what was in the global map, a fresh emacs global map needs to be obtained. Hence, it requires a fresh install. This is only run once, though. `ergoemacs-mode' then saves the unchanged global map. While I could save all the files, the global map happens to be version and OS specific (sadly). Therefore, many, many files would have to be created.

Item 3 -- The advices could be reconsidered if you don't use them.

I would like ergoemacs-mode to work with every mode without spending time on the latest and greatest mode... Hecne Item 1 and 2.

I have thought of abandoning the remapping of keymaps to the ergoemacs keymaps on loadup, but then I would have to come up with a mechanism of remapping the keymaps I use and then caching them. If you would like to take that on, I would love to have the support.

My personal biggest problem with ergoemacs-mode is the load time. Loading cached translated keys on startup should minimize startup time.

More or less done