 
     return null # list not well formed, or no list
 
+  ###*
+   * If not isNested and the range [rangeStart,rangeEnd] is not empty, add it at the start of ranges.
+   * @param  {number[][]} ranges
+   * @param  {number}     rangeStart
+   * @param  {number}     rangeEnd
+   * @param  {boolean}    isNested
+  ###
   unshiftRange: (ranges, rangeStart, rangeEnd, isNested) ->
     ranges.unshift [rangeStart,rangeEnd] if not isNested && rangeStart != rangeEnd
 
-  # Use binary search to return the element of ignoreRanges that contains targetIx, or null
+  ###*
+   * Use binary search to return the element of ignoreRanges that contains targetIx, or null
+   * @param  {number[][]} ignoreRanges
+   * @param  {number}     targetIx
+   * @return {number[]} Ignored range that contains targetIx (or null).
+  ###
   findRangeForIndex: (ignoreRanges, targetIx) ->
     startIx = 0
     endIx = ignoreRanges.length - 1

      atom.notifications.addFatalError 'List-edit: Unknown opening bracket \'' + openingBracket + '\''
      undefined

  getOpeningBracketFor: (closingBracket) ->
    ix = @closeBracketChars.indexOf(closingBracket)
    if ix >= 0

    # console.log elementRanges
    elementRanges

  ###*
   * Convert a buffer-text character index range to a list-element index range.
   * PRECONDITION: rangeStart <= rangeEnd
   * NOTE: selection does not include end, so selection [1,2] of [a,b,c,d] = [b]
   * @param  {ListElement[]} listElements
   * @param  {number[]}      ixRange      - A character index range ([startIx, endIx]) in the buffer text.
   * @return {number[]} An index range ([startIx, endIx]) in the array of ListElements.
  ###
  getSelectionForRange: (listElements, ixRange) ->
    # TODO: Allow empty selection when in whitespace
    #        Maybe need booleans for distinguishing "one><, two"  "one, ><two" "one>, <two"
    #       these are empty for paste, but we may interpret them as ">one<, two" "one, >two" and ">one, two<" for select, cut, and copy.
    #       Not only for empty selections: ">one,< two" may be more intuitive as ">one, two<"
    #       maybe startIsBeforeSep and endIsBeforeSep? and add an expandListSelection function?
    #       Not immediately necessary, it may even be possible that letting these selections include the extra element is confusing.
    [rangeStart,rangeEnd] = ixRange
    i = 0
    while i < listElements.length
      elt = listElements[i]
