GNU bug report logs -
#78990
30.1; Show-font breaks `insert-file-contents-literally'
Previous Next
To reply to this bug, email your comments to 78990 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78990
; Package
emacs
.
(Thu, 10 Jul 2025 12:14:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Zhengyi Fu <i <at> fuzy.me>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 10 Jul 2025 12:14:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78990
; Package
emacs
.
(Thu, 10 Jul 2025 12:22:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
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!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78990
; Package
emacs
.
(Thu, 10 Jul 2025 12:28:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
Protesilaos Stavrou <prot <at> protesilaos.com> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78990
; Package
emacs
.
(Thu, 10 Jul 2025 17:05:02 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
On 2025-07-10 15:27, Zhengyi Fu wrote:
> Thank you for your fast reply.
You are welcome!
> No. Actually, I don't know how to fix it correctly.
Okay, no worries! Let's try to do this together. I have not tried
'insert-file-contents-literally' before. Please evaluate the following
function and try again.
(defun show-font--insert-button ()
"Insert `show-font-installed-file-button' at point."
(when buffer-file-name
(insert
(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)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78990
; Package
emacs
.
(Fri, 11 Jul 2025 10:01:02 GMT)
Full text and
rfc822 format available.
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
Protesilaos Stavrou <prot <at> protesilaos.com> writes:
> On 2025-07-10 15:27, Zhengyi Fu wrote:
>> Thank you for your fast reply.
>
> You are welcome!
>
>> No. Actually, I don't know how to fix it correctly.
>
> Okay, no worries! Let's try to do this together. I have not tried
> 'insert-file-contents-literally' before. Please evaluate the following
> function and try again.
>
> (defun show-font--insert-button ()
> "Insert `show-font-installed-file-button' at point."
> (when buffer-file-name
> (insert
> (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)))
After evaluating that fnuction, it doesn't signal errors, but nothing
gets inserted.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78990
; Package
emacs
.
(Fri, 11 Jul 2025 12:48:02 GMT)
Full text and
rfc822 format available.
Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):
On 2025-07-11 12:58, Zhengyi Fu wrote:
> Protesilaos Stavrou <prot <at> protesilaos.com> writes:
>
>> On 2025-07-10 15:27, Zhengyi Fu wrote:
>>> Thank you for your fast reply.
>>
>> You are welcome!
>>
>>> No. Actually, I don't know how to fix it correctly.
>>
>> Okay, no worries! Let's try to do this together. I have not tried
>> 'insert-file-contents-literally' before. Please evaluate the following
>> function and try again.
>>
>> (defun show-font--insert-button ()
>> "Insert `show-font-installed-file-button' at point."
>> (when buffer-file-name
>> (insert
>> (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)))
>
> After evaluating that fnuction, it doesn't signal errors, but nothing
> gets inserted.
I made two changes and bumped the version number. The new package will
be available in a few hours. I believe I have fixed the problem. See
commits d238f83 and f6239ae in show-font.git.
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.