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.

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?

share|improve this question
    
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... –  rm -rf Mar 17 at 14:09
    
@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 ;) –  Julian Moore Mar 17 at 14:50
    
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. –  rm -rf Mar 17 at 14:56
    
@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. –  Julian Moore Mar 17 at 17:38
    
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. –  rm -rf Mar 17 at 17:49

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.