branch: externals/show-font commit d238f83c2ca561e929d3a6c9c9e7fcd7091385dc Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Make show-font--insert-button only work when buffer-file-name --- show-font.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/show-font.el b/show-font.el index 0cbdc1726e..a526d9c3af 100644 --- a/show-font.el +++ b/show-font.el @@ -426,16 +426,17 @@ If FAMILY is nil, use the one of the current font file." (defun show-font--insert-button () "Insert `show-font-installed-file-button' at point." - (insert - (concat (propertize "Cannot preview this font" 'face 'show-font-title) - "\n\n" - (propertize buffer-file-name 'face 'bold) - " is not installed" - "\n\n" - "Install this font file?" - "\n")) - (goto-char (point-max)) - (make-text-button (line-beginning-position 0) (line-end-position 0) :type 'show-font-installed-file-button)) + (when buffer-file-name + (insert + (concat (propertize "Cannot preview this font" 'face 'show-font-title) + "\n\n" + (propertize buffer-file-name 'face 'bold) + " is not installed" + "\n\n" + "Install this font file?" + "\n")) + (goto-char (point-max)) + (make-text-button (line-beginning-position 0) (line-end-position 0) :type 'show-font-installed-file-button))) (defun show-font--add-text (&optional buffer) "Add the `show-font-pangram' as an overlay at `point-min'.