emacs 编辑 Rnw 在突出显示 R 块时保持区域突出显示

发布于 2024-09-01 11:37:09 字数 275 浏览 10 评论 0原文

在 Emacs 中编辑 Rnw 文件时,我经常想让该区域覆盖包含 R 块的文本块。举一个简单的例子:

ewr
<<>>=
@ 
wer

我使用瞬态标记模式,以便突出显示该区域。但是,如果我将点放在第一行并点击 C-SPC,然后使用 Cn 向下移动点,当我尝试将点推进到 << 之前,突出显示就会消失。我想要的区域仍然处于选中状态,但在跨越 << 时突出显示似乎失败。我该如何解决这个问题?

谢谢并致以诚挚的问候

When editing an Rnw file in Emacs, I often want to make the region cover a chunk of text that contains an R chunk. For a simple example:

ewr
<<>>=
@ 
wer

I use transient-mark-mode such that the region is highlighted. But, if I put the point on the first line and hit C-SPC, then use C-n to move the point down, the highlighting disappears when I try to advance the point past the <<. The region I want is still selected, but highlighting seems to fail when crossing the <<. How can I fix this?

Thanks and best regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡水深流 2024-09-08 11:37:09

我发现当我执行您所描述的操作时,您的问题出现了,但是如果您使用 C-downC- 向下滚动,问题就会消失改为 M-n。我认为你甚至可以使用 C-down 来通过 R 块,然后使用 C-n 来步进之后过去的线路。

I find that your problem shows up when I do what you describe, but it goes away if you scroll down using C-down or C-M-n instead. I think you can even use C-down to get past the R chunk and then C-n to step past lines afterward.

傾旎 2024-09-08 11:37:09

我遇到了同样的问题,fojtasek 建议的解决方案对我不起作用,因为我有一个额外的配置问题。我希望这对您和其他用户有用。如果您使用 ESS 和 Auctex,请确保已完全加载 Auctex。更具体地说,原来是我之前安装auctex 11.86时,没有正确加载该包。因为我是一个 emacs 新手,所以我只加载了以下两行中的第一行:

(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

如果您没有添加第二行,您将只有一个 Auctex 菜单,而没有预览-latex 菜单。

I had the same problem and the solution suggested by fojtasek did not work for me because I had an additional configuration problem. I hope that this might be useful for you and other users. Make sure that if you are using ESS and Auctex that you have fully loaded Auctex. To be more specific, it turned out that when I had previously installed auctex 11.86, I did not correctly load the package. Because I am a novice emacs user, I only managed to load the first of the following two lines:

(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

If you have not added the second line, you will only have an Auctex menu but NOT a preview-latex menu.

豆芽 2024-09-08 11:37:09

感谢 Fojtasek 对 C 的建议。我发现 C- 和箭头键将保持连续的突出显示。 C-down 会弹出一个页面,上面写着“这个令人困惑的功能已默认禁用”。

在我看来,OP 抱怨的这种行为是 Auctex 的一个缺陷,而 Fojtasek 有办法避免它这一事实是有帮助的,但这仍然只是一种解决方法。我不希望 Auctex 这样做,而且我真的不想在滚动时用左手按住 C。皮塔饼。

如果 Auctex 需要一些特殊的选择工具,他们应该使用不寻常的击键。为什么要把它强加给我们其他人,他们只是想突出显示大的部分并移动它们,无论他们是否有<<>>在他们之中。

Thanks to Fojtasek for the C advice. I find C- with the arrow key will keep a contiguous highlight. C-down brings up a page that says "this confusing feature has been disabled by default".

In my opinion, this behavior that OP complained about is a flaw in Auctex, and the fact that Fojtasek has a way to avoid it is helpful, but still it is just a workaround. I don't want Auctex to to this and I don't really want to have to use my left hand for holding down C while scrolling. PITA.

If Auctex needs some special selection tool, they should have to use unusual keystrokes for that. Why impose it on the rest of us who just want to highlight big sections and move them around, whether or not they have <<>> in them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文