abougouffa / minemacs

MinEmacs: an Emacs configuration framework for daily use
https://abougouffa.github.io/minemacs/
MIT License
132 stars 17 forks source link

[BUG] Not Loading config.el file #129

Closed Game-Warrior closed 7 months ago

Game-Warrior commented 7 months ago

Describe the bug I have been trying to use config files for minEmacs but no matter where I put them it doesn't seem to load them. I have tried .minemacs.d, ~/.config.minemacs, and exporting it as a environment variable in my .zshrc.

Emacs version

GNU Emacs 29.1 (build 2, aarch64-apple-darwin23.1.0, NS appkit-2487.20 Version 14.1 (Build 23B74)) of 2023-11-13

Checkup list

I tried this but it produced the same result as when I launch Emacs normally.

To Reproduce Steps to reproduce the behavior:

  1. Open Emacs.

Expected behavior I would expect it to evaluate my config file.

Backtrace

Debugger entered--Lisp error: (error "Eager macro-expansion failure: (file-missing \"Open...")
  error("Eager macro-expansion failure: %S" (file-missing "Opening directory" "No such file or directory" "/Users/gb/.emacs.d/local/parinfer-rust"))
  internal-macroexpand-for-load((use-package parinfer-rust-mode :straight t :when (and (+emacs-features-p 'modules) (or (eq sys/arch 'x86_64) (directory-files +parinfer-rust-path nil (format "\\.%s$" (if os/win "dll" "so"))))) :custom (parinfer-rust-library-directory +parinfer-rust-path) (parinfer-rust-auto-download (eq sys/arch 'x86_64)) :hook (emacs-lisp-mode clojure-mode scheme-mode lisp-mode racket-mode hy-mode) :config (defvar-local +parinter-rust--was-enabled-p nil) (defun +parinter-rust--restore-a (&rest _) (when +parinter-rust--was-enabled-p (setq +parinter-rust--was-enabled-p nil) (parinfer-rust-mode 1))) (defun +parinter-rust--disable-a (&rest _) (if (and (bound-and-true-p parinfer-rust-mode) (bound-and-true-p parinfer-rust-enabled)) (progn (setq +parinter-rust--was-enabled-p t) (parinfer-rust-mode -1)) (setq +parinter-rust--was-enabled-p nil))) (dolist (cmd '(evil-shift-right)) (advice-add cmd :before #'+parinter-rust--disable-a) (advice-add cmd :after #'+parinter-rust--restore-a))) nil)
  load-with-code-conversion("/Users/gb/.emacs.d/modules/me-emacs-lisp.el" "/Users/gb/.emacs.d/modules/me-emacs-lisp.el" nil nil)
  load("/Users/gb/.emacs.d/modules/me-emacs-lisp.el" nil nil)
  (if (file-exists-p filename) (load filename nil (not minemacs-verbose-p)) (message "[MinEmacs:Error] Cannot load \"%s\", the file doesn'..." filename))
  (let ((filename (file-truename (apply #'concat filename-parts)))) (if (file-exists-p filename) (load filename nil (not minemacs-verbose-p)) (message "[MinEmacs:Error] Cannot load \"%s\", the file doesn'..." filename)))
  +load("~/.emacs.d/modules/me-emacs-lisp.el")
  (let ((module-file (car tail))) (+load module-file) (setq tail (cdr tail)))
  (while tail (let ((module-file (car tail))) (+load module-file) (setq tail (cdr tail))))
  (let ((tail (append (mapcar (apply-partially #'format "%s%s.el" minemacs-core-dir) minemacs-core-modules) (mapcar (apply-partially #'format "%s%s.el" minemacs-modules-dir) minemacs-modules)))) (while tail (let ((module-file (car tail))) (+load module-file) (setq tail (cdr tail)))))
  load-with-code-conversion("/Users/gb/.emacs.d/init.el" "/Users/gb/.emacs.d/init.el" t t)
  load("/Users/gb/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x155cdccd2693d5>) #f(compiled-function () #<bytecode -0x1f3c61addc0d85b5>) t)
  command-line()
  normal-top-level()

Additional context I also get this error on startup I have no idea if this is relevant.


treesit-fold: no available parser for the current buffer. [10 times]

When I open the buffer and run buffer eval it works just fine. But it doesn't do so automatically.

Any way I would really appreciate your help. I like this project a lot.

Game-Warrior commented 7 months ago

Here is my Config


;;; config.el -*- lexical-binding: t; -*-

;; Copyright (C) 2022-2023 Abdelhak Bougouffa

;; Personal info
(setq user-full-name "My Name"
      user-mail-address "my email")

;; Set the default GPG key ID, see "gpg --list-secret-keys"
;; (setq-default epa-file-encrypt-to '("XXXX"))

;; Set a theme for MinEmacs, supported themes include these from `doom-themes'
;; or built-in themes
(setq minemacs-theme 'doom-solarized-dark) ; `doom-one' is a dark theme, `doom-one-light' is the light one
(+load-theme)

;; MinEmacs defines the variable `minemacs-fonts-plist' that is used by the
;; `+setup-fonts' function. The function checks and enables the first available
;; font from these defined in `minemacs-fonts-plist'. This variable can be
;; customized to set font specs for specific Emacs faces or to enable some
;; language-specific fonts.

(+setup-fonts)
;; You can set a list of fonts to be used, like the snippet below. The first
;; font found on the system will be used:
(plist-put minemacs-fonts-plist
           :default ;; <- applies to the `default' face usig `custom-theme-set-faces'
           '((:family "JulaMono" :height 130) ; <- priority 1
             (:family "JetBrains Mono" :height 110 :weight light) ; <- priority 2
             (:family "Cascadia Code" :height 120 :weight semi-light))) ; <- priority 3

;; To set font for arbitrary Emacs face, you need just to write the face name as
;; a keyword. For example `variable-pitch' -> `:variable-pitch':
(plist-put minemacs-fonts-plist
           :variable-pitch ;; <- applies to the `variable-pitch' face usig `custom-theme-set-faces'
           '("Lato"
             "Roboto"
             "Inter"
             "Helvetica"))

;; For example to set custom font for `mode-line' -> `:mode-line':
(plist-put minemacs-fonts-plist
           :mode-line ;; <- applies to the `mode-line' face usig `custom-theme-set-faces'
           '((:family "Lato" :weight regular)
             (:family "Roboto" :weight light)))

(plist-put minemacs-fonts-plist
           :mode-line-inactive ;; <- applies to the `mode-line-inactive'
           '((:family "Lato" :weight regular)
             (:family "Roboto" :weight light)))

;; You can also setup some language-specific fonts. For example, to use "Amiri"
;; or "KacstOne" for Arabic script (the first to be found). All scripts
;; supported by Emacs can be found in `+known-scripts'. The value of the extra
;; `:prepend' is passed the last argument to `set-fontset-font'. The extra
;; `:scale' parameter can be used to set a scaling factor for the font in Emacs'
;; `face-font-rescale-alist'.
(plist-put minemacs-fonts-plist
           :arabic ;; <- applies to arabic script using `set-fontset-font'
           '((:family "Amiri" :scale 0.9)
             (:family "KacstOne")))

;; Use "LXGW WenKai Mono" for Han (Chinese) script
(plist-put minemacs-fonts-plist
           :han
           '((:family "LXGW WenKai Mono" :scale 1.3)))

;; When `me-daemon' and `me-email' are enabled, MinEmacs will try to start
;; `mu4e' in background at startup. To disable this behavior, you can set
;; `+mu4e-auto-start' to nil here.
;; (setq +mu4e-auto-start nil)

(+deferred!
 ;; Auto enable Eglot in modes `+eglot-auto-enable-modes' using
 ;; `+eglot-auto-enable' (from the `me-prog' module). You can use
 ;; `+lsp-auto-enable' instead to automatically enable LSP mode in supported
 ;; modes (from the `me-lsp' module).
 (+eglot-auto-enable)

 ;; Add `ocaml-mode' to `eglot' auto-enable modes
 (add-to-list '+eglot-auto-enable-modes 'ocaml-mode)

 (with-eval-after-load 'eglot
   ;; You can use this to fill `+eglot-auto-enable-modes' with all supported
   ;; modes from `eglot-server-programs'
   (+eglot-use-on-all-supported-modes eglot-server-programs)))

;; If you installed Emacs from source, you can add the source code
;; directory to enable jumping to symbols defined in Emacs' C code.
;; (setq source-directory "~/Sources/emacs-git/")

;; I use Brave, and never use Chrome, so I replace chrome program with "brave"
(setq browse-url-browser-function 'browse-url-default-browser)

;; Install some third-party packages. MinEmacs uses `use-package' and `straight'
;; for package management. It is recommended to use the same to install
;; additional packages. For example, to install `devdocs' you can use something
;; like:
(use-package devdocs
  ;; The installation recipe (from Github)
  :straight (:host github :repo "astoff/devdocs.el" :files ("*.el"))
  ;; Autoload the package when invoking these commands, note that if the
  ;; commands are already autoloaded (defined with `autoload'), this is not
  ;; needed.
  :commands devdocs-install
  ;; MinEmacs sets the `use-package-always-defer' to t, so by default, packages
  ;; are deferred to save startup time. If you want to load a package
  ;; immediately, you need to explicitly use `:demand t'.
  ;; :demand t
  ;; Set some custom variables, using the `:custom' block is recommended over
  ;; using `setq'. This will ensure calling the right setter function if it is
  ;; defined for the custom variable.
  :custom
  (devdocs-data-dir (concat minemacs-local-dir "devdocs/")))

;; Module: `me-tools' -- Package: `vterm'
;; When the libvterm present in the system is too old, you can face VTERM_COLOR
;; related compilation errors. Thil parameter tells `vterm' to download libvterm
;; for you, see the FAQ at: github.com/akermu/emacs-libvterm.
;; (with-eval-after-load 'vterm
;;   (setq vterm-module-cmake-args "-DUSE_SYSTEM_LIBVTERM=Off"))

;; Module: `me-natural-langs' -- Package: `spell-fu'
(with-eval-after-load 'spell-fu
  ;; We can use MinEmacs' helper macro `+spell-fu-register-dictionaries!'
  ;; to enable multi-language spell checking.
  (+spell-fu-register-dictionaries! "en" "fr"))

;; Module: `me-rss' -- Package: `elfeed'
(with-eval-after-load 'elfeed
  ;; Add news feeds for `elfeed'
  (setq elfeed-feeds
        '(
          ;; General
          ("https://frame.work/blog.rss" Framework)
          ("https://factorio.com/blog/rss" Factorio)
          ("https://news.nononsenseapps.com/index.atom" Feeder)
          ("https://kagifeedback.org/atom/t/release-notes" Kagi)
          ("https://news.play.date/index.xml" Playdate)
          ;; Linux
          ("https://blog.linuxmint.com/?feed=rss2" linux LinuxMint)
          ("https://archlinux.org/news/" linux Arch)
          ("https://fedoramagazine.org/feed/" linux Fedora)
          ("https://endeavouros.com/news/" linux EndeavourOS)
          ;; Boat Stuff
          ("https://buffalonickelblog.com/feed/" boat Buffalo-Nickel)
          ("https://mobius.world/feed/" boat Mobius)
          ("https://www.mvuglybetty.com/blog-feed.xml"boat Ugly-Betty)
           ;; Emacs
          ("http://xenodium.com/rss.xml" emacs Xenodium)
          ("https://cmdln.org/post/" emacs Commandline)
          ("https://karl-voit.at/feeds/lazyblorg-all.atom_1.0.links-and-content.xml" Karal-Voit emacs)
          ("https://systemcrafters.net/rss/news.xml" emacs SystemCrafter)
          ("https://sachachua.com/blog/feed/" emacs SachaChua)
          ("https://rostre.bearblog.dev/feed/?type=rss" emacs ParsingTime)
          ("https://200ok.ch/atom.xml" emacs 200ok)
          ("https://planet.emacslife.com/atom.xml" emacs PlanetEmacsLife)
          ;; News
          )))

;; Module: `me-email' -- Package: `mu4e'
(with-eval-after-load 'mu4e
  ;; Load personal aliases, a file containing aliases, for example:
  ;; alias gmail "Firstname Lastname <some.user.name@gmail.com>"
  ;; alias work  "Firstname Lastname <some.user.name@work.com>"

  ;; (setq mail-personal-alias-file (concat minemacs-config-dir "private/mail-aliases.mailrc"))

  (setq +mu4e-auto-bcc-address "always.bcc@this.email") ;; Add an email address always included as BCC

  ;; Register email accounts with mu4e
  ;; Use MinEmacs' `+mu4e-register-account' helper function to register multiple accounts
  (+mu4e-register-account
   "Google mail" ;; Account name
   "gmail" ;; Maildir
   `((user-mail-address     . "account1@gmail.com")
     (mu4e-sent-folder      . "/gmail/Sent Mail")
     (mu4e-drafts-folder    . "/gmail/Drafts")
     (mu4e-trash-folder     . "/gmail/Trash")
     ;; These settings aren't mandatory if a `msmtp' config is used.
     (smtpmail-smtp-server  . "smtp.googlemail.com")
     (smtpmail-smtp-service . 587)
     ;; Define account aliases
     (+mu4e-account-aliases . ("account1-alias@somesite.org"
                               "account1-alias@othersite.org"))
     ;; Org-msg greeting and signature
     (org-msg-greeting-fmt  . "Hi%s,")
     ;; Generate signature
     (org-msg-signature     . ,(+org-msg-make-signature
                                "Regards," ;; Closing phrase
                                "Firstname" ;; First name
                                "Lastname" ;; Last name
                                "/R&D Engineer at Some company/")))
   'default ;; Use it as default in a multi-accounts setting
   'gmail)) ;; This is a Gmail account, store it and treat it accordingly (see `me-mu4e-gmail')

;; Module: `me-org' -- Package: `org'
(with-eval-after-load 'org
  (setq org-directory "~/Documents/"
        ;; Set where org agenda get todos from
        org-agenda-files '("~/Documents/agenda.org" "~/Documents/To-Research.org" "~/Documents/inbox.org" "~/Documents/notes.org" "~/Documents/books.org")
        org-default-notes-file (expand-file-name "notes.org" org-directory)
        ;; Set where archive org-headings go
        org-archive-location "~/Documents/Archive/archive.org::"
        ;; Set org-ellipsis
        ;; org-ellipsis " ↴ "
        ;; org-ellipsis" ⤷ "
        org-ellipsis " ... "
        org-log-done 'time
        org-hide-emphasis-markers t
        ;; ex. of org-link-abbrev-alist in action
        ;; [[arch-wiki:Name_of_Page][Description]]
        org-link-abbrev-alist    ; This overwrites the default Doom org-link-abbrev-list
          '(("google" . "http://www.google.com/search?q=")
            ("arch-wiki" . "https://wiki.archlinux.org/index.php/")
            ("ddg" . "https://duckduckgo.com/?q=")
            ("wiki" . "https://en.wikipedia.org/wiki/"))
        org-table-convert-region-max-lines 20000
        org-todo-keywords        ; This overwrites the default Doom org-todo-keywords
          '((sequence
             "TODO(t)"           ; A task that is ready to be tackled
             "NEXT(n)"           ; This is for something that I am in the process of doing (for example reading a book)
             "WAIT(w)"           ; Something is holding up this task
             "|"                 ; The pipe necessary to separate "active" states and "inactive" states
             "DONE(d)"           ; Task has been completed
             "CANCELLED(c)" ))) ; Task has been cancelled
  )

(use-package org-superstar)
(setq
;; Setings for org-superstar
org-superstar-headline-bullets-list '("◉" "●" "○" "◆" "●" "○" "◆")
org-superstar-item-bullet-alist '((?- . ?➤) (?+ . ?✦)) ; changes +/- symbols in item lists
)
(eval-after-load 'org
(setq org-superstar 1)
  )

;; Module: `me-notes' -- Package: `denote'
(with-eval-after-load 'denote
  (setq denote-directory "~/Org/notes/"))

;; Module: `me-media' -- Package: `empv'
(with-eval-after-load 'empv
  ;; Set the radio channels, you can get streams from radio-browser.info
  (setq empv-radio-channels
        '(("El-Bahdja FM" . "http://webradio.tda.dz:8001/ElBahdja_64K.mp3")
          ("El-Chaabia" . "https://radio-dzair.net/proxy/chaabia?mp=/stream")
          ("Quran Radio" . "http://stream.radiojar.com/0tpy1h0kxtzuv")
          ("Algeria International" . "https://webradio.tda.dz/Internationale_64K.mp3")
          ("JOW Radio" . "https://str0.creacast.com/jowradio")
          ("Europe1" . "http://ais-live.cloud-services.paris:8000/europe1.mp3")
          ("France Iter" . "http://direct.franceinter.fr/live/franceinter-hifi.aac")
          ("France Info" . "http://direct.franceinfo.fr/live/franceinfo-hifi.aac")
          ("France Culture" . "http://icecast.radiofrance.fr/franceculture-hifi.aac")
          ("France Musique" . "http://icecast.radiofrance.fr/francemusique-hifi.aac")
          ("FIP" . "http://icecast.radiofrance.fr/fip-hifi.aac")
          ("Beur FM" . "http://broadcast.infomaniak.ch/beurfm-high.aac")
          ("Skyrock" . "http://icecast.skyrock.net/s/natio_mp3_128k"))
        ;; See: docs.invidious.io/instances/
        empv-invidious-instance "https://invidious.projectsegfau.lt/api/v1"))

;; Module: `me-ros' -- Package: `ros'
(with-eval-after-load 'ros
  (setq ros-workspaces
        (list
         (ros-dump-workspace
          :tramp-prefix "/docker:ros@ros-machine:"
          :workspace "~/ros_ws"
          :extends '("/opt/ros/noetic/"))
         (ros-dump-workspace
          :tramp-prefix "/docker:ros@ros-machine:"
          :workspace "~/ros2_ws"
          :extends '("/opt/ros/foxy/")))))

;; Module: `me-vc' -- Package: `forge'
(with-eval-after-load 'forge
  ;; To setup private Gitlab instance
  ;; 1. Add this to your ~/.gitconfig
  ;; [gitlab "gitlab.private.com/api/v4"]
  ;;   user = my.username
  ;; 2. Then create an access token on GitLab. I ticked api and write_repository, which seems to work fine so far. Put the token in ~/.authinfo.gpg
  ;; machine gitlab.private.com/api/v4 login my.user^forge password <token>
  ;; 3. Use this in your config:
  (add-to-list 'forge-alist '("gitlab.private.com" "gitlab.private.com/api/v4" "gitlab.private.com" forge-gitlab-repository)))

;; Module: `me-vc' -- Package: `jiralib2'
;; When `jiralib2' is enabled, do some extra stuff
(when (memq 'jiralib2 minemacs-configured-packages)
  ;; You need to set `jiralib2-url' and `jiralib2-user-login-name'
  (setq jiralib2-url "https://my-jira-server.tld/"
        jiralib2-user-login-name "my-username")

  ;; Add a hook on git-commit, so it adds the ticket number to the commit message
  (add-hook
   'git-commit-mode-hook
   (defun +jira-commit-auto-insert-ticket-id-h ()
     (when (and jiralib2-user-login-name
                ;; Do not auto insert if the commit message is not empty (ex. amend)
                (+first-line-empty-p))
       (goto-char (point-min))
       (insert "\n")
       (goto-char (point-min))
       (+jira-insert-ticket-id)
       (insert ": ")))))
abougouffa commented 7 months ago

Thank you for the feedback.

You've caught a pretty rare bug! The CI didn't catch it. It happens only on non-x86_64 targets (it seems that you are on an Apple M1/M2).

I've just pushed a fix for this. Please confirm if it solves your issue.

The treesit-fold: no available parser for the current buffer. [10 times] message is not harming, it is just an info message. However, I've disabled treesit-fold for the moment as it is in a too early dev stage (it is my fork to port of ts-fold to treesit, it is buggy ATM, and didn't get the time to dig deeper):

Please note also that the sample config.el is not intended to be used as it is. For example, it will beat you when you use Magit if you used it like this (the example of jiralib2 is specific to users using Jira to manage tickets).

Game-Warrior commented 7 months ago

Ok I have tested it and it and it works! Thank you so much for fixing this so quickly!

I also have my own literate config but I was trying to eliminate potential sources of errors.