Emacs bookmark-jump:如何跳转到bmark并且只有一个拆分窗口更改内容?

发布于 2024-11-13 08:07:00 字数 342 浏览 2 评论 0原文

我从一个窗口中可见的文件开始;然后我做了一个分割窗口,因此现在两个窗口显示相同的内容(在相同的缓冲点)。

现在我想通过 2 个窗口中的 1 个窗口中的书签跳转到文件中的不同位置,但是当我执行书签跳转时,两个窗口最终都会到达书签点。

别管另一个窗口的点!

我该如何配置这个?

谢谢

(在 linux、GNU Emacs 23.2.1 上运行;xemacs 不会以这种方式运行)


后注:

我想做的是在两个窗口上显示相同的文件,而一个窗口 (w1) 显示文件的部分,在另一个窗口 (w2) 中,我使用各种书签跳转到不同的部分,而 w1 的位置不会改变。

I start with a file visible in one window; then i do a split-window, therefore now both windows show the same contents (at same buffer point).

Now I want to jump to a different location in the file via a bookmark in only 1 of the 2 windows, but when i execute the bookmark-jump, both windows end up at the bookmark's point.

Leave the other window's point alone!

How can i configure this?

Thanks

(running on linux, GNU Emacs 23.2.1; xemacs does not behave this way)


post-note:

What I'd like to do is to have the same file shown on both windows, and while one window (w1) shows a section of the file, in the other window (w2) I jump around to different sections, using the various bookmarks, while w1's position does not change.

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

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

发布评论

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

评论(6

比忠 2024-11-20 08:07:00

可能有一个直接的答案,但总的来说,我发现在多个窗口中显示相同的缓冲区时,各种事情都会变得不方便。我建议使用 间接缓冲区< /strong>。运行 Mx clone-indirect-buffer 创建另一个缓冲区,或运行 Cx 4 c (clone-indirect-buffer-other-window) 来创建另一个缓冲区在另一个窗口中显示新缓冲区。间接缓冲区与原始缓冲区内容相同,保存到相同文件,但缓冲区具有

  • 独立的点、标记、标记;
  • 独立模式(以及更一般的独立局部变量);
  • 独立视图(缩小、隐藏文本、面孔……)。

There may be a direct answer, but in general, I find that all kinds of things get inconvenient when displaying the same buffer in multiple windows. I recommend using indirect buffers. Run M-x clone-indirect-buffer to create another buffer, or C-x 4 c (clone-indirect-buffer-other-window) to also show the new buffer in another window. An indirect buffer has the same contents as the original, and saving saves to the same files, but the buffers have

  • independent points, marks, markers;
  • independent modes (and more generally independent local variables);
  • independent views (narrowing, hidden text, faces, …).
顾铮苏瑾 2024-11-20 08:07:00

这不会直接回答您的问题,而是为您的问题提供替代解决方案。我使用 bm.el 作为可见书签。如果同一个文件在两个窗口中可见,则使用可见书签跳转只会修改当前缓冲区中的点。

我已经使用以下内容配置了该包:

(require 'bm)
(setq bm-highlight-style 'bm-highlight-only-fringe)

(global-set-key (kbd "<C-f2>") 'bm-toggle)
(global-set-key (kbd "<f2>") 'bm-next)
(global-set-key (kbd "<S-f2>") 'bm-previous)

This doesn't answer your question directly, but provides an alternative solution to your problem. I use bm.el for visible bookmarks. If the same file is visible in two windows then jumping around using visible bookmarks only modifies the point in the current buffer.

I've configured the package with the following:

(require 'bm)
(setq bm-highlight-style 'bm-highlight-only-fringe)

(global-set-key (kbd "<C-f2>") 'bm-toggle)
(global-set-key (kbd "<f2>") 'bm-next)
(global-set-key (kbd "<S-f2>") 'bm-previous)
染火枫林 2024-11-20 08:07:00

如果您将clone-indirect-buffer-other-window与bookmark+和自动命名书签(Cx p RET / Cx pn / Cx pp)一起使用,它将按照您想要的方式工作。如果没有克隆,书签+对我来说似乎也有同样的问题。

If you use clone-indirect-buffer-other-window with bookmark+ and autonamed bookmarks (C-x p RET / C-x p n / C-x p p), it will work how you want. Without the clone, bookmark+ seems to have the same problem for me.

流云如水 2024-11-20 08:07:00

我使用这个函数(我发誓,从互联网复制)来进行分割。使用这个我认为你可以得到你想要的东西,但是做的顺序是相反的。

1) 使用书签打开另一个文件。
2)分割窗口。

;;----------------------------------------------------------------------------
;; When splitting window, show (other-buffer) in the new window
;;----------------------------------------------------------------------------
(defun split-window-func-with-other-buffer (split-function)
  "dont just dumb split window, change buffer as well"
  (lexical-let ((s-f split-function))
    (lambda ()
      (interactive)
      (funcall s-f)
      (set-window-buffer (next-window) (other-buffer)))))

(global-set-key "\C-x2"
        (split-window-func-with-other-buffer 'split-window-vertically))
(global-set-key "\C-x3"
        (split-window-func-with-other-buffer 'split-window-horizontally))

I use this function(I swear, copied from the internet) to do the splitting. using this I think you can get what you but order of doing is reverse.

1) open another file using bookmark.
2) split the window.

;;----------------------------------------------------------------------------
;; When splitting window, show (other-buffer) in the new window
;;----------------------------------------------------------------------------
(defun split-window-func-with-other-buffer (split-function)
  "dont just dumb split window, change buffer as well"
  (lexical-let ((s-f split-function))
    (lambda ()
      (interactive)
      (funcall s-f)
      (set-window-buffer (next-window) (other-buffer)))))

(global-set-key "\C-x2"
        (split-window-func-with-other-buffer 'split-window-vertically))
(global-set-key "\C-x3"
        (split-window-func-with-other-buffer 'split-window-horizontally))
天荒地未老 2024-11-20 08:07:00

尝试Bookmark+。正如您所描述的,它不会更改其他窗口中的窗口点。

Try Bookmark+. It does not change the window point in other windows as you describe.

耳钉梦 2024-11-20 08:07:00

回答自己的问题(几年后):

开始使用 emacs 24 (24.3.1),它“修复”了这种不需要的行为。

Answering own question (after a couple of years):

started using emacs 24 (24.3.1), which "fixed" this unwanted behavior.

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