🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99420

autoinsert.el enhancement

#99420
From: msb
Date: Wed, 05 Sep 1990 13:20
57 lines
2790 bytes
emacs-version: GNU Emacs 18.55.4 of Tue Feb 20 1990 on hoswjc (berkeley-unix)

I added a y-or-n-p to autoinsert.el.  I found it convenient to have a
template automagically inserted when I created a new file, but found
it annoying when it happened because of a typo, or if I didn't want
the default template.

I also added the code to assure that insert-auto-insert-files isn't
added to find-file-not-found-hooks if it's already there.

Help yourself to this set of changes,
Mike Balenger

----------------------------------------------------------------------
<cute quote>            Michael S. Balenger             (908) 949-8789
<cute disclaimer>       AT&T Bell Labs
M_Balenger@att.com      Room 1L-405
msb@hos1cad.att.com     Crawfords Corner Road
att!hos1cad!msb         Holmdel, NJ   07733-1988



*** autoinsert.el.orig	Wed Sep  5 09:04:24 1990
--- autoinsert.el	Wed Sep  5 09:09:25 1990
***************
*** 78,91 ****
          (setq alist (cdr alist))))
  
      ;; Now, if we found an appropriate insert file, insert it
!     (if insert-file
!         (let ((file (concat auto-insert-directory insert-file)))
!           (if (file-readable-p file)
!               (insert-file-contents file)
!             (message "Auto-insert: file %s not found" file)
  	    (sleep-for 1))))))
  
  ;; Make this feature take effect when a nonexistent file is visited.
! (setq find-file-not-found-hooks
!       (cons 'insert-auto-insert-files
! 	    find-file-not-found-hooks))
--- 78,92 ----
          (setq alist (cdr alist))))
  
      ;; Now, if we found an appropriate insert file, insert it
!     (if (and insert-file
! 	     (y-or-n-p (format "auto-insert \"%s\" " insert-file)))
! 	(let ((file (concat auto-insert-directory insert-file)))
! 	  (if (file-readable-p file)
! 	      (insert-file-contents file)
! 	    (message "Auto-insert: file %s not found" file)
  	    (sleep-for 1))))))
  
  ;; Make this feature take effect when a nonexistent file is visited.
! (or (memq 'insert-auto-insert-files find-file-not-found-hooks)
!     (setq find-file-not-found-hooks 
! 	  (cons 'insert-auto-insert-files find-file-not-found-hooks)))
Technical Details
Message-ID: <9009051527.AA18133@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!hos1cad.att.com!msb

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,ca88a60b08f782,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-09-05 23:13:04 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!hos1cad.att.com!msb
From: msb@hos1cad.att.com
Newsgroups: gnu.emacs.bug
Subject: autoinsert.el enhancement
Message-ID: <9009051527.AA18133@life.ai.mit.edu>
Date: 5 Sep 90 13:20:00 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: msb@hos1cad.att.com (Mike Balenger)
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 57
Posted: Wed Sep  5 14:20:00 1990