[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 620e35f: Add a new function for separator lines
From: |
Lars Ingebrigtsen |
Subject: |
master 620e35f: Add a new function for separator lines |
Date: |
Mon, 19 Jul 2021 09:48:27 -0400 (EDT) |
branch: master
commit 620e35f09fd5c2cc08792bb88de57047e29620ad
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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).
---
etc/NEWS | 7 +++++++
lisp/help-fns.el | 6 +-----
lisp/help.el | 7 +------
lisp/simple.el | 21 +++++++++++++++++++++
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 29568e7..e241b51 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2222,6 +2222,13 @@ This command, called interactively, toggles the local
value of
** Miscellaneous
+---
+*** New utility function 'make-separator-line'.
+
+---
+*** New face 'separator-line'.
+This is used by 'make-separator-line'.
+
+++
*** New user option 'ignored-local-variable-values'.
This is the opposite of 'safe-local-variable-values' -- it's an alist
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index cb248b1..81d7f23 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1573,11 +1573,7 @@ current buffer and the selected frame, respectively."
(insert doc)
(delete-region (point)
(progn (skip-chars-backward " \t\n") (point)))
- (insert "\n\n"
- (eval-when-compile
- (propertize "\n" 'face
- '(:height 0.1 :inverse-video t :extend t)))
- "\n")
+ (insert "\n\n" (make-separator-line) "\n")
(when name
(insert (symbol-name symbol)
" is also a " name "." "\n\n"))))
diff --git a/lisp/help.el b/lisp/help.el
index 1bb1b30..ba27fc5 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -943,12 +943,7 @@ current buffer."
(when defn
(when (> (length info-list) 1)
(with-current-buffer standard-output
- (insert "\n\n"
- ;; FIXME: Can't use eval-when-compile because purified
- ;; strings lose their text properties :-(
- (propertize "\n" 'face
- '(:height 0.1 :inverse-video t :extend t))
- "\n")))
+ (insert "\n\n" (make-separator-line) "\n")))
(princ brief-desc)
(when locus
diff --git a/lisp/simple.el b/lisp/simple.el
index 6de2190..ea3ccb3 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 620e35f: Add a new function for separator lines,
Lars Ingebrigtsen <=