[gnu.emacs.bug] Fix for file-name-sans-versions for VAX/VMS

KARNEY%PPC.MFENET@NMFECC.ARPA (11/15/88)

The 18.52 version of file-name-sans-versions has a few bugs on VAX/VMS
systems (e.g., (file-name-sans-versions "a.r1") ==> "a.").  Here is a
corrected version.

; Patch file-name-sans-versions for VMS
; Version number is (a) semicolon, optional sign, zero or more digits
; or (b) period, option sign, zero or more digits, provided this is the
; second period encountered outside of the device/directory part of the file
; name.
(defun file-name-sans-versions (name)
  "Return FILENAME sans backup versions or strings.
This is a separate procedure so your site-init or startup file can
redefine it."
  (substring name 0
             (if (eq system-type 'vax-vms)
                 (or (string-match ";[---+]?[0-9]*\\'" name)
                     (if (string-match "\\.[^]>:]*\\(\\.[---+]?[0-9]*\\)\\'"
                                       name)
                         (match-beginning 1))
                     (length name))
               (or (string-match "\\.~[0-9]+~\\'" name)
                   (string-match "~\\'" name)
                   (length name)))))


    Charles Karney
    Plasma Physics Laboratory   Phone:   +1 609 243 2607
    Princeton University        MFEnet:  Karney@PPC.MFEnet
    PO Box 451                  ARPAnet: Karney%PPC.MFEnet@NMFECC.ARPA
    Princeton, NJ 08543-0451    Bitnet:  Karney%PPC.MFEnet@ANLVMS.Bitnet

CC:
        bug-gnu-emacs@prep.ai.mit.edu
        KARNEY