summaryrefslogtreecommitdiff
path: root/elchemy-functions.el
blob: 296e1e9ca42899573e8b8996d665174c7c2b9847 (plain)
1
2
3
4
5
6
7
8
9
10
(defun elchemy/replace-in-buffer ()
  (interactive)
  (save-excursion
    (if (equal mark-active nil) (mark-word))
    (setq nm/rib/current-word (buffer-substring-no-properties (mark) (point)))
    (setq nm/rib/old-string (read-string "OLD string:\n" nm/rib/current-word))
    (setq nm/rib/new-string (read-string "NEW string:\n" nm/rib/old-string))
    (query-replace nm/rib/old-string nm/rib/new-string nil (point-min) (point-max))))

(provide 'elchemy-functions)