diff options
| author | Lars Ingebrigtsen | 2021-07-19 15:48:20 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-07-19 15:48:20 +0200 |
| commit | 620e35f09fd5c2cc08792bb88de57047e29620ad (patch) | |
| tree | d0e22f02543d4e9f7a1c0e216c2d88c96dc6a2e2 | |
| parent | 13b247c3c48a3e8b64ece8d4014c484473c8e362 (diff) | |
| download | emacs-620e35f09fd5c2cc08792bb88de57047e29620ad.tar.gz emacs-620e35f09fd5c2cc08792bb88de57047e29620ad.zip | |
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).
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/help-fns.el | 6 | ||||
| -rw-r--r-- | lisp/help.el | 7 | ||||
| -rw-r--r-- | lisp/simple.el | 21 |
4 files changed, 30 insertions, 11 deletions
| @@ -2222,6 +2222,13 @@ This command, called interactively, toggles the local value of | |||
| 2222 | 2222 | ||
| 2223 | ** Miscellaneous | 2223 | ** Miscellaneous |
| 2224 | 2224 | ||
| 2225 | --- | ||
| 2226 | *** New utility function 'make-separator-line'. | ||
| 2227 | |||
| 2228 | --- | ||
| 2229 | *** New face 'separator-line'. | ||
| 2230 | This is used by 'make-separator-line'. | ||
| 2231 | |||
| 2225 | +++ | 2232 | +++ |
| 2226 | *** New user option 'ignored-local-variable-values'. | 2233 | *** New user option 'ignored-local-variable-values'. |
| 2227 | This is the opposite of 'safe-local-variable-values' -- it's an alist | 2234 | 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 cb248b1d009..81d7f23fe3c 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -1573,11 +1573,7 @@ current buffer and the selected frame, respectively." | |||
| 1573 | (insert doc) | 1573 | (insert doc) |
| 1574 | (delete-region (point) | 1574 | (delete-region (point) |
| 1575 | (progn (skip-chars-backward " \t\n") (point))) | 1575 | (progn (skip-chars-backward " \t\n") (point))) |
| 1576 | (insert "\n\n" | 1576 | (insert "\n\n" (make-separator-line) "\n") |
| 1577 | (eval-when-compile | ||
| 1578 | (propertize "\n" 'face | ||
| 1579 | '(:height 0.1 :inverse-video t :extend t))) | ||
| 1580 | "\n") | ||
| 1581 | (when name | 1577 | (when name |
| 1582 | (insert (symbol-name symbol) | 1578 | (insert (symbol-name symbol) |
| 1583 | " is also a " name "." "\n\n")))) | 1579 | " is also a " name "." "\n\n")))) |
diff --git a/lisp/help.el b/lisp/help.el index 1bb1b307723..ba27fc5810f 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -943,12 +943,7 @@ current buffer." | |||
| 943 | (when defn | 943 | (when defn |
| 944 | (when (> (length info-list) 1) | 944 | (when (> (length info-list) 1) |
| 945 | (with-current-buffer standard-output | 945 | (with-current-buffer standard-output |
| 946 | (insert "\n\n" | 946 | (insert "\n\n" (make-separator-line) "\n"))) |
| 947 | ;; FIXME: Can't use eval-when-compile because purified | ||
| 948 | ;; strings lose their text properties :-( | ||
| 949 | (propertize "\n" 'face | ||
| 950 | '(:height 0.1 :inverse-video t :extend t)) | ||
| 951 | "\n"))) | ||
| 952 | 947 | ||
| 953 | (princ brief-desc) | 948 | (princ brief-desc) |
| 954 | (when locus | 949 | (when locus |
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." | |||
| 695 | (indent-to col 0) | 695 | (indent-to col 0) |
| 696 | (goto-char pos))) | 696 | (goto-char pos))) |
| 697 | 697 | ||
| 698 | (defface separator-line | ||
| 699 | '((((type graphic)) :height 0.1 :inverse-video t) | ||
| 700 | (t :foreground "ForestGreen")) | ||
| 701 | "Face for separator lines." | ||
| 702 | :version "28.1" | ||
| 703 | :group 'text) | ||
| 704 | |||
| 705 | (defun make-separator-line (&optional length) | ||
| 706 | "Make a string appropriate for usage as a visual separator line. | ||
| 707 | This uses the `separator-line' face. | ||
| 708 | |||
| 709 | If LENGTH is nil, use the window width." | ||
| 710 | (if (display-graphic-p) | ||
| 711 | (if length | ||
| 712 | (concat (propertize (make-string length ?\s) 'face 'separator-line) | ||
| 713 | "\n") | ||
| 714 | (propertize "\n" 'face '(:inherit separator-line :extend t))) | ||
| 715 | (concat (propertize (make-string (or length (1- (window-width))) ?-) | ||
| 716 | 'face 'separator-line) | ||
| 717 | "\n"))) | ||
| 718 | |||
| 698 | (defun delete-indentation (&optional arg beg end) | 719 | (defun delete-indentation (&optional arg beg end) |
| 699 | "Join this line to previous and fix up whitespace at join. | 720 | "Join this line to previous and fix up whitespace at join. |
| 700 | If there is a fill prefix, delete it from the beginning of this | 721 | If there is a fill prefix, delete it from the beginning of this |