       (if (listp r)
           (merlin-occurences-list r)
         (message r)))))
+
+(defun merlin-local-occurences ()
+  (interactive)
+  (merlin-occurences t))
 
 ;;;;;;;;;;;;;;;;;;;;;;;
 ;; SEMANTIC MOVEMENT ;;

(defun merlin-occurences-populate-buffer (lst)
  (lexical-let ((src-buff (buffer-name))
                (occ-buff (merlin-get-occ-buff)))
    (with-current-buffer occ-buff
      (let ((inhibit-read-only t)
            (buffer-undo-list t))

             lst)))))

(defun merlin-occurences-list (lst)
  (save-excursion
    (merlin-occurences-populate-buffer lst)
    (cond ((equal merlin-occurences-show-buffer 'same)
           (switch-to-buffer (merlin-get-occ-buff)))
          ((equal merlin-occurences-show-buffer 'other)
           (switch-to-buffer-other-window (merlin-get-occ-buff)))
          (t nil))))

(defun merlin-occurences (&optional local-occurences)
  "List all occurences of buffer under cursor.
   LOCAL-OCCURENCES restricts the search to the local scope."
  (interactive)
  (if local-occurences
      (merlin-sync-to-point)
    (merlin-sync-to-point (point-max) t))
  (let* ((r (merlin-send-command
             (list 'occurences 'ident 'at
                   (merlin-unmake-point (point))))))
