The warning on find and replace isn't explicit and I only found out after an almost harmless global change that I really was replacing ALL, not just all instance in my selection (which is where most other applications would automatically limit scope)

Is there any way to limit the scope of "Replace All" to selected text only?

  • $\begingroup$ Why would "Replace All" not replace everything? Have you tried other options such as "Replace" or "Replace & Find"? I don't think most applications work this way; only some classic editors (vim, emacs) and some good modern IDEs do. Unfortunately, Mathematica's front-end is neither a proper editor nor an IDE... $\endgroup$
    – rm -rf
    Commented Mar 17, 2014 at 14:09
  • $\begingroup$ @rm-rf Thanks for the reply. Admittedly perception may differ, and I would agree that replace and replace & find have their place, but they can be unwieldy and error prone if there are many but not all instance to change. Example: renaming local variables within their scope without affecting local variables with the same names elsewhere (because although it should be OK functionally, label names may also have meaning in context) or changing text without affecting code. I'm happy that others may be comfortable with all = ALL, I just wonder if I could have some cake as well ;) $\endgroup$ Commented Mar 17, 2014 at 14:50
  • $\begingroup$ I understand what you're asking and I didn't say it was unreasonable... it's just my opinion that the front-end is neither an editor nor an IDE (if it is, it sucks at both), so many useful features like this are missing. Halirutan's Mathematica plugin for IntelliJ IDEA is a much more advanced editor/IDE than the FrontEnd or the Workbench and allows you to make variable changes local to a module/block/with. However, it's a work in progress, so some features like debugging/testing, etc. are missing as of now. $\endgroup$
    – rm -rf
    Commented Mar 17, 2014 at 14:56
  • $\begingroup$ @rm-rf I've just had a quick look at Halirutan's plug-in - definitely warrants careful consideration - I just don't know where my optimimum setup complexity/ease-of-use balance point is: I suppose I'll have to find out! Thx. $\endgroup$ Commented Mar 17, 2014 at 17:38
  • $\begingroup$ I fully understand where you're coming from... I'm learning two different languages now and I too spent my first month just on getting the "optimal setup" — time that could've been better spent on learning the language! Of course, now that I know a bit more, I've found that someone else's optimal setup (that I cribbed from the net) is not optimal for me. I think it's only human to want to optimize these little things at the very start when it's perhaps better to do so later... :) In any case, this answer mathematica.stackexchange.com/a/37296/5 might be helpful. $\endgroup$
    – rm -rf
    Commented Mar 17, 2014 at 17:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.