Emacs에서 창 표시 테이블과 버퍼 표시 테이블이 충돌합니다.

Emacs에서 창 표시 테이블과 버퍼 표시 테이블이 충돌합니다.

이맥스에서는;

window-display-table동시에 buffer-display-table효과를 얻을 수 있는 방법이 있나요 ?

그 이유는 내가 사용하고 있기 때문이다.프리티컨트롤-L(에서Emacs Goodies 엘스크립트 패키지) 및공백( whitespace.el내 생각에는 기본 Emacs 배포판에 있는 것 같지만 확실하지 않습니다.)

  • 프리티컨트롤-L창 로컬에서 ^L항목을 설정하여 사용자 정의된 방식으로 용지 공급( )을 시각화합니다.C-lwindow-display-table.
  • 공백버퍼 로컬에 항목을 설정하여 공백, 탭 및 줄 바꿈을 시각화합니다.buffer-display-table. (또한 font-lock기능을 사용하여).

window-display-table이는 충돌(또는 a 와 충돌 의 사용 buffer-display-table)을 사용합니다. 왜냐하면 가 window-display-table아닌 경우 해당 창에 표시된 모든 버퍼에 대해 nil완전히 재정의하기 때문입니다.buffer-display-table

에서 인용이맥스 리스프수동:

38.21.2 활성 디스플레이 테이블

각 창은 표시 테이블을 지정할 수 있으며 각 버퍼도 마찬가지입니다. 버퍼 B가 창 W에 표시될 때 디스플레이는 창 W에 대한 표시 테이블이 있는 경우 그 표시 테이블을 사용합니다.그렇지 않으면, 버퍼 B에 대한 표시 테이블(있는 경우); 그렇지 않은 경우에는 표준 표시 테이블입니다. 선택된 디스플레이 테이블을 "활성" 디스플레이 테이블이라고 합니다.

[...]

(제가 강조함)

그렇다면 이를 통합하는 쉬운 방법이 있습니까? 아니면 그 중 하나를 다시 코딩하여 다른 것과 동일한 메커니즘을 사용하는 유일한 방법입니까?

^L나는 하드 코딩된 항목을 넣기 위해 일부 버퍼 로딩 후크(또는 기타)를 사용하는 공백 시각화와 호환되는 폼 피드 시각화의 작은(즉, 더 작은) 조잡한 변형을 작성하는 것을 고려하고 있습니다. buffer-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))

댓글 스레드를 추가하도록 업데이트되었습니다., 어느 시점에서 댓글이 삭제되는 경우:

그런데 문서에 설명된 표시 테이블의 계층 구조가 일종의 상속을 사용하여 적용되어서는 안되는지 궁금합니다. 한 수준(예: 창)이 하위 수준(예: 버퍼)을 완전히 가리는 것은 약간 원시적인 것 같습니다. 이에 대한 질문을 Mx Report-emacs-bug에 보내는 것을 고려할 수 있습니다. — 드류

핑? 위의 변경 사항이 도움이 되었는지 알려주시겠어요? 고마워. — 드류

방금 이 답변을 읽었습니다. (저는 한동안 이 부분의 인터넷을 사용하지 않았습니다...) 아마도 며칠 정도 후에 문제가 해결되면 확인해 보겠습니다. 나중에 적절하게 '답변 승인'(작동하는 경우) 또는 의견(그렇지 않은 경우)을 보내 드리겠습니다. — Johan E 25 oct.

문제를 보여주기 위해 좀 더 구체적인 방법을 추가하기 위해 질문을 편집했습니다. 동일한 결과가 나오는지 궁금합니다. --- 또한 ​​사용자가 제공한 파일로 시스템에 설치된 .el 파일을 섀도잉하는 방법이 있습니까(저는 실제로 lisp 프로그래머가 아닌 "사용자"입니다...)? 나는 deb-packages에 의해 설치된 파일을 엉망으로 만들고 싶지 않습니다. (그래서 답변을 테스트하기 전에 문제 레시피를 작성했습니다...) – Johan E 27 oct.

마지막 댓글을 쓴 지 5초 후에 코드를 붙여넣기만 하면 된다는 것을 깨달았습니다.할퀴다Cj를 실행하여 테스트해 보세요. (어떤 파일도 편집할 필요가 없습니다.) 결과: 정말 매력적이었습니다! 감사합니다! (=> 답변 허용) 그러나 코드를 패치하기 전의 문제 레시피에서 나와 동일한 결과를 얻을 수 있는지 알고 싶습니다. — Johan E 27 oct.

나는 방금 당신의 새로운 레시피를 따랐고 당신이 설명한 모든 것을 (매우 명확하게) 보았습니다. 그리고 방금 추가한 새 댓글을 읽었습니다. 문제가 잘 해결되어서 다행입니다. 피드백을 보내주셔서 감사합니다. — Drew 27 oct.

관련 정보