1. Basic Refactorings
  2. QuickCheck Refactorings
  3. Code Inspection
  4. Similar Code Detection
  5. API Migration
  6. Module Structure
  7. Manage self-defined refactorings

Basic Refactorings

Rename variable/function
Place cursor at the identifier to be renamed; you'll be prompted for a new name.
Rename module
Place cursor anywhere within the module; you'll be prompted for a new name.
Generalise definition
Highlight the expression on which the function is going to be generalised, you'll be prompted for a new parameter name.
Move a function definition to another module
Place cursor anywhere within the function definition; you'll be prompted for the target module name.
Function extraction
Highlight the expression/expression sequence that you wish to extract, you'll be prompted for a new function name.
Introduce a new variable
Highlight the expression of interest, then select Introduce New Variable from the Refactor menu; Wrangler will then prompt for the new variable name.
Inline a variable
To unfold a particular use instance of a variable, point the cursor to that instance, and then select Inline Variable from the Refactor menu. To unfold all (or some) uses of a variable, point the cursor to the defining occurrence of the variable and select the refactoring command. Wrangler will then search for uses of the selected variable, and let you choose which instances to unfold. Only variables defined via a match expression of the format `VarName = Expr' can currently be inlined.
Fold expression against function
Place cursor anywhere within the function clause. Wrangler will guide you through the possible candidates one by one, and ask whether you want to fold it or not. If you would like to fold expressions against a function defined in another module, answer 'no' to the first question asked, and you'll be prompted for the module name, name and arity of the function and also the index (starting from 1) of the clause to be folded against.
Tuple function arguments
Highlight the sequence of parameters to be grouped into a tuple from the function definition, then select the refactoring command from the menu.
Unfold a function application
Place the cursor at the function name part of the function application, then select the Unfold Function Application command.
Introduce new macro
Highlight the expression/pattern that you wish to replace with macro application, and you'll be prompted from a new macro name.
Fold against macro definition
Place cursor anywhere within the function definition. Wrangler will direct you through the possible candidates one by one, and for each candidate ask whether you want to fold it or not.
Rename a process
Place the cursor at the process name to be renamed, and you will be prompted for the new name.
Register a process
Highlight the match expression whose right-hand side is the spawn expression that creates the process, and left-hand side is the process identifier, and you will be prompted for the new process name.
From fun to process
Place the cursor at the function name of the function definition to be refactored, and you will be prompted for the new process name.
Add tag to messages
Place the cursor at the function whose body contains the receive expression of the server process, and you will be prompted for the tag name.
Normalise Record Expression
Place the cursor at the record expression of interest, then select the refactoring command.
Partition Export Functions
Select the refactoring command, and you will be prompted for an instance threshold value between 0.1 and 1.0
gen_fsm State to Record
Select the refactoring command, and Wrangler will check the current type of the state machine, and prompt you to input the record and field names if Wrangler is able to process the refactoring.

QuickCheck Refactorings

Introduce a ?LET
Highlight the expression which should be a QC generator, then select the refactoring command; you will be prompted for the pattern variable name.
Merge ?LETs
Select the refactoring command, and Wrangler will guide you through the possible candidates one by one, and ask whether you want to merge it or not.
Merge ?FORALLs
Select the refactoring command, and Wrangler will guide you through the possible candidates one by one, and ask whether you want to merge it or not.
eqc_statem State to Record
Select the refactoring command, and Wrangler will check the current type of the state machine, and prompt you to input the record and field names if Wrangler is able to proceed the refactoring.
eqc_fsm State to Record
Select the refactoring command, and Wrangler will check the current type of the state machine, and prompt you to input the record and field names if Wrangler is able to process the refactoring.
Test Cases to Property
Place the cursor at the function definition of interest, then select the refactoring command.
Refactor Bug PreCond
Select the refactoring command, and Wrangler will do the transformation; no user input is needed.
Rename an operation argument
Select the argument to be renamed from the wrapper function, Wrangler will prompt you to input the new argument name.
Add an operation argument
Point the cursor to the wrapper function of this operation, Wrangler will prompt you to input the new argument name.
Remove an operation argument
Point the cursor to the arugument to be removed in the wrapper function of the operation.
Add an operation
Select the menu item for this refactoring, Wrangler will prompt you to input the new operation name and its parameters.
Remove an operation
Point the cursor to the wrapper function of operation to be removed, then select the menu item for this refactoring.
Re-order operation arguments
Point the cursor to the wrapper function of the operation, Wrangler will prompt you to input the new order of the parameters in terms of the indexes of the current parameters.

Code Inspection

Instances of a Variable
Place the cursor at one instance of the variable, select the command, and Wrangler will highlight all the instances of this variable. An instance highlighted in blue is a use-instance of the variable, and an instance highlighted in orange is a define-instance of the variable. Type 'Ctrl-c Ctrl-w e' to remove highlighting.
Calls to a Function
Place the cursor the function definition of interest, then select the command.
Dependencies of a Module
Just select the command; no user-input is needed.
Nested If Expressions
Select the command, the you'll be prompted to input the minimum nest level.
Nested Case Expressions
Select the command, the you'll be prompted to input the minimum nest level.
Nested Receive Expressions
Select the command, the you'll be prompted to input the minimum nest level.
Long Functions
Select the command, then you'll be prompted to input the minimum number of lines of code for a function to be considered as a long function.
Large Modules
Select the command, then you'll be prompted to input the minimum number of lines of code for a module to be considered as a large module.
Show Non Tail Recursive Servers
Select the command, and Wrangler will ask you whether to check the current buffer only, or the whole application.
Incomplete Receive Patterns
Select the command, and Wrangler will ask you whether to check the current buffer only, or the whole application.

Similar Code Detection

Similar code in current buffer
Select the refactoring command from the menu, and you'll be prompted for 5 parameters, i.e. i.e. the minimum number of expressions in a expression sequence, the minimum number of tokens, the minimum number of duplication, the maximum number of New_Vars, and a similarity score.
Similar code in dirs
Select the refactoring command from the menu, and you'll be prompted for 5 parameters, i.e. i.e. the minimum number of expressions in a expression sequence, the minimum number of tokens, the minimum number of duplication, the maximum number of New_Vars, and a similarity score. Wrangler searches similar code in the directories specified by the search-paths (see Customize Wrangler).
Similar expression search in current buffer
Highlight the expression/expression sequence you are interested, select the command from the menu, and Wrangler will prompt you to input a similarity score.
Similar expression search in Dirs
Highlight the expression/expression sequence you are interested, select the command from the menu, and Wrangler will prompt you to input a similarity score. Wrangler searches similar expressions in the directories specified by the search-paths (see Customize Wrangler).

API Migration

Generate API Migration Rules
Make sure that the current buffer is an Erlang module implementing a set of 'adaptor' functions, select the command, and you'll be prompt for a new file name where the new rules generated will be saved.
Apply API Migration to Current File
Select the command from the menu, and you'll be prompted for the name of the module containing the API migration rules. Make sure that the API migration module has been compiled before use.
Apply API Migration to Dirs
Select the command from the menu, and you'll be prompted for the name of the module containing the API migration rules. Make sure that the API migration module has been compiled before use.
From Regexp to RE
Select the command from the menu, and you'll be able to choose whether to apply the migration to the current buffer only or to the whole application

Module Structure

Generate Function Callgraph
Select the command, and you'll be prompted for the name of the file where the callgraph is going to be stored. The file generated is a .dot file, and you need to compile it using Graphviz to generate the graph image.
Generate Module Graph
Select the command, and you'll be prompted for the name of the file where the callgraph is going to be stored. Wrangler ask to confirm the directories to be search, and whether to label the edges with names of functions called. The file generated is a .dot file, and you need to compile it using Graphviz to generate the graph image.
Cyclic Module Dependency
Select the command, and you'll be prompted for the name of the file where the callgraph is going to be stored. Wrangler ask to confirm the directories to be search, and whether to label the edges with names of functions called. The file generated is a .dot file, and you need to compile it using Graphviz to generate the graph image.
Module Dependency via only Internal Functions
Select the command, and you'll be prompted for the name of the file where the callgraph is going to be stored. Wrangler ask to confirm the directories to be search, and whether to label the edges with names of functions called. The file generated is a .dot file, and you need to compile it using Graphviz to generate the graph image.

Manage Self-defined Refactorings

Apply Adhoc Refactoring
Select the command from the menu, and you'll be prompted for the name of the callback module implementing a gen_refac behaviour. Please make sure that the callback module is compiled before use.
Apply Adhoc Composite Refactoring
Select the command from the menu, and you'll be prompted for the name of the callback module implementing a gen_composite_refac behaviour. Please make sure that the callback module is compiled before use.
Add to My gen_refac Refactorings
Make sure that the current buffer is an Erlang module implementing a gen_refac behaviour, then select the command from the menu.
Add to My gen_composite_refac Refactorings
Make sure that the current buffer is an Erlang module implementing a gen_composite_refac behaviour, then select the command from the menu.
Remove from My gen_refac Refactorings
Select the command from the menu, and you'll be prompted for the menu item name to be removed.
Remove from My gen_composite_refac Refactorings
Select the command from the menu, and you'll be prompted for the menu item name to be removed