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

Add rust-mode workaround for error-stack errors #812

Merged
merged 5 commits into from
Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/libs/error-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,17 @@ Caused by:
```

Please see the [documentation] for a full description.

## Troubleshooting

### Emacs [rust-mode](https://github.com/rust-lang/rust-mode) workaround

Due to [rust-lang/rust-mode#452](https://github.com/rust-lang/rust-mode/issues/452), errors messages are improperly parsed. As a result, the error messages show incorrect highlighting but also yield an incorrect hyperlink.

The one workaround is to modify the regular expression used to format the string and create a hyperlink.

```emacs-lisp
(setq cargo-compilation-regexps
'("\\(?:at\\|',\\) \\(\\([^:\s]+\\):\\([0-9]+\\)\\)"
2 3 nil nil 1))
Comment on lines +124 to +126
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this, also the column is taken into account, but I think it would break if no column is available.

(setq cargo-compilation-regexps
      '("\\(?:at\\|',\\) \\(\\([^:\s]+\\):\\([0-9]+\\):\\([0-9]+\\)\\)"
        2 3 4 nil 1))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps using a ? quantifier in a couple places can solve that.

```