如何改变mode-line上日期的颜色

如题,怎么改变mode-line上日期的颜色,我想把星期高亮显示。

只高亮Tue就可以了。

你没代码不好说明啊。找到那个生成Tue的变量 比如是str 然后再找一个喜欢的高亮颜色

(propertize str 'face 'highlight)

代码如下: (display-time-mode 1) (setq display-time-24hr-format t) (setq display-time-day-and-date t)

custom variables '(display-time-default-load-average nil) '(display-time-format "%a, %b %d %Y, %H:%M")

额,这就不好配置了,你手写mode line format的部分呢,重新写一遍关于时间的地方呗。

我的mode-line是仿照陈斌的配置写的,但没有关于时间的配置,这个是自己生成的。所以不大好办,customize-group里面也没有找到关于face的部分。

     (setq-default mode-line-format
          (list
            " %1"
            '(:eval
                (winum-get-number-string))
            " %1"
            ;; the buffer name; the file name as a tool tip
            '(:eval (propertize "%b " 'face nil
                'help-echo (buffer-file-name)))
            ;; relative position
            "["
            (propertize "%p" 'face 'font-lock-constant-face) ;; % above top
            "/"
            (propertize "%I" 'face 'font-lock-constant-face) ;; size
            "] "
            ;; the current major mode for the buffer.
            "["
            '(:eval (propertize "%m" 'face nil
                      'help-echo buffer-file-coding-system))
            ;; was this buffer modified since the last save?
            '(:eval (when (buffer-modified-p)
                      (concat ","  (propertize "Mod"
                                     'face nil
                                     'help-echo "Buffer has been modified"))))
            "] "
            ;;global-mode-string, org-timer-set-timer in org-mode need this
            (propertize "%M" 'face nil)
            ;; ;; line and column
            ;; "(" ;; '%02' to set to 2 chars at least; prevents flickering
            ;; "%02l" "," "%01c"
            ;; ;; (propertize "%02l" 'face 'font-lock-type-face) ","
            ;; ;; (propertize "%02c" 'face 'font-lock-type-face)
            ;; ") "
            " --"
            ;; i don't want to see minor-modes; but if you want, uncomment this:
            ;; minor-mode-alist  ;; list of minor modes
            "%-" ;; fill with '-'
            ))

所以说随便自己加啊,像怎么配置格式怎么配置格式

(propertize (format-time-string "%a, %b %d %Y, %H:%M") 'face 'font-lock-constant-face)

嗯,可以了,谢谢。

顺便问一下,这个 display-time-mode 在终端下的 Emacs 没发显示?

终端下能显示,刚刚用 emacs -Q -nw -f display-time-mode 试了一遍。

多谢,我写成 (setq display-time-mode 1),去掉 setq 即可。

变量some-mode的值只能用来指示some-mode有没有启用,启用一定要函数(some-mode 1)some-mode这个函数由package作者定义,会做很多事情,用户自己setq会把这些通通漏掉。