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

denote-link: delete-line is not known to be defined #2

Closed
kaushalmodi opened this issue Jun 8, 2022 · 5 comments
Closed

denote-link: delete-line is not known to be defined #2

kaushalmodi opened this issue Jun 8, 2022 · 5 comments

Comments

@kaushalmodi
Copy link
Contributor

When I try to compile denote-link.el (Emacs 28.1.50), I get this warning

In end of data:
denote-link.el:136:12: Warning: the function ‘delete-line’ is not known to be
defined.

@kaushalmodi kaushalmodi changed the title delete-line is not known to be defined denote-link: delete-line is not known to be defined Jun 8, 2022
@protesilaos
Copy link
Owner

protesilaos commented Jun 8, 2022

Oh, sorry about that @kaushalmodi. The compiler does not issue a warning about it.

How about this?

(defun denote-link-clear-stale-backlinks ()
  "Delete backlinks that no longer point to files."
  (interactive)
  (let ((default-directory (denote-directory)))
    (save-excursion
      (goto-char (point-min))
      (when (re-search-forward denote-link-backlink-heading nil t)
        (while (re-search-forward denote-link--backlink-regexp nil t)
          (unless (file-exists-p (match-string-no-properties 1))
            ;; (delete-line)
            (delete-region (point-at-bol) (point-at-bol 2))))))))

EDIT: reformat code block.

@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Jun 8, 2022

The compiler does not issue a warning about it.

What emacs version are you running?

I found this because I was byte-compiling each file in this repo. All files compiled clean except for denote-link.el. I was running M-x byte-compile-file in each .el buffer.

How about this?

(delete-region (point-at-bol) (point-at-bol 2))

👍 That compiles cleanly. Thanks!

protesilaos added a commit that referenced this issue Jun 8, 2022
The latter requires 'subr'.

Thanks to Kaushal Modi for reporting the bug in issue 2 over at the
GitHub mirror: <#2>.
@protesilaos
Copy link
Owner

What emacs version are you running?

Emacs 29.

+1 That compiles cleanly. Thanks!

Very well! Pushed the change per commit 0e65f05

@kaushalmodi
Copy link
Contributor Author

Emacs 29.

Of course! delete-line was added only about 4 months back: https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=53da8c50fca98b5a7d0418f6030181df50af8876

@protesilaos
Copy link
Owner

Gotcha!

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