34
$\begingroup$

When I'm writing code in the front-end, I find myself very often looking up the list of options of a symbol over and over again in the documentation center. In most cases you find there a list of available options, but sometimes not and you may end up typing Options[Get] in your current notebook.

Even worse is the situation with Attributes which are extremely helpful especial when you do something with non-standard evaluation. In this case, I often just want to know Does a function hold its arguments? or Is this function listable? to give two examples.

Question: Isn't there a one-click palette solution for this?

$\endgroup$

1 Answer 1

37
$\begingroup$

For this purpose, I wrote a small Symbol Information Palette. This palette let's you quickly look up usages, options and attributes of symbols and was tested on Mac OSX and Linux.

enter image description here

Installation

The source code is hosted on my GitHub site but to preview or install the palette you only have to evaluate this:

Get["http://goo.gl/QPywk"]

The link is just shortened and points only to the raw sources of my palette on GitHub.

After evaluation you get 3 buttons. Show Palette let's you test it without installing something. Install Palette installs the palette in the user palette directory

FileNameJoin[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "Palettes"}]

With Install Path you can install it in a different location.

Usage

It is designed to be as minimal and informative as possible. The windows created by this palette have no Close or OK button, instead (since they are dialogs) they are closed by simply hitting Esc.

If you want information about a symbol, you can, but you don't need to select it and press a button. It is sufficient when the cursor is anywhere in or at the symbol. This means to get information about Graphics the cursor just needs to be at any of the | when you click a button: |G|r|a|p|h|i|c|s|.

Usage button: The Usage button displays the usage message of a symbol. You can use the second mouse button and click on the this window and the documentation center opens automatically the page of the symbol. Here an example for Get

enter image description here

Please note, that if you select something which has no usage message and you see the window with No usage message available you can still click on it to search the documentation center.

Options button

The options button displays a custom made panel which is awesome. You get a scroll-able list of all options of a symbol and you can click on each option to get an inline view of the usage of this option. Additionally, when being over a such an inline usage message for a second you get a tooltip with the default value. Not to mention, that you can use always the secondary click to open the documentation of this option!

enter image description here

Attributes button: Ever wondered why your Plot uses only one color when you don't give an explicit List of functions? Ever wondered why something is evaluated or not evaluated as you expect it. This button is a quick way to display all Attributes of symbol neatly arranged.

enter image description here

Further development

If I find time, then I want to implement some further features

  • Changing of attributes if possible.
  • Investigate in OwnValue, UpValues, DownValues, SubValues, FormatValues, NValues
  • Creation of template code to insert custom code snips into built-in function

Known Issues

jVincent mentioned that the option-panel is sometimes slow. In this panel, every button is a small DynamicModule because I couldn't find a way to implement the behaviour I wanted with the usual tools like Button. As example, jVincent mentioned the option-panel of CreatePalette which is probably a bad choice for generalisation because with its 281 options it plays in the top 10 of the 4623 symbols in Names["*"] regarding number of options. Even Graphics has only 38 options.

$\endgroup$
11
  • 1
    $\begingroup$ Normally, I'd object to someone calling their own work "awesome," however, I think it qualifies. +1 $\endgroup$
    – rcollyer
    Dec 22, 2012 at 7:15
  • 3
    $\begingroup$ @rcollyer This awesome is an awesome which expresses how long it took me fiddling around with Button, Toggler, Opener and friend before finally throwing everything away and building my own Mouseover, EventHandler solution which works quite reasonable, even for a long list of options. $\endgroup$
    – halirutan
    Dec 22, 2012 at 7:27
  • $\begingroup$ Cool. I'll have to look through the code when it isn't approaching 3 in the morning. $\endgroup$
    – rcollyer
    Dec 22, 2012 at 7:38
  • $\begingroup$ Before I even try: is this going to work in version 7? Boy I sure hope so. $\endgroup$
    – Mr.Wizard
    Dec 22, 2012 at 10:58
  • $\begingroup$ @Mr.Wizard I haven't tried it but if nothing really bad happens, we should get it going. $\endgroup$
    – halirutan
    Dec 22, 2012 at 11:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.