Home > front end > Autocomplete short symbol names in non-global context

Autocomplete short symbol names in non-global context

April 3Hits:1
Advertisement

Is it possible in v9 to autocomplete the short symbol names when one is operating in a context other than Global`? I.e. after evaluating the following:

Begin["MyContext`"]; xyz=5; 

Starting to write MyCon... will autocomplete and give MyContext`xyz as an option. That's not what I want. I want to write x and get autocomplete to suggest xyz. I tried adding MyContext` to $ContextPath but that doesn't do anything. Of course if I were to exit MyContext` and return to Global` I don't expect it to autocomplete the short name anymore. Also, I noticed that the symbol coloring is off too, so that xyz appears to have no value assigned (blue colored) even though it obviously does have a value.

Answers

Paraphrasing the insights of rm -rf:

  • To make highlighting and autocompletion work in new contexts you have to run: 1) Begin[...]; 2) AppendTo[$ContextPath,...] and 3) End[]. Then you have to open your context again: Begin[...];
  • Be sure to put each of (1), (2) and (3) in the previous bullet point in separate cells. They have to be evaluated separately or it won't work.

Related Articles

  • Autocomplete short symbol names in non-global contextApril 3

    Is it possible in v9 to autocomplete the short symbol names when one is operating in a context other than Global`? I.e. after evaluating the following: Begin["MyContext`"]; xyz=5; Starting to write MyCon... will autocomplete and give MyContext`x

  • How to properly DumpSave & Get Global`s symbols inside packages while not touching Global context?March 22

    For efficiency reasons I prefer to use DumpSave instead of Save. For ease of access I prefer to save symbols in DumpSaved files inside Global` context. But when my code evolved and I moved it inside packages I found a lot of problems to read symbols

  • Why must I specify the Global context for a symbol in a private package?November 7

    I have written two versions of the function below in a package. When I load the package and call the function, Why does the first version where the variable s has no explicit Context return the long variable name? Or why do I have to put the variable

  • Local variables in Module leak into the Global contextJuly 13

    From the Mathematica documentation on Module: Module allows you to set up local variables with names that are local to the module. But after using Module, the symbol is created ! I understand that Module makes temporary symbols appending a number, li

  • Potential pollution of Global` context in fresh kernelJuly 12

    Bug introduced in 10.0.0 and fixed in 10.0.1 If I evaluate, with a fresh kernel Names["Global`*"] I get {"rhs", "z"} I think this is not caused by any packages in $UserBaseDirectory or $BaseDirectory, because if I evaluate th

  • Global` context not empty at startup in v10.2.0

    Global` context not empty at startup in v10.2.0August 1

    Bug introduced in 10.2 and persisting through 10.2 or later Note that the analysis of this problem revealed a different problem than in Potential pollution of Global` context in fresh kernel (see answers). Despite the initial impression that is refle

  • Nomenclatura-How to display one symbol used in two differents contexts or more

    Nomenclatura-How to display one symbol used in two differents contexts or moreOctober 8

    The following example builds one nomenclatura (the list of some importa symbols). The problem I met is the following one : if one symbol is used in two contexts, this symbol appears two times (see the letter a in my example). Is it possible to change

  • How would one store global context data in an entity component system?August 17

    My question is this: How would one store global context data, ie. world data information, current world time, etc in an entity component system? I'm think of working towards building a Dwarf Fortress-style open ended world simulation game in C++. I'v

  • Using a variable in a Global context in webappsJanuary 30

    In a webapp, I have a scenario where I need some kind of global context (Static like) for few variables, for the current thread only. If there are 3 different concurrent users, then I expect three corresponding global context variable for the 3 separ

  • How to make a symbol adjust its size globally and locally

    How to make a symbol adjust its size globally and locallyFebruary 27

    In the following code I have created a bullseye symbol. What I want to do is to allow its size to change dynamically both globally (document class option say 10pt, 11pt or 12pt) or locally by using \small, \large, and any command that declares size.

  • Dagger symbol in math mode in ConTeXt with Euler font?

    Dagger symbol in math mode in ConTeXt with Euler font?May 6

    I followed this answer to use the Neo Euler font in math mode. I found that the dagger symbol (†) is missing in Euler. Is there a way to use the dagger symbol from the text mode font in math mode? Here's a minimal example: \usetypescriptfile[euler] \

  • Same name for functions in package and Global contextJanuary 7

    I am using a package that was written for Mathematica 3 while I am now working on Mathematica 8. I have issues with 2 functions in particular, Order and GraphComplement. They are a part of this package but are also present in Mathematica 8 by default

  • Configure global context menu to target specific file typesJanuary 20

    I'm using Sublime Text 3 on Windows 7 OS. I upon installation of the text editor, I allow it to add its context menu on explorer for easy access. My problem is how can I associate that context menu only to certain file types? Seeing Open with Sublime

  • Generate a list of all user defined functions including their argument patterns

    Generate a list of all user defined functions including their argument patternsNovember 19

    I have defined a bunch of functions over several different files, and I would like a list of prototypes of all the functions I have defined in my current session (I want the mathematica equivalent of the .h file for my .c file). For example, if I def

  • Incompatible Changes since Mathematica Version 7?August 6

    There is documentation of the incompatible changes made to Mathematica with each major release: Incompatible Changes since Mathematica Version 1 Unfortunately that documentation simply stopped with version 7. Therefore I ask: What incompatible change

  • Context of localised (dynamic) symbols

    Context of localised (dynamic) symbolsFebruary 18

    When you localise a symbol with Module, the created unique symbol is usually in the current context. There seems to be an exception to this which has further consequences. Let us assume we define a symbol in a package. We can mimic this by defining a

  • Rewriting symbol context?

    Rewriting symbol context?April 2

    I have some code that uses a list of replacement rules to inject values (physical constants for different materials) into a more complicated expression. This is convenient since I can tweak the values in my rule list independently from the code and t

  • How to define a global variable when giving each notebook its own Context?May 24

    I have restricted the context of my notebooks to each individual notebook. So variables in each notebook are local and are not seen in another notebook. But in two of my notebooks I have two functions that I want to plot simultaneously with the comma

  • Transfer of symbols between contextsMarch 14

    As many others (I guess) I'm struggling with the handling of contexts within Mathematica. I'm working on a new package definition with the usual syntaxt specified by the Mathematica documentation: BeginPackage["example`"]; <Entry Points> B

  • Simple problem about shadow symbols in multi-contextsMay 22

    When I'm tiding up my simple packages, shadow awlays comes out. Here is an example. Packages1 BeginPackage["MyTest1`"] f1[x0_]:=Module[{x=x0},StringReplace["sdfasdfwhat hahahahah",x_->"DummyInMyTest1"]] g1[x0_]:=Module[{x=

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.458 s.