Note that the original program makes direct use of accented characters in the CSX encoding; here it has been converted to use Unicode equivalents to ensure readability on modern computers. This means that downloading and attempting to run the program as it stands is unlikely to work.
(defun mbh-query-replace (from-string to-string &optional arg) "Replace some occurrences of FROM-STRING with TO-STRING in every file forming part of the Mahābhārata. As each match is found, the user must type a character saying what to do with it. For directions, type \\[help-command] at that time. Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and FROM-STRING has no uppercase letters. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. To customize possible responses, change the \"bindings\" in `query-replace-map'." (interactive (query-replace-read-args "Mahābhārata query replace")) (find-file "/home/john/work/mahābhārata/text/01_ādiparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/02_sabhāparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/03_āraṇyakaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/04_virāṭaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/05_udyogaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/06_bhīṣmaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/07_droṇaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/08_karṇaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/09_śalyaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/10_sauptikaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/11_strīparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/12_śāntiparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/13_anuśāsanaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/14_āśvamedhikaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/15_āśramavāsikaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/16_mausalaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/17_mahāprasthānikaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/18_svargārohaṇaparvan") (beginning-of-buffer) (perform-replace from-string to-string t nil arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (message "Mahābhārata query replace complete") ) (defun mbh-query-replace-regexp (regexp to-string &optional arg) "Replace some things after point matching REGEXP with TO-STRING in every file forming part of the Mahābhārata. As each match is found, the user must type a character saying what to do with it. For directions, type \\[help-command] at that time. Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, and `\\=\\N' (where N is a digit) stands for whatever what matched the Nth `\\(...\\)' in REGEXP." (interactive (query-replace-read-args "Mahābhārata query replace regexp")) (find-file "/home/john/work/mahābhārata/text/01_ādiparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/02_sabhāparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/03_āraṇyakaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/04_virāṭaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/05_udyogaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/06_bhīṣmaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/07_droṇaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/08_karṇaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/09_śalyaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/10_sauptikaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/11_strīparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/12_śāntiparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/13_anuśāsanaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/14_āśvamedhikaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/15_āśramavāsikaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/16_mausalaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/17_mahāprasthānikaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (find-file "/home/john/work/mahābhārata/text/18_svargārohaṇaparvan") (beginning-of-buffer) (perform-replace regexp to-string t t arg) (or unread-command-events (message "Done")) (save-buffer) (kill-buffer (current-buffer)) (message "Mahābhārata query replace regexp complete") ) (global-set-key "\C-cs" 'mbh-query-replace) (global-set-key "\C-c\C-s" 'mbh-query-replace-regexp)