Hi Kalle, I'm currently revising old Emacs bugs.
On 2003-08-03 23:07 +0200, Kalle Olavi Niemitalo wrote: > reassign 34818 emacs21 > retitle 34818 emacs21: make auto-insert return t if it inserts something > quit > > Kalle Olavi Niemitalo <t...@ees2.oulu.fi> writes: > >> Package: emacs20 >> Version: 20.3-5 >> Severity: wishlist > > As emacs20 is no longer being enhanced, I reassign this wish to > emacs21. > >> There's a problem, though: "The functions [in >> `find-file-not-found-hooks'] are called in the order given until >> one of them returns non-nil." The return value of auto-insert is >> not documented and seems to depend on many things. > > In Emacs 21.1 and later, auto-insert always returns nil and has a > comment saying this is precisely for find-file-not-found-hooks. It also says that this is probably inadvisable, and I tend to agree. E.g. you want to run vc-file-not-found-hook to check out a file that is under version control but currently has no working copy. Then it's no good to run auto-insert before that. >> IWBNI `auto-insert' were changed to return non-nil iff it inserts >> something. > > That has not yet been done. If there are other functions in > find-file-not-found-hooks, they run even if auto-insert has > already inserted something, because it always returns nil. > >> In the meantime, I think I'll write a wrapper. > > I have been using the following wrapper for a few years now. > > (add-hook 'find-file-not-found-hooks > (lambda () > (auto-insert) > ;; If something was inserted, return non-nil to signal > ;; that no more hooks should be run. > (> (buffer-size) 0))) You're probably better off just using auto-insert-mode like everyone else, since the runtime cost of that is negligible. If you want to keep the bug open anyway, I'll probably add a wontfix tag. Cheers, Sven -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org