我在Windoze PC上通过VNC在多台显示器上使用GNU EMACS。
(目前有5-4个大小,1个是我的平板电脑上的小显示器。两个垂直的1200x1920,两个水平的1920x1200,外加小的。)
我目前的做法是在每个监视器上运行单独的VNC。然后,我打开一个emacs,并使用make-frame- other -display在另一个VNC窗口中打开emacs的框架。
让事情更复杂的是,我在最新的Ubuntu系统上运行VNC,但我在一台非常过时的机器上运行emacs,其余的构建工具都在这台机器上运行。即VNC显示与emacs不在同一台机器上。
我没有使用xhost+,而是在每个VNC中打开一个xterm,并使用ssh访问运行emacs的机器。这将创建格式为localhost:16.0的显示。然后,我使用这些localhost显示来使用make-frame-on-display。
这会让人感到困惑。
如果我在xterm窗口中留下一个"echo $DISPLAY“,这会很有帮助。或者使用xterm的标题。
我想类似地更改EMACS的frame的标题,以反映每个frame的当前显示。但是在做
(defvar frame-title-specific-ag "emacs"
"title element from frame-title-format that is specific to a particular emacs instance; andy glew")
(setq frame-title-format
(list
"frame=%F "
(format "%s" frame-title-specific-ag)
" " 'system-name
" DISPLAY="
(getenv "DISPLAY")
" %b"
" " (format "pid:%d" (emacs-pid))
" user:"(user-login-name))
)仅获取整个emacs的显示变量。
问:有没有办法找出与任何特定帧相关的显示?
发布于 2012-07-03 05:07:26
若要获取当前帧的显示名称,请使用
(frame-parameter nil 'display)或者将nil替换为特定的帧,以获取其显示的名称,而不是当前显示的名称。例如,使用此命令可显示标题中的显示内容:
(setq frame-title-format
'("DISPLAY=" (:eval (frame-parameter nil 'display))))请注意,此表单要完全用引号括起来,这一点很重要,因此所使用的列表具有一个:eval,它告诉Emacs在呈现框架标题时运行代码。如果没有它,你可能会想要写一些类似这样的东西:
(setq frame-title-format
(list "DISPLAY=" (frame-parameter nil 'display)))但这不管用。问题是,当计算此表单时,函数调用立即发生,结果是一个包含特定字符串的列表,该字符串是执行此计算时发生的任何帧的名称,并且该字符串不会神奇地更改。
发布于 2012-07-03 14:00:09
Eli Barzilay告诉我们
(frame-parameter nil 'display)也就是90%的路程。
下面将与当前选定框架相关联的显示放在其框架标题中。
(setq frame-title-format
'(
"DISPLAY="
(:eval (frame-parameter nil 'display))
)
)Glew:这会在创建框架时(例如,通过make- frame -on- display )在标题中显示当前选定的框架。由于这可能是一个不同的帧,在一个完全不同的显示中,它并不总是需要的。
未加引号、未:eval‘’ed的窗体在计算setq时将当前选定帧的显示放在标题中。这甚至不是我们想要的。
这是我最终得到的结论:
我如上设置了默认的frame-title-format。但我并不真正使用它,因为我挂接了以下内容:
(defun ag-set-frame-title (frame)
"set frame-title to glew preference, optional arg FRAME / default nil (currently selected frame)"
(interactive)
;; TBD: make-variable-frame-local is deprecated in more recent versions of emacs
;; than the antiquated version at my work. use modify-frame-parameters instead
(let (x)
(setq x
(concat
(or frame-title-specific-ag "emacs")
" " system-name
" DISPLAY=" (frame-parameter frame 'display)
" " (format "pid:%d" (emacs-pid))
" user:" (user-login-name)
;;" " (buffer-name)
)
)
(modify-frame-parameters frame (list (cons 'title x)))
)
)
;; TBD: this old emacs does not have modern hooks
(setq after-make-frame-functions '(ag-set-frame-title))作为一个好的衡量标准:
(defun ag-fix-frame-titles ()
"run ag-set-frame-title on frame-lits"
(interactive)
(mapc 'ag-set-frame-title (frame-list))
)
(ag-fix-frame-titles)注意:根据注释字符串,这里描述的修复可能只在旧版本的emacs上需要,比如21.4.1。@EliBarzilay说,无论他使用的是什么版本的emacs,都不需要。
减去你想要的分数,伙计们。这是事实。
https://stackoverflow.com/questions/11301062
复制相似问题