升级到Aquamacs版本3.3(emacs 25.1.1)后,运行re-replace-region
(如下定义)时出现标题中提到的错误,试图将区域中的9个字符串(例如“99”或“999”)更改为0。我从来没有在Aquamacs的早期版本(或emacs通常)中遇到过这个问题,并且在emacs环境或一般机器环境(Mac OS 10.9.5)中没有任何我能想到的问题,它们可能与问题。“re-replace-region:通过缓冲区修改挂钩匹配数据”
事实上,我在同一台机器上有一个emacs可执行文件(版本22.1.1),并且在相同的环境(例如,相同的〜/ .emacs等)中调用它之后,re-replace-region
就像它应该那样工作。
我唯一可以提供的另一个线索是,当在一个区域中运行重新替换区域时,如果在其中指定了三个9(999),试图将9更改为0,则第一个9在错误条件之前被更改上调。
这里是defun定义:
;;; RE-REPLACE-REGION replaces OLD (a regular expression) with NEW
;;; throughout the region indicated by BEGIN and END.
;;; For example, to insert a prefix ">" at the beginning of each line
;;; in the region:
;;; M-x re-replace-regionRET^RET>RET
;;; I don't know who wrote this function!
(defun re-replace-region (begin end old new)
"Replace occurrences of REGEXP with TO-STRING in region."
(interactive "*r\nsReplace string: \nswith: ")
(save-excursion
(save-restriction
(narrow-to-region begin end)
(goto-char (point-min))
(while (re-search-forward old (point-max) t)
(replace-match new nil nil)))))
请从'emacs -Q'(无init文件)开始,提供一步一步的重现问题的方法。显示你使用的命令和输入等等。如果你或者这里的人可以告诉你没有做错什么,那么考虑将这个行为报告为一个错误,或者给Aquamacs维护者或者使用'Mx report-emacs-bug',if你认为它不涉及Aquamacs。 – Drew