diff options
| author | Stefan Kangas | 2019-11-03 17:45:48 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2019-11-03 17:45:48 +0100 |
| commit | 84a3793b194efe92e2eb80cd0f625f3324bf4cae (patch) | |
| tree | 93a5c25fdf21afd81fa2ff3593dcf4dcfa1b46e5 /lisp/cus-edit.el | |
| parent | fc6f1f59fe6b49612cdc1963f9078d062b83fdc7 (diff) | |
| download | emacs-84a3793b194efe92e2eb80cd0f625f3324bf4cae.tar.gz emacs-84a3793b194efe92e2eb80cd0f625f3324bf4cae.zip | |
Handle truncate-lines in customize-group
* lisp/cus-edit.el (custom-group--draw-horizontal-line): New
function to draw horizontal lines which handles a non-nil value of
'truncate-lines'. (Bug#25308)
(custom-group-value-create): Use it.
Co-authored-by: Jonas Bernoulli <jonas@bernoul.li>
Diffstat (limited to 'lisp/cus-edit.el')
| -rw-r--r-- | lisp/cus-edit.el | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index b9fd3e0a2d4..081d4c9213e 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -4062,6 +4062,22 @@ If GROUPS-ONLY is non-nil, return only those members that are groups." | |||
| 4062 | (push entry members))) | 4062 | (push entry members))) |
| 4063 | (nreverse members)))) | 4063 | (nreverse members)))) |
| 4064 | 4064 | ||
| 4065 | (defun custom-group--draw-horizontal-line () | ||
| 4066 | "Draw a horizontal line at point. | ||
| 4067 | This works for both graphical and text displays." | ||
| 4068 | (let ((p (point))) | ||
| 4069 | (insert "\n") | ||
| 4070 | (put-text-property p (1+ p) 'face '(:underline t)) | ||
| 4071 | (overlay-put (make-overlay p (1+ p)) | ||
| 4072 | 'before-string | ||
| 4073 | (propertize "\n" 'face '(:underline t) | ||
| 4074 | 'display | ||
| 4075 | (list 'space :align-to | ||
| 4076 | `(+ (0 . right) | ||
| 4077 | ,(min (window-hscroll) | ||
| 4078 | (- (line-end-position) | ||
| 4079 | (line-beginning-position))))))))) | ||
| 4080 | |||
| 4065 | (defun custom-group-value-create (widget) | 4081 | (defun custom-group-value-create (widget) |
| 4066 | "Insert a customize group for WIDGET in the current buffer." | 4082 | "Insert a customize group for WIDGET in the current buffer." |
| 4067 | (unless (eq (widget-get widget :custom-state) 'hidden) | 4083 | (unless (eq (widget-get widget :custom-state) 'hidden) |
| @@ -4188,15 +4204,7 @@ If GROUPS-ONLY is non-nil, return only those members that are groups." | |||
| 4188 | 4204 | ||
| 4189 | ;; Nested style. | 4205 | ;; Nested style. |
| 4190 | (t ;Visible. | 4206 | (t ;Visible. |
| 4191 | ;; Draw a horizontal line (this works for both graphical | 4207 | (custom-group--draw-horizontal-line) |
| 4192 | ;; and text displays): | ||
| 4193 | (let ((p (point))) | ||
| 4194 | (insert "\n") | ||
| 4195 | (put-text-property p (1+ p) 'face '(:underline t)) | ||
| 4196 | (overlay-put (make-overlay p (1+ p)) | ||
| 4197 | 'before-string | ||
| 4198 | (propertize "\n" 'face '(:underline t) | ||
| 4199 | 'display '(space :align-to 999)))) | ||
| 4200 | 4208 | ||
| 4201 | ;; Add parent groups references above the group. | 4209 | ;; Add parent groups references above the group. |
| 4202 | (when (eq level 1) | 4210 | (when (eq level 1) |
| @@ -4287,13 +4295,7 @@ If GROUPS-ONLY is non-nil, return only those members that are groups." | |||
| 4287 | (widget-put widget :children children) | 4295 | (widget-put widget :children children) |
| 4288 | (custom-group-state-update widget)) | 4296 | (custom-group-state-update widget)) |
| 4289 | ;; End line | 4297 | ;; End line |
| 4290 | (let ((p (1+ (point)))) | 4298 | (custom-group--draw-horizontal-line))))) |
| 4291 | (insert "\n\n") | ||
| 4292 | (put-text-property p (1+ p) 'face '(:underline t)) | ||
| 4293 | (overlay-put (make-overlay p (1+ p)) | ||
| 4294 | 'before-string | ||
| 4295 | (propertize "\n" 'face '(:underline t) | ||
| 4296 | 'display '(space :align-to 999)))))))) | ||
| 4297 | 4299 | ||
| 4298 | (defvar custom-group-menu | 4300 | (defvar custom-group-menu |
| 4299 | `(("Set for Current Session" custom-group-set | 4301 | `(("Set for Current Session" custom-group-set |