                          (<= (point) start)
                          (>= (mark) end)
                          (> (- (mark) (point)) (- end start))
-                         (>= (point) best-start))
+                         (> (point) best-start))
                 (setq best-start (point))
                 (setq best-end (mark))
                 (message "%S" (car try-list))))

  (forward-list)
  (exchange-point-and-mark))

;; Mark javascript function

(defun er/mark-js-function ()
  (interactive)
  (while (not (looking-at "function "))
    (backward-char))
  (set-mark (point))
  (while (not (looking-at "{"))
    (forward-char))
  (forward-list)
  (exchange-point-and-mark))

;; Expand region

(setq er/try-expand-list '(er/mark-word
                           er/mark-symbol
                           er/mark-inside-quotes
                           er/mark-outside-quotes
                           er/mark-js-function
                           mark-paragraph
                           er/mark-inside-pairs
                           er/mark-outside-pairs))

(defun er/expand-region ()
  (interactive)

      (set-mark (point))
      (while (looking-back symbol-regexp)
        (backward-char)))))

;; Mark method call (can be improved further)

(defun er/mark-method-call ()
  (interactive)
  (let ((symbol-regexp "\\s_\\|\\sw\\|\\."))
    (when (or (looking-at symbol-regexp)
              (looking-back symbol-regexp))
      (while (looking-back symbol-regexp)
        (backward-char))
      (set-mark (point))
      (while (looking-at symbol-regexp)
        (forward-char))
      (if (looking-at "(")
          (forward-list))
      (exchange-point-and-mark))))

;; Mark javascript function

(defun er/mark-js-function ()
  (interactive)
  (while (not (looking-at "function "))
    (backward-char))
  (set-mark (point))
  (while (not (looking-at "{"))
    (forward-char))
  (forward-list)
  (exchange-point-and-mark))

;; Quotes

