summaryrefslogtreecommitdiff
path: root/elchemy-functions.el
blob: 465034b43e5d544c6a31d2a39c3c09a450b202c4 (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 elchemy/rib/current-word (buffer-substring-no-properties (mark) (point)))
    (setq elchemy/rib/old-string (read-string "OLD string:\n" elchemy/rib/current-word))
    (setq elchemy/rib/new-string (read-string "NEW string:\n" elchemy/rib/old-string))
    (query-replace elchemy/rib/old-string elchemy/rib/new-string nil (point-min) (point-max))))

(provide 'elchemy-functions)