diff options
| author | Jonas Bernoulli | 2022-08-04 14:05:12 +0200 |
|---|---|---|
| committer | Jonas Bernoulli | 2022-08-04 14:05:12 +0200 |
| commit | fe68fe28126efa44a1050a2eedfc719c23054db1 (patch) | |
| tree | 2c1211e52440692c8c4d8109a2af31a3666a036f | |
| parent | 245be33189fdba26997fc565742ce7a0e78232aa (diff) | |
| download | emacs-fe68fe28126efa44a1050a2eedfc719c23054db1.tar.gz emacs-fe68fe28126efa44a1050a2eedfc719c23054db1.zip | |
Avoid unnecessary work
| -rw-r--r-- | which-key.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/which-key.el b/which-key.el index ba446a56737..529cceb40a1 100644 --- a/which-key.el +++ b/which-key.el | |||
| @@ -1589,12 +1589,12 @@ If KEY contains any \"special keys\" defined in | |||
| 1589 | 1589 | ||
| 1590 | (defsubst which-key--truncate-description (desc) | 1590 | (defsubst which-key--truncate-description (desc) |
| 1591 | "Truncate DESC description to `which-key-max-description-length'." | 1591 | "Truncate DESC description to `which-key-max-description-length'." |
| 1592 | (let* ((last-face (get-text-property (1- (length desc)) 'face desc)) | 1592 | (if (and which-key-max-description-length |
| 1593 | (dots (which-key--propertize which-key-ellipsis 'face last-face))) | 1593 | (> (length desc) which-key-max-description-length)) |
| 1594 | (if (and which-key-max-description-length | 1594 | (let* ((last-face (get-text-property (1- (length desc)) 'face desc)) |
| 1595 | (> (length desc) which-key-max-description-length)) | 1595 | (dots (which-key--propertize which-key-ellipsis 'face last-face))) |
| 1596 | (concat (substring desc 0 which-key-max-description-length) dots) | 1596 | (concat (substring desc 0 which-key-max-description-length) dots)) |
| 1597 | desc))) | 1597 | desc)) |
| 1598 | 1598 | ||
| 1599 | (defun which-key--highlight-face (description) | 1599 | (defun which-key--highlight-face (description) |
| 1600 | "Return the highlight face for DESCRIPTION if it has one." | 1600 | "Return the highlight face for DESCRIPTION if it has one." |