Emacsのウィンドウ表示テーブルとバッファ表示テーブルの競合

Emacsのウィンドウ表示テーブルとバッファ表示テーブルの競合

Emacsでは。

window-display-table同時に2つのbuffer-display-tableことを行う方法はありますか?

その理由は私が使っているからです。美しいコントロール-L(からEmacs 良いこと Elスクリプトパッケージ)とスペースwhitespace.elデフォルトのEmacsディストリビューションにあるようですが、わかりません。)

  • 美しいコントロール-Lローカルウィンドウに設定された項目を使用してカスタマイズされた^L方法で改ページを視覚化する()C-lwindow-display-table
  • スペースローカルバッファにエントリを設定して、スペース、タブ、および改行を可視化します。buffer-display-table。 (また、関数を使用してfont-lock)。

競合を使用します(または競合を使用しますwindow-display-tablebuffer-display-tablewindow-display-tableそうでない場合は、そのウィンドウに表示されているすべてのバッファの内容がnil完全に上書きされます。buffer-display-table

から引用Emacs Lisp手動:

38.21.2 アクティビティ表示テーブル

各バッファと同様に、各ウィンドウに表示テーブルを割り当てることができます。バッファBがウィンドウWに表示されているときにウィンドウWに表示テーブルがある場合、表示はウィンドウWの表示テーブルを使用します。そうでなければ、バッファBの表示テーブル(存在する場合)、そうでない場合は標準表示テーブル(存在する場合)。選択した表示テーブルを「アクティブ」表示テーブルと呼びます。

[...]

(私の強調)

それではこれをしっかりとする簡単な方法はないだろうか?それとも、1つを再コーディングして他のものと同じメカニズムを使用する唯一の方法ですか?

私は空の可視化と互換性のある、ハードコーディングされたアイテム^Lbuffer-display-table。しかし、もっと簡単な代替案があるかどうか疑問に思います。


編集する:問題を明確にするために、「Interactive Lisp」セッション(例:-buffer *scratch*)からの抜粋があります。以下は、効果として注釈付きのコマンドと出力を示しています。

;; 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.

ベストアンサー1

問題を起こして申し訳ありません。あなたのレシピによれば、あなたが報告した問題は見えません。説明が不完全なのではないでしょうか?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
   "Non-nil: use `window-display-table'; nil: use `buffer-display-table`."
   :type 'boolean :group 'Pretty-Control-L)

 (define-minor-mode pretty-control-l-mode
     "Toggle pretty display of Control-l (`^L') characters.
 With ARG, turn pretty display of `^L' on if and only if ARG is positive."
   :init-value nil :global t :group 'Pretty-Control-L
   (if pretty-control-l-mode
       (add-hook 'window-configuration-change-hook 'refresh-pretty-control-l)
     (remove-hook 'window-configuration-change-hook 'refresh-pretty-control-l))
   (walk-windows
    (lambda (window)
      (let ((display-table  (if pp^L-use-window-display-table-flag ; <=========
                                (or (window-display-table window)
                                    (make-display-table))
                              (if buffer-display-table
                                  (copy-sequence buffer-display-table)
                                (make-display-table)))))
        (aset display-table ?\014 (and pretty-control-l-mode
                                       (pp^L-^L-display-table-entry window)))
        (if pp^L-use-window-display-table-flag                     ; <=========
            (set-window-display-table window display-table)
          (setq buffer-display-table display-table))))
    'no-minibuf
    'visible))

コメントスレッドを追加するように更新されました。、ある時点でコメントが削除された場合:

しかし、ドキュメントで説明されている表示テーブルの階層が一種の継承を使用して適用されるべきではないかどうか疑問に思います。 1つのレベル(ウィンドウなど)が下位レベル(バッファなど)を完全に隠すのは、少し原始的なようです。この問題に関する質問を Mx Report-emacs-bug に送信することを検討できます。 – Drew 2014年9月24日 16:36

フラット?上記の変更が役立つかどうか教えてもらえますか?ありがとうございます。 – ドリュー 2014-10-14 18:12

私はこの回答を読みました(しばらくインターネットのこの部分に行ったことがありません...)。時間があれば数日ほど確認してみてください。後で私の裁量により、「回答の承認」(有効な場合)またはコメント(そうでない場合)に返信します。 – ヨハンE 2014-10-25 22:32

問題を表示するより具体的な方法を追加するために質問を編集しました。同じ結果が得られれば興味があるでしょう。 ---また、ユーザー提供のファイルでシステムにインストールされた.elファイルを非表示にする方法はありますか? (私は実際にlispプログラマーではなく「ユーザー」です...)私はdeb-packagesでインストールされたファイルを混乱させたくありません。 (だから答えをテストする前に問題のレシピを作りました...) – Johan E 2014-10-27 1:02

最後のコメントを書いてから5秒後にコードを貼り付けるだけで良いことに気づきました。傷跡その後、Cjはテストのためにそれを実行します。 (ファイルを編集する必要はありません。)結果:本当に魅力的でした!ありがとうございます! (=>回答を許可する)しかし、問題のレシピで私と同じ結果が得られるか(コードをパッチする前に)知りたいです。 – Johan E 2014年10月27日 1:09

私はあなたの新しいレシピに従い、あなたが説明するすべてを(非常に明確に)見ています。その後、追加したばかりの新しいコメントを読みました。すべてがうまく機能していることを知ってうれしいです。フィードバックをお寄せいただきありがとうございます。 – ドリュー 2014-10-27 1:12

おすすめ記事