Repository navigation
Conversation
|
Can you clarify the problem your trying to solve? After all any link resolution is kind of tied to the underlying AsciiDoc "framework" as they tend to organize files differently. (as illustrated by handling of Antora files) |
|
@bbatsov, first let me thank you for taking over this project. i, too, love the functionality that emacs and asciidoc bring. the progress you've made is amazing, and the test harness is so important. in other modes, this is because based on the adoc-mode documenetation, this is supposed to work
to fix this, we need to add a call to this pull request tries to minimize the diff and leaves the existing code alone by adding calls to |
|
@bbatsov the an alternative is to remove this binding and fix one downside is that the code won't be able to open a browser for urls, since emacs is handling the navigation. |
|
Thanks for the extra details! I'll take a closer look at the proposed fix tomorrow. |
Push the origin onto the xref marker stack in `adoc-goto-ref-label' and in the `include::' and `link:' file branches of `adoc-follow-thing-at-point'. The Antora branch already did so.
|
@bbatsov simplified PR. should pass tests now. |
bbatsov
left a comment
There was a problem hiding this comment.
The fix looks right to me - M-, now comes back from xrefs, include:: and link: files. Mostly small test things inline, but the Emacs 28 one will break CI.
| (beginning-of-buffer) | ||
| (adoc-goto-ref-label "cool") | ||
| (expect (line-number-at-pos) :to-equal 5) | ||
| (xref-go-back) |
There was a problem hiding this comment.
xref-go-back only appeared in Emacs 29.1, and we still support 28.1 (it's in the CI matrix), so this fails there with void-function. On 28 the command is xref-pop-marker-stack. A tiny helper covers both:
(defun adoc-test--go-back ()
(funcall (if (fboundp 'xref-go-back) 'xref-go-back 'xref-pop-marker-stack)))Quoting the symbols instead of using #' keeps 29+ from warning about the obsolete alias.
| "[[bar]]\n" | ||
| "dolor [[geil]]sit amen\n" | ||
| "anchor:cool[]\n") | ||
| (beginning-of-buffer) |
There was a problem hiding this comment.
The byte-compiler warns that beginning-of-buffer is for interactive use only. (goto-char (point-min)) does the same here.
| (let ((file (match-string-no-properties 1))) | ||
| (if (file-exists-p file) | ||
| (find-file file) | ||
| (progn (xref-push-marker-stack) (find-file file)) |
There was a problem hiding this comment.
Only the adoc-goto-ref-label path has a test. A spec that follows an include:: (and a link:) to a real file and then goes back would cover this branch and the link: one below.
| - Following a cross-reference at point (`C-c C-o` / `M-.`, and the new `xref` commands) now works for a plain `<<id>>` even when a captioned `<<id,caption>>` appears later on the same or an adjacent line, and ignores the whitespace in forms like `<<id >>`. Previously `adoc-xref-id-at-point` could return nil or an id with a trailing space in those cases. | ||
| - Heading navigation (`C-c C-n` and friends) and the imenu index no longer get confused by code and other delimited blocks. A `==`-style line inside a listing, source, literal, example, sidebar, quote, or open block, or a code line followed by `----` (which looks just like a two-line title underline), is no longer mistaken for a section title. Navigation and imenu now stay in step with what is actually highlighted as a title. | ||
| - Heading navigation and imenu now honour `adoc-enable-two-line-title`. It is nil by default, so two-line (setext) titles are no longer picked up unless you opt in, matching their fontification. Previously they were always recognised, which was the main source of the code-block confusion above. | ||
| - Fix `M-,` (`xref-go-back`) after following an xref, `include::` or `link:` file with `M-.` / `C-c C-o`. The origin is now recorded on the xref marker stack. |
There was a problem hiding this comment.
Please start the entry with a link to the PR: - [#88](https://github.com/bbatsov/adoc-mode/pull/88): Fix ...
Push the origin onto the xref marker stack in
adoc-goto-ref-labeland in theinclude::andlink:file branches ofadoc-follow-thing-at-point. The Antora branch already did so.Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
eldev test)M-x checkdocwarningsThanks!