all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Avoiding 'with-temp-buffer' in tight loops
@ 2024-08-09  8:30 martin rudalics
  2024-08-09 10:36 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2024-08-09  8:30 UTC (permalink / raw)
  To: emacs-devel

Ever since 'substitute-command-keys' has been transferred to help.el,
putting initial breakpoints in Fkill_buffer has become virtually
impossible.

Could we pretty please replace the

     (let ((keymap overriding-local-map)
           (inhibit-modification-hooks t)
           (orig-buf (current-buffer)))
       (with-temp-buffer

with something like

     (let* ((keymap overriding-local-map)
            (inhibit-modification-hooks t)
            (orig-buf (current-buffer))
	   (buffer-name " *substitute-command-keys*")
	   (buffer (or (get-buffer buffer-name)
		       (generate-new-buffer buffer-name t))))
       (with-current-buffer buffer
	(erase-buffer)

This would eliminate the overhead associated with continuously creating
and killing a buffer and make debugging amenable.  Maybe we could also
add a note somewhere in 'with-temp-buffer' so people avoid calling it in
tight loops.  Then we could also do something similar for
'image-type-from-file-header', possibly erasing the contents of its
buffer after being done with it.

Thanks, martin



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-12 10:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  8:30 Avoiding 'with-temp-buffer' in tight loops martin rudalics
2024-08-09 10:36 ` Eli Zaretskii
2024-08-10 13:59   ` martin rudalics
2024-08-10 14:11     ` Eli Zaretskii
2024-08-12  7:51       ` martin rudalics
2024-08-12 10:55         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.