怎么以占全宽的underline或overline标记当前鼠标所在行?标题似乎不清楚,这是一个完整的句子? hl-line只能在有字符的地方划underline或overline,怎么弄成全宽呢?
论坛怎么对标题还有要求?
WhiteSpace uses two ways to visualize blanks: Faces and display table.
- Faces are used to highlight the background with a color. WhiteSpace uses font-lock to highlight blank characters, see FontLockMode.
- Display table changes the way a character is displayed, that is, it provides a visual mark for characters, for example, at the end of line (?\xB6), at SPACEs (?\xB7) and at TABs (?\xBB). 能否在有字符的地方用1,在行结尾用2?
foreground无法整行highlight,background可以:
(highlight ((t (:foreground nil :background “LightSteelBlue4”))))
或许是论坛(Discourse)本地化有问题,有或者是我们的设置有问题,标题当然有要求(如不能太短或太长),我猜测是因为西文语境下的规则不能照搬到中文(如中文不加空格)。
1 个赞
我是想在当前行通长上划线,因为高亮颜色总会影响对比度。
找到这个
大师帮忙弄一下啊
(defun my-overline ()
(interactive)
(let* ((beg (line-beginning-position))
(end (line-end-position))
(overline (make-overlay beg end))
(str (propertize
;; a space with one pixel height
(concat (propertize "\s" 'display '(space :height (1)))
;; visible content alone should determine the line height
(propertize "\n" 'line-height t))
'face '(:background "gray"))))
;; delete overlay if containing text is removed from buffer
(overlay-put overline 'evaporate t)
;; place the single pixel newline before to look like an overline
(overlay-put overline 'before-string str)
overline))
(font-lock-add-keywords 'org-mode
'(("^\\*[^*]"
(0 (prog1 nil
(my-overline))))) 'append)
可以看看hl-line-mode
是怎么实现的