- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试定义一些 emacs 字体以进行一些自定义突出显示。当我单独定义它们时,这似乎有效:
(defface my-r-face `((t (:foreground "red"))) "Red highlight")
(defvar m-r-face 'my-r-face "Red.")
(defface my-g-face `((t (:foreground "green"))) "Green highlight")
(defvar m-g-face 'my-g-face "Green.")
(defface my-b-face `((t (:foreground "#0088ff"))) "Blue highlight")
(defvar m-b-face 'my-b-face "Blue.")
....etc
但是我有几十个这样的,我想从某种颜色表中一次性定义它们:
(setq ctable '(("red" "r")
("orange" "o")
("yellow" "y")
("#88ff00" "gy")
("green" "g")
("#00ff88" "gc")
("cyan" "c")
("#0088ff" "bc")
("blue" "b")
("purple" "bm")
("magenta" "m")
("#ff0088" "rm")
("grey" "lg")
("white" "w") ))
我的困难在于为每张脸组装符号名称,即将“my-”和“-face”连接到表中条目的任一侧。我发现 (intern) 可以从字符串中创建一个新符号,但是这个符号不能被 (defface) 接受,因为我所做的似乎等同于 (defface 'my-r-face ...,并且 defface 不喜欢引用的符号,并期望 (defface my-r-face .. 相反。我的尝试如下:
(dolist (tpl ctable)
(defvar (intern (concat "my-" (nth 1 tpl) "-face"))
(quote (intern (concat "my-" (nth 1 tpl) "-face"))) "colour")
(defface (intern (concat "my-" (nth 1 tpl) "-face"))
`((t (:foreground ,(car tpl)))) "Highlight" :group 'fortran)
)
运行结果为
Lisp error: (wrong-type-argument symbolp (intern (concat "fegs-" (nth 1 tpl) "-face")))
(defvar (intern (concat "fegs-" ... "-face")) (quote (intern ...)) "colour")
任何人都可以阐明我做错了什么,或者如果我完全错误地吠叫错误的树并且有更好的方法来做到这一点?
谢谢。
最佳答案
你可以避免eval
:
(defconst my-ctable '(...))
(defmacro my-init-cfaces ()
`(progn
,@(mapcar (lambda (tpl)
`(defface ,(intern (format "my-%s-face" (nth 1 tpl)))
'((t :foreground ,(car tpl)))
,(format "Face for color %s." (car tpl))
:group 'fortran))
my-ctable)))
(my-init-cfaces)
关于emacs - 如何定义多个 emacs 面孔?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20000531/
似乎可见的铃铛颜色是倒置的默认面,但我找不到在哪里以及如何控制它。 我知道可以设置 ring-bell-function 但这不是我想知道的。 最佳答案 在 Elisp 中无法控制可见铃的外观,因为它
使用下面的代码在 R 中生成热图。效果很好。第一部分是我用来为 map 着色的指标。我的问题是如何让标题如下所示。我知道有人会将第一行放在以 caption = Paste ("Source...")
我正在尝试定义一些 emacs 字体以进行一些自定义突出显示。当我单独定义它们时,这似乎有效: (defface my-r-face `((t (:foreground "red"))) "Red
我指的是 this post用于 3d 转换。 所以我尝试动态设置 .container 的透视属性,这样相邻的面应该垂直于正面,如下图绿线所示。 相关代码 .container { width:
首先,如果标题很长,我很抱歉。我正在使用 python 进行人脸检测。我正在尝试编写一个脚本,当在两个目录/文件夹之间检测到相同的图片或几乎相同的图片/面孔时,它将通知用户。 以下是我到目前为止编写的
我是一名优秀的程序员,十分优秀!