emacs-devel
[Top][All Lists]
Advanced

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

Issue or feature?


From: Ergus
Subject: Issue or feature?
Date: Thu, 24 Dec 2020 04:05:49 +0100

Hi I have observed something that IMO is an unintended behavior.

I have more or less this code in my init:

```
(add-hook 'prog-mode-hook (lambda ()
                               (run-with-idle-timer 1 nil #'flycheck-mode 1)))

...

(add-hook 'prog-mode-hook (lambda ()
                               (run-with-idle-timer 1 nil 
#'turn-on-diff-hl-mode)))
```

Both functions: flycheck-mode and turn-on-diff-hl-mode seems to call
some external commands (ispell and git)

but then I get an error when debugging:

```
Debugger entered--Lisp error: (error "Failed (status 128): git --no-pager diff-index 
--e...")
  signal(error ("Failed (status 128): git --no-pager diff-index --e..."))
  error("Failed (%s): %s" "status 128" "git --no-pager diff-index --exit-code -U0 -p 
4b825...")
  vc-do-command(" *diff-hl* " 1 "git" ("/home/ergo/.emacs.d/init.el") "--no-pager" "diff-index" "--exit-code" 
"-U0" "-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--")
  apply(vc-do-command " *diff-hl* " 1 "git" ("/home/ergo/.emacs.d/init.el") ("--no-pager" "diff-index" "--exit-code" 
"-U0" "-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--"))
  vc-git-command(" *diff-hl* " 1 ("/home/ergo/.emacs.d/init.el") "diff-index" "--exit-code" "-U0" 
"-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--")
  apply(vc-git-command " *diff-hl* " 1 ("/home/ergo/.emacs.d/init.el") "diff-index" "--exit-code" ("-U0" 
"-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--"))
  vc-git-diff(("/home/ergo/.emacs.d/init.el") "4b825dc642cb6eb9a060e54bf8d69288fbee4904" 
nil " *diff-hl* ")
  apply(vc-git-diff (("/home/ergo/.emacs.d/init.el") 
"4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* "))
  vc-call-backend(Git diff ("/home/ergo/.emacs.d/init.el") 
"4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* ")
  diff-hl-changes-buffer("/home/ergo/.emacs.d/init.el" Git)
  diff-hl-changes()
  diff-hl-update()
  diff-hl-margin-mode(1)
  (if (display-graphic-p) nil (diff-hl-margin-mode 1))
  (unless (display-graphic-p) (diff-hl-margin-mode 1))
  (progn (turn-on-diff-hl-mode) (unless (display-graphic-p) 
(diff-hl-margin-mode 1)))
  (if (or (and buffer-file-name (not (file-remote-p buffer-file-name))) (eq 
major-mode 'vc-dir-mode)) (progn (turn-on-diff-hl-mode) (unless 
(display-graphic-p) (diff-hl-margin-mode 1))))
  (when (or (and buffer-file-name (not (file-remote-p buffer-file-name))) (eq 
major-mode 'vc-dir-mode)) (turn-on-diff-hl-mode) (unless (display-graphic-p) 
(diff-hl-margin-mode 1)))
  my/diff-hl-mode()
  apply(my/diff-hl-mode nil)
  timer-event-handler([t 0 1 0 nil my/diff-hl-mode nil idle 0])
  input-pending-p(t)
  sit-for(0)
  ispell-init-process()
  ispell-buffer-local-words()
  ispell-accept-buffer-local-defs()
  flyspell-accept-buffer-local-defs(force)
  flyspell-mode-on(nil)
  flyspell-mode(1)
  flyspell-prog-mode()
  apply(flyspell-prog-mode nil)
  timer-event-handler([t 0 1 0 nil flyspell-prog-mode nil idle 0])
```

When I set different delays to the timers the error disappears.

I have 5 different similar hooks:

```
C-h v prog-mode-hook

((lambda nil
   (run-with-idle-timer 1 nil #'flycheck-mode 1))
 (lambda nil
   (run-with-idle-timer 1 nil #'company-mode 1))
 (lambda nil
   (run-with-idle-timer 1 nil #'flyspell-prog-mode))
 (lambda nil
   (run-with-idle-timer 1 nil #'diff-hl-mode 1))
 (lambda nil
   (electric-pair-local-mode 1)))
```

But the problem seems to be related with the ones that start external
processes only.

I know how to fix his in my config, but I am wondering if this is a
limitation for run-with-idle-timer? Or if such behavior needs to be (or
is already) documented?

Best,
Ergus


reply via email to

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