Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README feedback #12

Closed
kaushalmodi opened this issue Jun 11, 2022 · 4 comments
Closed

README feedback #12

kaushalmodi opened this issue Jun 11, 2022 · 4 comments

Comments

@kaushalmodi
Copy link
Contributor

Consider the case where the alternative notes in the blog have no use for the identifier field inside the front matter. Let’s omit it

Is it safe to suggest that? Some user might do that and then wonder whey denote-link doesn't work.

Additionally, if there is no identifier match, denote-link throws an error with backtrace i.e. it's not an elegant user-error.

@protesilaos
Copy link
Owner

Some user might do that and then wonder whey denote-link doesn't
work.

True. Will remove this part.

Additionally, if there is no identifier match, denote-link throws an
error with backtrace i.e. it's not an elegant user-error.

Better fix this then to fail gracefully. I will most likely not be able
to do this right now, as I am about to go bed. Tomorrow for sure!

protesilaos added a commit that referenced this issue Jun 12, 2022
Thanks to Kaushal Modi for the feedback in issue 12 over at the GitHub
mirror: <#12>.
protesilaos added a commit that referenced this issue Jun 12, 2022
This should fix the error reported by Kaushal Modi in issue 12:
<#12>.
@protesilaos
Copy link
Owner

Better fix this then to fail gracefully. I will most likely not be able to do this right now, as I am about to go bed. Tomorrow for sure!

I believe I fixed this while also moving the relevant code to its own file instead of keeping it in denote-link.el. The relevant part:

(defun denote-retrieve--search (regexp)
  "Search for REGEXP in the current buffer."
  (save-excursion
    (save-restriction
      (widen)
      (goto-char (point-min))
      (re-search-forward regexp nil t 1)
      (match-string-no-properties 1))))

(defun denote-retrieve--find-value (regexp)
  "Return value from REGEXP by searching the file."
  (or (denote-retrieve--search regexp)
      (user-error "Cannot retrieve %s" regexp)))

@kaushalmodi
Copy link
Contributor Author

Thanks! I'll close this issue then.

@protesilaos
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants