如何在Emacs的标记环中前后移动 [英] How to move forward and backward in Emacs' mark ring

查看:135
本文介绍了如何在Emacs的标记环中前后移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Emacs中, C-u C-SPC 将跳转到标记,并将标记从
位置弹出本地标记环。有没有办法走相反的方式绕标记环?假设你已经打了几次Cu C-SPC,想回到你所看到的一个标记,而不是一路走来。

In Emacs, C-u C-SPC will "jump to the mark, and set the mark from position popped off the local mark ring". Is there a way to go the opposite way around the mark ring? Say you have typed C-u C-SPC several times and want to go back to a mark you have seen without going all the way around the ring.

推荐答案

它不完全符合你要求的要求,但是可能值得寻找一个名为marker-visit.el的包,它允许您以缓冲区位置顺序导航当前缓冲区中的标记。从该文件:

It doesn't do exactly what you're asking for, but it might be worth looking for a package called marker-visit.el which lets you navigate the marks in the current buffer in 'buffer position order'. From that file:

;;; Commentary:

;; This file provides a simple way to navigate among marks in a
;; buffer.  C-u C-SPC is similar, but takes you haphazardly around the
;; buffer.  Setting bookmarks is a lot of extra work if you just want
;; to jump around your buffer quickly; plus, you have to come up with
;; a name for every bookmark.

;; All the marks you've left while editing a buffer serve as bread
;; crumb trails of areas in the buffer you've edited.  It is
;; convenient to navigate back and forth among these marks in order.
;; This file provides two methods to do just that, marker-visit-prev
;; and marker-visit-next.  These two functions will take you, from
;; point, to the nearest mark in either direction.  The function
;; marker-visit-truncate-mark-ring will truncate the mark ring.

;; The marks you can visit in a buffer consist of: "the mark" plus the
;; contents of the mark-ring.

我将[S-up]和[S-down]绑定到marker-visit-prev和marker -visit-next分别。

I bind [S-up] and [S-down] to marker-visit-prev and marker-visit-next respectively.

如果你真的想/需要按照你的标记环的顺序导航,那么你可能会通过查看功能pop -to-mark-command和pop-mark,并实现自己的版本,以相反的方向旋转标记环。

If you really want/need to navigate in the order your mark-ring has currently, then you might get somewhere by looking at the functions pop-to-mark-command and pop-mark and implementing your own versions to rotate the mark ring in the opposite direction.

这篇关于如何在Emacs的标记环中前后移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆