Subject: bug#78990: 30.1; Show-font breaks `insert-file-contents-literally'

From: Zhengyi Fu <[email-masked]>
Date: Thu, 10 Jul 2025 20:27:05 +0800

Protesilaos Stavrou <[email-masked]> writes:

> On 2025-07-10 15:12, Zhengyi Fu wrote:
>> The package `show-font' adds a file name handler to
>> `file-name-handler-alist', which causes an error when trying to insert
>> the raw contents of an TTF file into a buffer with
>> `insert-file-contents-literally'.
>> ;;;###autoload
>> (add-to-list 'file-name-handler-alist (cons "\\.\\(ttf\\|otf\\)\\'"
>> #'show-font-handler))
>> Currently I use the following advice to workaround this behavior,
>> but I
>> think it's better to fix this either in show-font or in Emacs core.
>> (define-advice insert-file-contents-literally
>>     (:around (&rest args) inhibit-show-font)
>>   (let ((inhibit-file-name-handlers
>> 	 (append '(show-font-handler)
>> 		 (and (eq inhibit-file-name-operation 'insert-file-contents)
>> 		      inhibit-file-name-handlers)))
>> 	(inhibit-file-name-operation 'insert-file-contents))
>>     (apply args)))
>
> Do you want to send me a patch for this? I will apply it right
> away. Thank you!

Thank you for your fast reply.

No.  Actually, I don't know how to fix it correctly.