Giter VIP home page Giter VIP logo

Comments (12)

malb avatar malb commented on July 28, 2024 4

FWIW this does the trick for me.

(defun deft-parse-summary (contents title)
  "Parse the file CONTENTS, given the TITLE, and extract a summary.
The summary is a string extracted from the contents following the
title."
  (let* ((summary (let ((case-fold-search nil))
                    (replace-regexp-in-string deft-strip-summary-regexp " " contents)))
         (summary-processed (deft-chomp
                              (if (and title
                                       (not deft-use-filename-as-title)
                                       (string-match (regexp-quote
                                                      (if deft-org-mode-title-prefix
                                                          (concat "^#+TITLE: " title)
                                                        title))
                                                     summary))
                                  (substring summary (match-end 0) nil)
                                summary))))
    (substring summary-processed 0 (min 512 (string-width summary-processed)))))

from deft.

shouya avatar shouya commented on July 28, 2024 1

Unfortunately, because I have too many documents @malb's solution still takes too long for the initialization to finish.

Here's my workaround that simply shows the filename as the summary. It's uglier compared to before, but at least now deft shows up instantly.

  (defun deft-parse-summary (contents title) title)

from deft.

pheraph avatar pheraph commented on July 28, 2024 1

I also had slow response times after beginning a search, but had issues with @malb's code (argument out of range). After shortening the result everything works fine and fast:

... (substring summary-processed 0 (min 120 (string-width summary-processed)))))

from deft.

tea4or2wo avatar tea4or2wo commented on July 28, 2024

I confirm this behavior (tried with 0.8 and latest build) on:

GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10) of 2021-05-29

with no supplementary clue though.

PS. See https://www.reddit.com/r/emacs/comments/nnk2im/can_someone_help_me_debug_emacs_freezing_in_some/ and https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-05/msg02244.html

from deft.

flaggerkatt avatar flaggerkatt commented on July 28, 2024

Can confirm the same issue on emacs28, native-comp on Mac. This wasn't an issue before going native-comp.
Initializing deft takes a long time, I can then scroll down note entries and open them quickly, but the moment I try to enter anything to search, emacs basically freezes up. I don't even have that many entries; I just recently started using deft.

GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.50 Version 11.5 (Build 20G5023d)) of 2021-06-01

Ed: One thing has changed since yesterday - I updated to MacOS 12 beta. Maybe rebuild emacs to see if error persists?

from deft.

flaggerkatt avatar flaggerkatt commented on July 28, 2024

Ed: One thing has changed since yesterday - I updated to MacOS 12 beta. Maybe rebuild emacs to see if error persists?

This was, not surprisingly, a very bad idea. Now fighting dependency hell on a system not actually supported by homebrew.

from deft.

Nathan-Furnal avatar Nathan-Furnal commented on July 28, 2024

This has been fixed at least on my build, I rebuilt emacs from source today. Can anyone else confirm? Maybe @tea4or2wo ?

from deft.

malb avatar malb commented on July 28, 2024

On my end, it's better but not resolved. That is, Deft now loads but responding to a key press when searching takes about a second. From my - amateur! - perspective, I think the solution is to also cache the length of the summary and to use that.

from deft.

skrytebane avatar skrytebane commented on July 28, 2024

I also saw this with native-comp on Linux, built about a month ago. Newer version built just now (124ba9db96ff7c30963a6c2d44279ed66fc3284d) seems to work fine.

from deft.

Nathan-Furnal avatar Nathan-Furnal commented on July 28, 2024

I tried it again and it's actually not really fixed, it's still slow.

from deft.

lmmrs avatar lmmrs commented on July 28, 2024

I had the same problem. Very annoying. After a long search I then found that I had caused this by changing the deft-extensions parameter.

deft-extensions '("org" "bib" "md" "org_archive" "RData" "lyx" "mm" "mom" "ms" "sty" "tex" "txt")

The "RData" was the problem. The '.RData-files are gzip files. And it doesn't get any better in unzipped form. Very many '\0' in it.

I took out the extension and now it works fine. Maybe you have a similar problem?

from deft.

jpggithub avatar jpggithub commented on July 28, 2024

I have also the same problem, Deft is slow before to show the results when I strike some keys.

GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) of 2023-05-14
Debian trixie (testing)
Deft 20210707.1633 (MELPA)

EDIT: the tricks of @malb works well for me. Thank you!

from deft.

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.