Question: How do I replace current word under cursor in Emacs? 

I know that I can use query-replace or replace-string but every time I do so I have to type entire string to be replaced, this is just annoying. 

Vi has equivalent command cword and I can use a shortcut to pull the word under cursor for replacement:

```
nmap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\>#

```

Anybody know how to do it with Emacs?

Answer: 
If you go into search-and-replace with `M-S-%` just pressing `M-n` fills in word under cursor, pressing it again wraps it in "symbol delimiter".
This snippet expands on the answer by Emanuel Berg, to:

* display the selected string to be replaced;
* use symbol rather than words, which gives me better results in Python code (or generally `superword-mode`).

```
(defun query-replace-at-point (old new)
  "Invoke `query-replace', valuing OLD to symbol at point, replacing it with the input NEW."
  (interactive
   (let* ((old-symbol (symbol-name (symbol-at-point)))
          (new-symbol (read-string (format "Rename %s to: " old-symbol) old-symbol)))
     (list old-symbol new-symbol)))
  (query-replace old new))

```