diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-19 15:48:20 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-19 15:48:20 +0200 |
commit | 620e35f09fd5c2cc08792bb88de57047e29620ad (patch) | |
tree | d0e22f02543d4e9f7a1c0e216c2d88c96dc6a2e2 /lisp/simple.el | |
parent | 13b247c3c48a3e8b64ece8d4014c484473c8e362 (diff) | |
download | emacs-620e35f09fd5c2cc08792bb88de57047e29620ad.tar.gz |
Add a new function for separator lines
* lisp/help-fns.el (describe-symbol): Use it.
* lisp/help.el (describe-key): Use it.
* lisp/simple.el (separator-line): New face.
(make-separator-line): New function (bug#49630).
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 6de21902210..ea3ccb388e5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -695,6 +695,27 @@ When called from Lisp code, ARG may be a prefix string to copy." (indent-to col 0) (goto-char pos))) +(defface separator-line + '((((type graphic)) :height 0.1 :inverse-video t) + (t :foreground "ForestGreen")) + "Face for separator lines." + :version "28.1" + :group 'text) + +(defun make-separator-line (&optional length) + "Make a string appropriate for usage as a visual separator line. +This uses the `separator-line' face. + +If LENGTH is nil, use the window width." + (if (display-graphic-p) + (if length + (concat (propertize (make-string length ?\s) 'face 'separator-line) + "\n") + (propertize "\n" 'face '(:inherit separator-line :extend t))) + (concat (propertize (make-string (or length (1- (window-width))) ?-) + 'face 'separator-line) + "\n"))) + (defun delete-indentation (&optional arg beg end) "Join this line to previous and fix up whitespace at join. If there is a fill prefix, delete it from the beginning of this |