Thank you!
On 1 October 2012 20:29, Miguel de Benito Delgado <m.debenito.delg...@gmail.com> wrote: > <assign|nf-chunk|<macro|name|code|arg|This is chunk: <arg|name>. It has > second argument: <arg|code>>> > > Then, with > > (select (buffer-tree) '(:* nf-chunk 0)) > > you get the list of all names of all occurrences of such macro in your > document. Since trees remember their paths, you can now use tree->path on > each element of that list and compare with the cursor-path. You may also > want to check the macro with-innermost in the documentation which will > traverse the tree recursively upwards looking for a given tag. Thank you! That would work. I still don't understand trees and select... I tried to select all nf-chunks that have name1 as the second argument, and didn't manage to do that... (or maybe I need to manually scan through select on nf-chunk?) I also didn't totally manage to recreate what the documentation says. :#n doesn't seem to work. For example, the documentation (utils-match.en.tm) says: -- Example 1. The tree (define t '(foo (bar "x") (bar "y") (option "z"))) matches the pattern (foo (:repeat (bar :#1)) :*), but not (foo (:repeat (bar 'x)) :*). The call (match t '(foo 'x 'y :*)) will return (((x . (bar "x")) (y . (bar "y")))). -- But when I do: (define t '(foo (bar "x") (bar "y") (option "z"))) (select t '(foo (:repeat (bar :#1)) :*)) I get read-error, because of the :#1, I think. thanks! Michael > > However, you have the choice of redefining your nf-chunk macro to set an > environment variable (say, "current-nf-chunk" to the value you want, then > read that variable at any point in your document to decide where you are. > Oh, yes - that is much better! Michael _______________________________________________ Texmacs-dev mailing list Texmacs-dev@gnu.org https://lists.gnu.org/mailman/listinfo/texmacs-dev