Code Monkey home page Code Monkey logo

Comments (11)

EFLS avatar EFLS commented on June 16, 2024 2

I don't get what's happening here, as it looks like deft is called with the correct search string, i.e. the note's ID.

In any case, I noticed there are some issues with zetteldeft-avy-file-search. It relies on avy-goto-char while it might be better to use avy-jump.

I've tried [[ as link indicator and it seems to work. Can you try to override zetteldeft-avy-file-search with the code below and see whether it helps?

(defun zetteldeft-avy-file-search (&optional otherWindow)
  "Use `avy' to follow a zetteldeft link.
  Links are found via `zetteldeft-link-indicator'
  Open that file (in another window if OTHERWINDOW)."
    (interactive)
    (unless zetteldeft-link-indicator
      (user-error "Zetteldeft avy functions won't work when `zetteldeft-link-indicator' is nil"))
    (save-excursion
      (when (consp (avy-jump (concat
              zetteldeft-link-indicator zetteldeft-id-regex)))
        (zetteldeft--search-filename
          (zetteldeft--lift-id (zetteldeft--get-thing-at-point)) otherWindow))))

from zetteldeft.

avggeek avatar avggeek commented on June 16, 2024

Further investigation:

  • I modified zetteldeft-link-indicator to be a single character $ using (setq zetteldeft-link-indicator "$")
  • Disable function overrides for zetteldeft-find-file-id-insert / zetteldeft-find-file-full-title-insert

Observed behaviour:

  • zetteldeft-follow-link now works with a Zettel link in the form $2020-04-12-1600 foobar or $2020-04-12-1600

Question:

  • The function zetteldeft--get-thing-at-point states that it does recognize links between brackets (https://github.com/EFLS/zetteldeft/blob/master/zetteldeft.el#L78) and I can verify that link-builder-re does recognize [[2020-04-12-1600 foobar]]. However, the function zetteldeft-follow-link still does not follow the link. Can anyone offer any ideas?

from zetteldeft.

EFLS avatar EFLS commented on June 16, 2024

I'll have to look into it. This is a good opportunity to further work on Markdown-styled zettelkasten like The Archive. I haven't used it with [[ links myself.

Unfortunately, I'm busy with other work right now, but I'll see what I can do.

from zetteldeft.

EFLS avatar EFLS commented on June 16, 2024

A quick remark: zetteldeft-follow-link and zetteldeft-avy-file-search concatenate the zetteldeft-link-indicator and the zetteldeft-id-regex to generate a string, which serves as the regular expression that avy then tries to look for.

Now it could be that using [[ as link indicator results in a problematic regular expression... Not sure yet what to do about this, but it might be the cause.

from zetteldeft.

avggeek avatar avggeek commented on June 16, 2024

A quick remark: zetteldeft-follow-link and zetteldeft-avy-file-search concatenate the zetteldeft-link-indicator and the zetteldeft-id-regex to generate a string, which serves as the regular expression that avy then tries to look for.

Now it could be that using [[ as link indicator results in a problematic regular expression... Not sure yet what to do about this, but it might be the cause.

@EFLS Iā€™m happy to try and debug this further to help narrow down the source of the issue, if you can point me to some good articles on Emacs debugging. Like I said at the start, Emacs newb here šŸ™‚

from zetteldeft.

EFLS avatar EFLS commented on June 16, 2024

@avggeek Unfortunately, I'm far from an elisp expert myself, and one of the things I don't know much about is debugging something like this... I hope someone else can maybe make a suggestion on how to go about this.

What I usually do, is try and overwrite the existing defuns with something else and see what works :) Maybe try and overwrite the zetteldeft-avy-file-search function to use a different regular expression (one that matches your setup) and see how that works.

from zetteldeft.

avggeek avatar avggeek commented on June 16, 2024

@EFLS Yeah I noticed that @mclearc used a different function avy-goto-char-2 in his comment here (#4 (comment)) so let me see if create some other overrides as well.

from zetteldeft.

avggeek avatar avggeek commented on June 16, 2024

After turning on debug-on-entry and stepping through the code, it seems like the issue is not with zetteldeft-follow-link and zetteldeft-avy-file-search, but rather with the call to deft-filter.
emacs_owQ3Qn28ay

from zetteldeft.

avggeek avatar avggeek commented on June 16, 2024

I don't get what's happening here, as it looks like deft is called with the correct search string, i.e. the note's ID.

In any case, I noticed there are some issues with zetteldeft-avy-file-search. It relies on avy-goto-char while it might be better to use avy-jump.

I've tried [[ as link indicator and it seems to work. Can you try to override zetteldeft-avy-file-search with the code below and see whether it helps?

@EFLS I'm happy to report that the function you have provided does indeed fix the issue! In fact, not only does zetteldeft-avy-file-search work now but I'm now able to use zetteldeft-follow-link correctly as well. Thank you so much for taking the time to help me fix this despite your busy schedule!

from zetteldeft.

EFLS avatar EFLS commented on June 16, 2024

Thank you so much for taking the time to help me fix this despite your busy schedule!

Selectively procrastinating is a productivity trick šŸ˜„

The updated version will be part of the default code soon.

from zetteldeft.

avggeek avatar avggeek commented on June 16, 2024

Selectively procrastinating is a productivity trick šŸ˜„

The updated version will be part of the default code soon.

Hi @EFLS I can confirm the newest version of the package does fix the issue without needing any overrides. So closing this issue - thank you again for the help!

from zetteldeft.

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.