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

Fix: make C-c C-o recursively locate a .md file #590

Closed
wants to merge 3 commits into from

Conversation

srid
Copy link

@srid srid commented Jan 25, 2021

When configuring wiki-links to allow whitespace in filenames, there is a bug in C-c C-o not really locating files recursively.

Description

When using:

(use-package markdown-mode
  :config
  (setq markdown-enable-wiki-links t)
  (setq markdown-wiki-link-search-subdirectories t)
  (setq markdown-link-space-sub-char " "))

C-c C-o will bail out if the target exists in sub-directories.

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  substring(nil 0 0)
  replace-regexp-in-string("[[:space:]\n]" " " nil)
  markdown-convert-wiki-link-to-filename(nil)
  markdown-follow-wiki-link(nil nil)
  markdown-follow-wiki-link-at-point(nil)
  markdown-follow-thing-at-point(nil)
  funcall-interactively(markdown-follow-thing-at-point nil)
  call-interactively(markdown-follow-thing-at-point nil nil)
  command-execute(markdown-follow-thing-at-point)

Using save-match-data fixes that.

Related Issue

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing feature)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have updated the documentation in the README.md file if necessary.
  • I have added an entry to CHANGES.md.
  • I have added tests to cover my changes.
  • All new and existing tests passed (using make test).

srid added 3 commits January 25, 2021 14:30
When using:

```
(use-package markdown-mode
  :config
  (setq markdown-enable-wiki-links t)
  (setq markdown-wiki-link-search-subdirectories t)
  (setq markdown-link-space-sub-char " "))
```

<kbd>C-c C-o</kbd> will bail out if the target exists in sub-directories. Using `save-match-data` fixes that.
@srid srid marked this pull request as ready for review January 25, 2021 19:39
@syohex
Copy link
Collaborator

syohex commented Jan 26, 2021

Could you show us how to reproduce your problem in detail(with sample markdown text etc) ?

@srid
Copy link
Author

srid commented Jan 26, 2021

To reproduce,

git clone https://github.com/srid/neuron.git
cd doc 
emacs Guide.md 

Using the emacs configuration in issue description, try navigating to most of the links in Guide.md.

@syohex
Copy link
Collaborator

syohex commented Jan 27, 2021

I have added some fixes to this PR and sent PR #591. Please check it.

@srid
Copy link
Author

srid commented Jan 27, 2021

Confirmed to be working, and commented in detail in the other PR. Closing this one.

@srid srid closed this Jan 27, 2021
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

Successfully merging this pull request may close these issues.

2 participants