【问题标题】:configure colors in hexl-mode emacs在 hexl-mode emacs 中配置颜色
【发布时间】:2013-04-11 15:08:00
【问题描述】:

我想在使用 hexl-mode 显示时配置不同部分数据的颜色。

例如,我希望地址范围为白色背景, 黄色的字节,红色的 ASCII(随便)。

00000000: 2550 4446 2d31 2e34 0a25 c7ec 8fa2 0a35 %PDF-1.4.%.....5 00000010: 2030 206f 626a 0a3c 3c2f 4c65 6e67 7468 0 对象。

我尝试像这样更新我的颜色主题:

 (hexl-address-region ((t (:background "#252525"))))
 (hexl-ascii-region ((t (:foreground "#cfbfad"))))

但这显然不起作用。颜色没有改变:(

我的全彩主题:

(eval-when-compile
   (require 'color-theme))

(defun sublime-text-2 ()
   "Color theme that looks like the Sublime Text 2 editor."
   (interactive)
   (color-theme-install
    '(sublime-text-2
      ((background-color . "#171717")
       (background-mode . light)
       (border-color . "#1a1a1a")
       (cursor-color . "#fce94f")
       (foreground-color . "#cfbfad")
       (mouse-color . "black"))
       (fringe ((t (:background "#1a1a1a"))))
       (mode-line ((t (:foreground "#eeeeec" :background "#555753"))))
       (region ((t (:foreground "#404040" :background "#CC9900"))))
       (font-lock-builtin-face ((t (:foreground "#52e3f6"))))
       (font-lock-comment-face ((t (:foreground "#ffffff"))))
       (font-lock-function-name-face ((t (:foreground "#edd400"))))
       (font-lock-keyword-face ((t (:foreground "#ff007f"))))
       (font-lock-string-face ((t (:foreground "#ece47e"))))
       (font-lock-type-face ((t (:foreground"#8ae234"))))
       (font-lock-variable-name-face ((t (:foreground "#8ae234"))))
       (minibuffer-prompt ((t (:foreground "#729fcf" :bold t))))
       (font-lock-warning-face ((t (:foreground "Red" :bold t))))
       (hexl-address-region ((t (:background "#252525"))))
       (hexl-ascii-region ((t (:foreground "#cfbfad"))))
       (speedbar-directory-face ((t (:foreground "light blue"))))
       (speedbar-tag-face ((t (:foreground "#cfbfad"))))
 )))

【问题讨论】:

    标签: emacs hex


    【解决方案1】:

    我能够复制您的问题。 hexl-mode 似乎有一个问题,它在模式启动时没有字体化缓冲区。

    要强制 hexl-mode 字体化缓冲区,请将其添加到您的 .emacs 中

    (require 'hexl)
    (add-hook 'hexl-mode-hook 'font-lock-fontify-buffer)
    

    我还提交了有关该问题的错误报告。

    【讨论】:

    • 我在读取颜色之前将其添加到 .emacs 中,但绝对没有变化:在 hexl 模式下没有颜色...
    • 尝试在 hexl 模式下运行 m-x font-lock-fontify-buffer,如果这不起作用。对 hexl 中的文本执行 m-x describe-face 并验证您的颜色更改是否正在发生。