Coder Social home page Coder Social logo

Comments (10)

seagle0128 avatar seagle0128 commented on July 17, 2024 3

Recently I rewrote the codes of buffer info, and the performance is much better than before, especially for remote files. Please update and try the fancy styles.

truncate-upto-project
truncate-from-project
truncate-with-project
truncate-except-project

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024 2

Thanks for the information!

I checked your Emacs configurations, and recreated this issue locally. I believe the root cause is projectile. refer to bbatsov/projectile#657. I think the configuration could fix this issue in this case: (setq doom-modeline-buffer-file-name-style 'file-name). Please try.

from doom-modeline.

PavelNovichkov avatar PavelNovichkov commented on July 17, 2024 1

It seems that the project root is always the same for a given buffer, so do we really need to call projectile-project-root on every motion? I use the following code to cache the value, I think it fixes the issue:

(defun my-cache-project-root (orig-fn &rest args)
  (if (local-variable-p 'my-project-root)
      my-project-root
    (setq-local my-project-root (apply orig-fn args))))
(advice-add 'doom-modeline-project-root :around #'my-cache-project-root)

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

Hello, based on the information, it's really hard to dig out the root cause.
Would you please provide more details?

  1. OS
  2. Emacs version
  3. doom-modeline version
  4. Emacs configurations
  5. what files? It's better provide the examples with address and credential.
  6. other clues

My guess is the remote files may be not in the project or vcs, but not 100% sure. Need more information to troubleshooting.

from doom-modeline.

bramboomen avatar bramboomen commented on July 17, 2024

Of course:

  1. The issue occurs when accessing a raspberry pi (raspbian jessie) over ssh from both a pc (arch linux) and a laptop (ubuntu), as well as when accessing the pc over ssh from the laptop.
  2. Emacs version 26.1
  3. Doom-modeline version 20181001.1514 from melpa
  4. My current emacs init
  5. Any file I access over /ssh:pilocal:/path/to/file
  6. Because you suggested that the problem might be with projects or vcs I decided to open a file in a folder with a git repository, and to my surprise, the lag went away! I don't think I would have thought to test this myself, and being quite inexperienced at emacs I also don't know how to fix it...

from doom-modeline.

bramboomen avatar bramboomen commented on July 17, 2024

That indeed fixed the issue. I did come across the projectile bug, but didn't think it affected me because the issue persisted when projectile-mode was off.

Thanks for your support and your work!

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

Welcome! Glad to know the issue has been fixed.
I am considering to add this to FAQ.

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

@envypole It's a good idea to optimize the performance. I'll try to merge although it should be in projectile IMO.

from doom-modeline.

ashiklom avatar ashiklom commented on July 17, 2024

I am still hitting this issue while editing remote files, even with the new truncate-*-project settings. Removing the update-buffer-file-name hook makes the issue go away.

(add-hook 'after-change-functions #'doom-modeline-update-buffer-file-name)

Is it really necessary to update the buffer file name after every change? Perhaps this could be controlled by a user-facing variable?

See below for a sample profile of a typical editing session. Note that almost all of the CPU time for self-insert-command is eaten up by doom-modeline-update-buffer-file-name.

   - self-insert-command                                           58  17%
    - doom-modeline-update-buffer-file-name                        56  17%
     - doom-modeline-buffer-file-name                              56  17%
      - doom-modeline--buffer-file-name                            41  12%
       + file-relative-name                                        28   8%
       + file-local-name                                            1   0%
      + file-local-name                                            14   4%
    + doom-modeline-update-buffer-file-state-icon                   1   0%
    + electric-pair-post-self-insert-function                       1   0%

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

@ashiklom You are right! It's for updating the modified status after changing the buffer. It works well for the local files but I have to agree it can be optimized.

Updated: I committed a change to optimize it.

from doom-modeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.