emacscollective / borg

Assimilate Emacs packages as Git submodules
https://emacsmirror.net/manual/borg
GNU General Public License v3.0
259 stars 28 forks source link

Borg conflict with flymake-mode when editing init.el #140

Closed Eason0210 closed 1 year ago

Eason0210 commented 1 year ago

Hi @tarsius

I am using Borg with Emacs 29, but flymake-mode will trigger fatal error when editing my init.el file. I can't reproduce it with emacs -Q, and I reported this issue to Emacs two weeks ago , see the bug#60556

M-x emacs-version GNU Emacs 29.0.60 (build 1, x86_64-w64-mingw32, git sha1 d0d3451409) of 2023-01-20

Steps to reproduce the issue:

  1. Install Borg by emacs.g
cd ~/.config/
git clone https://github.com/emacscollective/emacs.g.git emacs
cd emacs 
# Need to edit the Makefile to use  main branch instead of master branch, this should also be fixed in emacs.g
# I need use HTTPS instead of SSH
git config --global url.https://github.com/.insteadOf git@github.com:
git config --global url.https://git.sr.ht/.insteadOf git@git.sr.ht:
make bootstrap-borg
make bootstrap
  1. Start Emacs normally with runemacs.exe
  2. M-x toggle-debug-on-error
  3. C-x C-f ~/.config/emacs/init.el, Open init file
  4. M-x flymake-mode, Enable flymake-mode
  5. M-x flymake-switch-to-log-buffer, Open the flymake-log buffer
  6. C-x 4 b init.el, switch to other window with init.el
  7. Add some new blank lines in the init.el and C-x C-ssave the init.el Now you will see the Warings in the *Flymake log* buffer:
    ■  Warning [flymake init.el]: Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)
    ■  Warning [elisp-mode init.el]: byte-compile process elisp-flymake-byte-compile obsolete
    ■  Warning [elisp-mode init.el]: byte-compile process elisp-flymake-byte-compile<1> obsolete
    ■  Warning [elisp-mode init.el]: byte-compile process elisp-flymake-byte-compile obsolete

In the *stderr of elisp-flymake-byte-compile* buffer, there are some errors as bellow:

Initializing drones...done (16 drones in 0.099s)
Initializing drones...done (16 drones in 0.100s)

Warning (initialization): Your `load-path' seems to contain
your `.emacs.d' directory: c:/Users/Eason/.config/emacs/
This is likely to cause problems...
Consider using a subdirectory instead, e.g.: c:/Users/Eason/.config/emacs/lisp

Process elisp-flymake-byte-compile stderr<1> finished

Process elisp-flymake-byte-compile stderr finished
Initializing drones...done (16 drones in 0.100s)

Warning (initialization): Your `load-path' seems to contain
your `.emacs.d' directory: c:/Users/Eason/.config/emacs/
This is likely to cause problems...
Consider using a subdirectory instead, e.g.: c:/Users/Eason/.config/emacs/lisp

Process elisp-flymake-byte-compile stderr finished

Sometime will popup and fatal error window as bellow. I also tried to use gdb to debug, see the report at bug#60556

image

tarsius commented 1 year ago

I can reproduce the "Your load-path seems to contain your .emacs.d directory" warning. Borg doesn't put that directory on the load-path as far as I can tell. If you figure out that it does in fact do so under certain circumstances, then I would like to hear about it. From the looks of it (as in, I haven't verified it), flymake uses in inferior emacs instance to do the compilation. Maybe it does that in a way that causes the user directory to be added to the load-path when used with Borg.

I am not interested in using flymake and do not have the time to investigate this further. Doing that would require learning about its internals, and I am even less interested in that. As far as I can tell, never having used flymake before, it work despite the warning about load-path; things that are wrong seem to get underlined with wiggly lines.

The fatal error hasn't occurred for me. Such an error is always considered a bug in Emacs, even if it is triggered by some third-party elisp, regardless of whether there is a bug in the elisp code too.

Eason0210 commented 1 year ago

I am not interested in using flymake and do not have the time to investigate this further. Doing that would require learning about its internals, and I am even less interested in that. As far as I can tell, never having used flymake before, it work despite the warning about load-path;

Truly understand that.

The fatal error hasn't occurred for me. Such an error is always considered a bug in Emacs, even if it is triggered by some third-party elisp, regardless of whether there is a bug in the elisp code too.

Agree. Maybe that is something wrong with the implementation for displaying on MS-Windows. I tried it on macOS, flymake works well with Borg, although there are "Your load-path seems to contain your .emacs.d directory" warning.

Meawhile, I tried to use flycheck instead of flymake, It works well with Borg. Recently I will switch to flycheckor just turn off flymake in my init.el file.

So, feel free to close this issue if you want to. Thanks for your advice!

Eason0210 commented 1 year ago

Hi @tarsius ,

I can reproduce the issue with emacs -Q now. So now I can confirm that the isse is not related to Borg. Need to use a larger buffer to reproduce, for example, I use the flmake.el instead.

Steps to reproduce:

  1. Start Emacs 29 with emacs -Q
  2. C-c C-f ~/test.el to open a test buffer.
  3. Copy all the content of flymake.elto ~/test.el
  4. Enable flymake-mode with M-x flymake-mode
  5. Try to add some blank lines and then C-x C-sto save buffer
  6. Repeat step 5 many times, you will get the fatal error window pops up. fatal-error-with emacs-q
Eli-Zaretskii commented 1 year ago

Please show the value of system-configuration-options inside the session of that Emacs 29.

Eason0210 commented 1 year ago

Hi @Eli-Zaretskii ,

The value of system-configuration-options is "--without-native-compilation --without-dbus"

More infomations with M-x report-emacs-bug:

In GNU Emacs 29.0.60 (build 1, x86_64-w64-mingw32) of 2023-01-20 built
 on DESKTOP-VIHXXXX
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Pro (v10.0.2009.19044.2486)

Configured using:
 'configure --without-native-compilation --without-dbus'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY
W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings:
  value of $LANG: CHS
  locale-coding-system: cp936

Major mode: ELisp/d

Minor modes in effect:
  flymake-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cl-print help-fns radix-tree noutline
outline pulse color jka-compr find-func xref cl-extra time-date subr-x
checkdoc lisp-mnt help-mode cl-macs cl-seq flymake-proc flymake project
byte-opt gv bytecomp byte-compile compile text-property-search comint
ansi-osc ansi-color ring warnings icons thingatpt cl-loaddefs cl-lib
china-util rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp
disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process emacs)

Memory information:
((conses 16 88530 19778)
 (symbols 48 9398 0)
 (strings 32 27858 2057)
 (string-bytes 1 821696)
 (vectors 16 22574)
 (vector-slots 8 1011934 144778)
 (floats 8 140 189)
 (intervals 56 3865 267)
 (buffers 984 17))
Eason0210 commented 1 year ago

This issue has been fixed on emacs-29 branch at the commit c854ef7a18

Thanks @Eli-Zaretskii for working on it.

Eason0210 commented 1 year ago

@tarsius

By the way, I also figure out that the "Your load-path seems to contain your .emacs.d directory" warning is cause by the variable elisp-flymake-byte-compile-load-path. Because it's default value is (list "./"), so when I edit the init.el , the current directory( ~/.config/emacs/ or ~/.emacs.d) is included to the load path for flyamke.

Just for your information.

tarsius commented 1 year ago

Thanks for letting me know. (This seems like something that should be fixed in flymake. Complaining about that directory being on the load-path is one thing. As is adding it to do the load-path. But adding it to the load-path and then also complaining about it... :grin: )

Eason0210 commented 1 year ago

Complaining about that directory being on the load-path is one thing. As is adding it to do the load-path. But adding it to the load-path and then also complaining about it... 😁 )

😁 Make sense! We should improve it before Emacs 29 release.

I have report an issue to Emacs at bug#61014