summaryrefslogtreecommitdiff
path: root/nemacs-functions.el
blob: 5513faedb84e7695057b1665d53dfe6acddcc90f (plain)
1
2
3
4
5
6
7
8
9
10
(defun nemacs/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 'nemacs-functions)