0

I am using my-run-latex () function (explained here: How can I run additonal linux commands after compiling a latex file) after each save, which I do very often.

I bound it to: (add-hook 'LaTeX-mode-hook (λ () (local-set-key (kbd "C-x C-s") 'my-run-latex))).

I observe than after enter C-x C-s, remove my finger from s, continue to press Ctrl and switch into press n (final comman will be C-n), once in a while instead of moving line below it shows nnnnnn in the buffer.

What could be the main reason for this? Does pdf compilation at the background cause this? Is there any way to prevent this behavior?

6
  • Unclear: what does ibuffer-mode-map have to do with pressing C-x C-s or C-n in LaTeX-mode?
    – NickD
    Sep 26, 2022 at 14:39
  • sorry ibuffer-mode-map has nothing to do with this, removed from question
    – alper
    Sep 26, 2022 at 14:54
  • When this happens do M-x view-lossage and go to the bottom of buffer and see what emacs is doing (or what your fingers are doing without your brain's approval) ...
    – user31220
    Sep 26, 2022 at 16:02
  • @whitetrillium I will M-x view-lossage and try to get some clue, but I am pretty sure my finger continues to press Ctrl during this happens , but emacs assumes I don't
    – alper
    Sep 26, 2022 at 16:11
  • Sounds like your keyboard or whatever is dropping the Control modifier key and thinking you're only holding down n.
    – Drew
    Sep 26, 2022 at 16:12

1 Answer 1

1

From the @lawlist's comment I believe I find a lead to cause of the problem I was having.

Link: https://stackoverflow.com/q/51907085/2402577

Garbage collection is generally a necessary evil, and can cause a noticeable pause; e.g., when holding down the arrow-key and moving left/right rapidly.


I had following lines in my config:

(add-hook 'after-init-hook
          `(lambda ()
             (setq gc-cons-threshold 402653184
                   gc-cons-percentage 0.6)
             (garbage-collect)) t)

(add-hook 'emacs-startup-hook  ;; Profile emacs startup
          (lambda ()
            (message "*** Emacs loaded in %s with %d garbage collections."
                     (format "%.2f seconds"
                             (float-time
                              (time-subtract after-init-time before-init-time)))
                     gcs-done)))

I have messed up gc-cons-threshold or gc-cons-percentage. Removing those line seems like solved the pause and drop of the Control modifier key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.