在 Emacs 中;
有没有既方式window-display-table,并buffer-display-table有在同一时间的效果呢?
原因是,我使用Pretty-Control-L(来自Emacs Goodies El脚本包)和空格(whitespace.el我认为它在基本 Emacs 发行版中,但我不确定)。
^L通过C-l在 window-local 中设置条目,以自定义方式可视化换页()window-display-table。buffer-display-table。(也可以通过使用font-lock功能)。这些用途的冲突(或更确切地说,使用一个window-display-table和buffer-display-table冲突),因为,如果window-display-table是非nil它完全覆盖任何buffer-display-table为任何缓冲在该窗口中显示。
引自Emacs Lisp手册:
38.21.2 活动显示表
每个窗口可以指定一个显示表,每个缓冲区也可以。当在窗口 W 中显示缓冲区 B 时,如果窗口 W 有显示表,则 display 使用窗口 W 的显示表;否则,缓冲区 B 的显示表(如果有);否则,标准显示表(如果有)。选择的显示表称为“活动”显示表。
[...]
(我强调)
那么,有没有简单的方法来巩固它?或者是重新编码其中一个以使用与另一个相同的机制的唯一方法?
I've been considering writing a small (i.e. even smaller) crude variant of the form-feed visualization compatible with the white-space visualization that just uses some buffer-loading hook (or other) to put a hard-coded entry for ^L in the buffer-display-table. But I’d like to know if there’s any simpler alternative.
EDIT: To clarify the problem, here's a excerpt of an annotated "Interactive Lisp" session (i.e. from the *scratch*-buffer). This shows the commands and their output, and annotated with the effects:
;; Emacs is started with `-q', to not load my init-file(s).
;; First, write some sample text with tabs and line-feeds:
"A tab: and some text
A line-feed:and some text"
;; Make sure that it is a tab on the first line (input by `C-q TAB')
;; and a line-feed on the second line (input by `C-q C-l').
;; These probably won't copy properly into Stack Exchange.
;; This shows the spaces as center-dots, tabs as `>>'-glyphs and
;; new-lines as $'s (or perhaps other glyphs, depending on system
;; setup...). All of them fontified to be dimmed out on yellow/beige/white
;; background.
(whitespace-mode t)
t
;; This turns on pretty-control-l mode. The `^L' above will be
;; prettified... Since this sets the window display table, the glyphs
;; for the spaces/tabs/new-lines will disappear, but the background of
;; spaces/tabs will still be yellow/beige (since that's done with
;; fontification, not display tables).
(pretty-control-l-mode t)
t
;; This turns pretty-control-l mode OFF again. The form-feed will
;; revert to displaying as `^L'. However, the glyphs for the
;; spaces/tabs/new-lines will not re-appear, since this only removes
;; the `C-l'-entry in the window-display-list, not the entire list.
(pretty-control-l-mode 0)
nil
;; Nil the window-display-table, to verify that is the culprit. This
;; will re-enable the glyphs defined by whitespace-mode (since they
;; are still in the buffer display-table).
(set-window-display-table nil nil)
nil
;; To round of; this is my Emacs-version:
(emacs-version)
"GNU Emacs 23.4.1 (i686-pc-linux-gnu, GTK+ Version 2.24.12)
of 2012-09-22 on akateko, modified by Debian"
;;End.
Run Code Online (Sandbox Code Playgroud)
抱歉给您带来麻烦。按照您的食谱,我没有看到您报告的问题。也许描述不完整?我可以同时打开pretty-control-l-mode和whitespace-mode,并且我看到的每个行为似乎都很正常。也许您使用了一些自定义设置whitespace-style或其他什么?
无论如何,如果您对 进行这样的更改,也许会有所帮助pretty-control-l-mode。如果是这样,请告诉我,我会将其应用到pp-c-l.el. (要进行测试,请将新选项设置为nil。)
(defcustom pp^L-use-window-display-table-flag t\n "Non-nil: use `window-display-table\'; nil: use `buffer-display-table`."\n :type \'boolean :group \'Pretty-Control-L)\n\n (define-minor-mode pretty-control-l-mode\n "Toggle pretty display of Control-l (`^L\') characters.\n With ARG, turn pretty display of `^L\' on if and only if ARG is positive."\n :init-value nil :global t :group \'Pretty-Control-L\n (if pretty-control-l-mode\n (add-hook \'window-configuration-change-hook \'refresh-pretty-control-l)\n (remove-hook \'window-configuration-change-hook \'refresh-pretty-control-l))\n (walk-windows\n (lambda (window)\n (let ((display-table (if pp^L-use-window-display-table-flag ; <=========\n (or (window-display-table window)\n (make-display-table))\n (if buffer-display-table\n (copy-sequence buffer-display-table)\n (make-display-table)))))\n (aset display-table ?\\014 (and pretty-control-l-mode\n (pp^L-^L-display-table-entry window)))\n (if pp^L-use-window-display-table-flag ; <=========\n (set-window-display-table window display-table)\n (setq buffer-display-table display-table))))\n \'no-minibuf\n \'visible))\nRun Code Online (Sandbox Code Playgroud)\n\n更新以添加评论线程,以防评论在某个时候被删除:
\n\n\n\n顺便说一句,我想知道文档中描述的显示表的层次结构是否不应该使用某种继承来应用。对于一个级别(例如窗口)来说,完全遮蔽较低级别(例如缓冲区)似乎有点原始。您可以考虑向 Mx report-emacs-bug 发送有关此问题的问题。\xe2\x80\x93 德鲁 2014 年 9 月 24 日 16:36
\n\n平?您能否告诉我上述更改是否有帮助?谢谢。\xe2\x80\x93 德鲁 2014 年 10 月 14 日 18:12
\n\n我刚刚读了这个答案(我有一段时间没有接触过互联网的这一部分......)。当我有时间的时候,也许几天左右,我会检查一下。稍后我会酌情返回\xe2\x80\x98批准的\xe2\x80\x99答案(如果有效)或评论(否则)。\xe2\x80\x93 约翰 E 14 年 10 月 25 日 22:32
\n\n我编辑了这个问题,添加了一个更具体的方法来显示问题。我很想知道你是否能得到相同的结果。--- 另外,有没有一种方法可以用用户提供的文件来隐藏系统安装的 .el 文件(我实际上只是一个 \xe2\x80\x9cuser\xe2\x80\x9d,而不是 lisp 程序员...)?我真的不想弄乱 deb-packages 安装的文件。(这就是为什么我在测试你的答案之前做了问题配方......) \xe2\x80\x93 Johan E Oct 27 \'14 at 1:02
\n\n在写完最后一条评论五秒钟后,我意识到我可以将代码粘贴到草稿中并 Cj 运行它来测试。(无需编辑任何文件。) 结果:它很有魅力!谢谢你!(=> 答案已接受)但是,我仍然想知道您是否从我的问题配方中得到与我相同的结果(在修补代码之前)。\xe2\x80\x93 约翰 E 14 年 10 月 27 日 1:09
\n\n我刚刚遵循了你的新食谱,我看到了你描述的一切(如此清晰)。然后我读到了你刚刚添加的新评论。很高兴知道一切正常。感谢您的反馈。\xe2\x80\x93 德鲁 2014 年 10 月 27 日 1:12
\n
| 归档时间: |
|
| 查看次数: |
219 次 |
| 最近记录: |