Dynamic global replacement by line numbers, emacs

I am trying to do some debugging on some Prolog code, and I have several method calls.

Is it possible to make a global replacement in emacs so that I can create a write statement that would supplant the current line in the program?

In essence, if I accept a call to method X and write a write statement (some line), can I replace all instances

X

with

X write (LINE-NUMBER)

where was LINE-NUMBER received through some emacs call?

Please let me know if I am not clear and thank you in advance.

+3
source share
2 answers

This page has a similar example.

From it I tried the following command

M-x replace-regexp
Replace regexp: \(word_to_replace\)
Replace regexp with: \1, write(\,(line-number-at-pos)

replace-regexp , , . M-x query-replace-regexp , .

+4

, script, .

0

All Articles