Good afternoon. In the text, the record
@samp{\}
, the code
(buffer-substring-no-properties (+ nach 4) (- (point) 4))
is captured here this region, at the output of the
"@samp{\\}"
function. The question is how to get the non-escaped forward slash. Thank you
Changes further along the code gave the result, namely, not a correction of the record of the read line, but a change in the insertion of the ill-fated line "@samp {\\}"
back into the text. The function is presented
(defun zamenaOBJ (спсОбктв)
"Зменить obzx оригиналом"
(goto-char 1)
(while (re-search-forward "[Bb]jkt\\([[:digit:]]\\)+" nil t 1)
(replace-match (cdr (assoc (downcase (match-string 0)) спсОбктв)) t)))
Here is the data at the time of the error (what was received
(buffer-substring-no-properties)
and saved in the associative list
(cdr (assoc (downcase (match-string 0)) спсОбктв))
"@samp{\\}"
The error itself
(replace-match (cdr (assoc (downcase (match-string 0)) спсОбктв)) t)
Invalid use of ‘\’ in replacement text
If it was written like this:
(replace-match (prin1-to-string (cdr (assoc (downcase (match-string 0)) спсОбктв)) t))
все замены по тексту были окружены двойной кавычкой, если же указывался аргумент noescape в t для prin1-to-string:
(replace-match (prin1-to-string (cdr (assoc (downcase (match-string 0)) спсОбктв)) t) t)
or
(replace-match (princ (cdr (assoc (downcase (match-string 0)) спсОбктв)) t))
the error came back again
Solved by adding the second argument literal replace-match
(replace-match (cdr (assoc (downcase (match-string 0)) спсОбктв)) t t)