Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In Mathematica, notebooks (in fact all expressions) have a tree-like structure. In this regard, they are similar to XML files. For XML, one can travel through the document structure using tools like XPath. What would be the equivalent in Mathematica so that beginning with NotebookSelection one navigates towards the outermost Notebook until one reaches a parent that matches certain pattern (say Cell[__,”Input”,___]). If the pattern is reached, the selection is enlarged; otherwise, the selection stays the same.

To make the problem more interesting: is it possible to do it without changing the selection (the highlighted region should stay the same unless enlarged to avoid flickering) and without copying the notebook to a hidden one (the original notebook might be really large)?

Any pointers will be appreciated.

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.