jamescherti / minimal-emacs.d

Minimal ~/.emacs.d - Better Vanilla Emacs Defaults and Optimized Startup
https://github.com/jamescherti/minimal-emacs.d
153 stars 14 forks source link

minions.el does not work #8

Closed linwaytin closed 3 weeks ago

linwaytin commented 3 weeks ago

I put (minions-mode 1) in either post-init.el or init.el, but it does not work. I think this is because some manipulation of mode-line in early-init.el. How do I make minions work in this config framework?

Thank you.

jamescherti commented 3 weeks ago

Does minions-mode require the menu bar?

If that's the case, the menu bar can be re-enabled by adding the following configuration to ~/.emacs.d/pre-early-init.el:

(setq minimal-emacs-ui-features '(menu-bar))

Other UI features can also be enabled by adding the following to ~/.emacs.d/pre-early-init.el:

(setq minimal-emacs-ui-features '(context-menu tool-bar menu-bar dialogs tooltips))
linwaytin commented 3 weeks ago

I do not think it needs the menu bar.

I tried to add (setq minimal-emacs-ui-features '(context-menu tool-bar menu-bar dialogs tooltips)) to pre-early-init.el, but it doesn't make minions work.

I think it's related to the variable mode-line-format, mentioned in https://github.com/tarsius/minions/wiki#compatibility-with-all-or-nothing-mode-line-packages .

jamescherti commented 3 weeks ago

I have just committed a change that may resolve the issue.

Could you please test the develop branch and confirm if it works. Here is how to switch to the latest develop version:

git -C ~/.emacs.d fetch -a
git -C ~/.emacs.d checkout develop
git -C ~/.emacs.d reset --hard origin/develop

The git -C ~/.emacs.d show -s command should display:

commit cd264b49b7baab1f4e3f3d201ff87bde950fa394 (HEAD -> develop, origin/develop)
Author: James Cherti <60946298+jamescherti@users.noreply.github.com>
Date:   Sun Sep 15 21:07:54 2024 -0400

    Fix mode-line-format and inhibit-display/message issue
linwaytin commented 3 weeks ago

The new commit on develop branch still does not work. However, I found in both the original and develop branches, if I manually turn on the minions-mode and then open a new file, minions would work after that. Kind of strange behavior.

jamescherti commented 3 weeks ago

Could it be a minions-mode issue? Please test minions-mode with the following initialization files.

Add to post-init.el all the other packages that you intent to use (to check if the issue isn't caused by another package).

~/.emacs.d/early-init.el file:

;;; early-init.el --- Early Init -*- no-byte-compile: t; lexical-binding: t; -*-
(defvar minimal-emacs-user-directory user-emacs-directory
  "The default value of the `user-emacs-directory' variable.")

(defun minimal-emacs-load-user-init (filename)
  "Execute a file of Lisp code named FILENAME."
  (let ((user-init-file
         (expand-file-name filename
                           minimal-emacs-user-directory)))
    (when (file-exists-p user-init-file)
      (load user-init-file nil t))))

(minimal-emacs-load-user-init "pre-early-init.el")

(setq package-enable-at-startup nil)
(setq package-quickstart nil)
(setq use-package-always-ensure t)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("melpa-stable" . "https://stable.melpa.org/packages/")
                         ("gnu" . "https://elpa.gnu.org/packages/")
                         ("nongnu" . "https://elpa.nongnu.org/nongnu/")))
(customize-set-variable 'package-archive-priorities '(("gnu"    . 99)
                                                      ("nongnu" . 80)
                                                      ("stable" . 70)
                                                      ("melpa"  . 0)))

(minimal-emacs-load-user-init "post-early-init.el")

(provide 'early-init)

And ~/.emacs.d/init.el file:

;;; init.el --- Init -*- no-byte-compile: t; lexical-binding: t; -*-
(minimal-emacs-load-user-init "pre-init.el")

;;; package.el
(when (bound-and-true-p minimal-emacs-package-initialize-and-refresh)
  ;; Initialize and refresh package contents again if needed
  (package-initialize)
  (unless package-archive-contents
    (package-refresh-contents))

  ;; Install use-package if necessary
  (unless (package-installed-p 'use-package)
    (package-install 'use-package))

  ;; Ensure use-package is available at compile time
  (eval-when-compile
    (require 'use-package)))

(minimal-emacs-load-user-init "post-init.el")

(provide 'init)

;;; post-init.el --- Post Init -- no-byte-compile: t; lexical-binding: t; -- And ~/.emacs.d/post-init.el:

;;; post-init.el --- Post Init -*- no-byte-compile: t; lexical-binding: t; -*-

(use-package minions
  :ensure t
  :straight (minions
             :type git
             :host github
             :repo "tarsius/minions"))

(provide 'post-init)

And pre-init.el:

;;; pre-init.el --- Pre Init -*- no-byte-compile: t; lexical-binding: t; -*-
;; Straight bootstrap
(setq package-enable-at-startup nil)
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        (or (bound-and-true-p straight-base-dir)
            user-emacs-directory)))
      (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(provide 'pre-init)

Please test the init files above and confirm whether the issue is the same.

jamescherti commented 3 weeks ago

In my case, the minions-mode issue occurs after enabling evil-mode. It works fine when Evil is not installed. Are you using evil-mode?

It does not seem to be a minimal-emacs.d issue. Please confirm.

linwaytin commented 3 weeks ago

I do use evil. After removing evil, manually turning on minions immediately takes effects. So I think that evil does affect the behavior, but maybe not the full story.

I also want to say that in my previous setup, which everything is included in an init.el file, evil and minions can exist together without problems.

jamescherti commented 3 weeks ago

Thank you for confirming that the issue only occurs when Evil mode is active. Your previous setup may have included a different version of Evil mode, minions, or another package, or different configuration option that did not cause the bug you are experiencing.