🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87583

case sensitivity in auto-insert-alist

#87583
From: J.Farrell
Date: Thu, 15 Sep 1994 16:13
51 lines
2873 bytes
In GNU Emacs 19.26.1 (sparc-sun-solaris2.3, X toolkit) of Thu Sep  8 1994 on tigger.isode.com

When using auto-insert.el, matching of filenames against the regexps in
auto-insert-alist is done without regard to case. This means you can't use .C
and .c to distinguish between C++ and C, and have different files inserted.

The following patch makes the matching case-sensitive, except on VMS where
filenames are not case-sensitive (I stole this from the auto-mode-alist code
in files.el - I would have thought there would be other systems apart from VMS
where this is the case). I also added .cc, .C, and .H regexps to the alist.


diff -c /usr/local/src/emacs-19.26/lisp/autoinsert.el autoinsert.el
*** /usr/local/src/emacs-19.26/lisp/autoinsert.el       Mon Mar 22 14:40:56 1993
--- autoinsert.el       Thu Sep 15 16:44:46 1994
***************
*** 55,60 ****
--- 55,63 ----
  (defvar auto-insert-alist '(("\\.tex$" . "tex-insert.tex")
                            ("\\.c$" . "c-insert.c")
                            ("\\.h$" . "h-insert.c")
+                           ("\\.cc$" . "c-insert.cc")
+                           ("\\.C$" . "c-insert.cc")
+                           ("\\.H$" . "h-insert.cc")
                            ("[Mm]akefile" . "makefile.inc")
                            ("\\.bib$" . "tex-insert.tex"))
    "A list specifying text to insert by default into a new file.
***************
*** 75,84 ****
          (insert-file nil))
  
      ;; find first matching alist entry
!     (while (and (not insert-file) alist)
!       (if (string-match (car (car alist)) name)
!           (setq insert-file (cdr (car alist)))
!         (setq alist (cdr alist))))
  
      ;; Now, if we found an appropriate insert file, insert it
      (if insert-file
--- 78,88 ----
          (insert-file nil))
  
      ;; find first matching alist entry
!     (let ((case-fold-search (eq system-type 'vax-vms)))
!       (while (and (not insert-file) alist)
!       (if (string-match (car (car alist)) name)
!           (setq insert-file (cdr (car alist)))
!         (setq alist (cdr alist)))))
  
      ;; Now, if we found an appropriate insert file, insert it
      (if insert-file
Technical Details
Message-ID: <9409151605.AA04127@tigger.isode.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!isode.com!J.Farrell

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,ffd42c3e459b6abe,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-15 15:31:45 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!isode.com!J.Farrell
From: J.Farrell@isode.com
Newsgroups: gnu.emacs.bug
Subject: case sensitivity in auto-insert-alist
Date: 15 Sep 1994 12:13:49 -0400
Organization: GNUs Not Usenet
Lines: 51
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9409151605.AA04127@tigger.isode.com>