Unexpected results using Focus on Tags


#1

I have the following test file :smile:

Project 1

Custom tags available:

@hl / @highlight
@low
@high
@todo
@bug
@research
@p1@p9 (percentage tags)

Project 2 @PA

Some thing @Pa
Something B
Something C

  • List D
  • List E
  • List F
  • List G @PA

Project 3

Something X @PB
Something Y
Something Z

When I focus on @PA the line “Some thing @Pa” is not included but the untagged line Something C is. The copy and paste action here reveals that the missing line is tagged with @P lowercase ‘a’ but it is displayed as @PA by folding text. Overwriting it to caps A does now include the line in the focus. However I have no idea why the line Something C is also included.

Any thoughts ?

best wishes

Simon


#2

Something C is an ancestor (immediate parent, in this case) of - List G @PA

(Lists at the same level of indentation as a preceding body para are interpreted as children of that body para).

When we click on a tag (let’s say @done, for example), the filter is automatically set to ///@done, which (usefully, I think) includes the ancestors of the tagged lines, as well as the lines themselves.

It sounds as if you are expecting a //@done filter (just the matching lines, without their ancestral context).

You could use Jamie Kowalski’s filter plugin to see //@tag filters on the fly, if they are what you would prefer, for some purposes.


#3

Here, FWIW, is a draft of a script which filters on all tags wholly or partly selected anywhere in the editor.

(For multiple selections in FoldingText, hold down the ⌘ key while you start and extend the selection)

This draft defaults to excluding ancestors of matched lines, and if you prefer to see the ancestral context, you can edit the default:

precOptions : {axis:"//"}

to make a copy which reads:

precOptions : {axis:"///"}

Zip of repository containing this script within a ‘filtering in the editor’ folder:
https://github.com/RobTrew/txtquery-tools/archive/master.zip

Text of script:


FoldingText Extensions Wiki
#4

A variant script which throws up a simple sorted menu of all the tags in the document: