(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)