       result)))
 
 ;;;###autoload
-(defun +lookup-symbol-or-region (&optional initial)
-  "Grab the symbol at point or selected region."
+(defun +lookup-thing-or-region (&optional initial thing)
+  "Return INITIAL, grab the THING at point, or contents of selection.
+
+If THING is nil, uses `xref-backend-identifier-at-point' (like symbol, but
+smarter)."
   (cond ((stringp initial)
          initial)
         ((use-region-p)
          (buffer-substring-no-properties (region-beginning)
                                          (region-end)))
+        (thing
+         (thing-at-point thing t))
         ((require 'xref nil t)
          ;; A little smarter than using `symbol-at-point', though in most cases,
          ;; xref ends up using `symbol-at-point' anyway.

      (or (ffap-guesser)
          (ffap-read-file-or-url
           (if ffap-url-regexp "Find file or URL: " "Find file: ")
           (+lookup-symbol-or-region))))))
  (require 'ffap)
  (cond ((not path)
         (call-interactively #'find-file-at-point))

(defun +lookup/dictionary-definition (identifier &optional arg)
  "Look up the definition of the word at point (or selection)."
  (interactive
   (list (or (+lookup-thing-or-region nil 'word)
             (read-string "Look up in dictionary: "))
         current-prefix-arg))
  (cond ((and IS-MAC (require 'osx-dictionary nil t))
         (osx-dictionary--view-result identifier))
        ((and +lookup-dictionary-enable-online (require 'define-word nil t))
         (message "Looking up definition of %S" identifier)
         (define-word identifier nil arg))
        ;; TODO Implement offline dictionary backend
        ((user-error "No dictionary backend is available"))))

;;;###autoload
(defun +lookup/synonyms (identifier &optional arg)
  "Look up and insert a synonym for the word at point (or selection)."
  (interactive
   (list (+lookup-thing-or-region nil 'word) ; TODO actually use this
         current-prefix-arg))
  (unless (require 'powerthesaurus nil t)
    (user-error "No dictionary backend is available"))
  (unless +lookup-dictionary-enable-online
    ;; TODO Implement offline synonyms backend
    (user-error "No offline dictionary implemented yet"))
  (message "Looking up synonyms for %S" identifier)
  (powerthesaurus-lookup-word-dwim))
