🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vms
Article #50

Patch to files.el for VMS Dired

#50
From: Roland Roberts
Date: Thu, 31 Aug 1989 20:05
61 lines
3006 bytes
Several people pointed out that there still existed one additional
problem (at least) with the way VMS dired works.  When trying to save
a file which has a version number, e.g. FOO.BAR;3 one typically gets
an error message about an IO error.  It turned out to be easier to fix
than I expected, so below is the patch to files.el which will prevent
this.

On VMS, this patch causes a buffer named FOO.BAR;3 associated with
file DISK:[DIR]FOO.BAR;3 to have the suffix dropped both in the buffer
name and its associated file name once an attempt to save is made.
The result is that the file will be saved as the next higher version
number according to customary VMS usage.  So if there is are versions
4, 5, and 6, this will now be saved as version 7.

If you don't have the 'patch' program, don't worry.  These diff's are
all inserted into a single spot in the expression basic-save-buffer.
It should be quite easy to find.

*** [lisp]files.el
--- files.el
**************
*** 653,658
    (interactive)
    (if (buffer-modified-p)
        (let (setmodes tempsetmodes)
  	(or buffer-file-name
  	    (progn
  	      (setq buffer-file-name
--- 653,679 -----
    (interactive)
    (if (buffer-modified-p)
        (let (setmodes tempsetmodes)
+ 	(if (and (eq system-type 'vax-vms)
+ 		 (string= buffer-file-name
+ 			  (file-name-sans-versions buffer-file-name)))
+ 	    (let ((buffer-new-name nil)
+ 		  (buffer-name-list nil))
+ 	      ;; Strip VMS version number before save
+ 	      (setq buffer-file-name
+ 		    (file-name-sans-versions buffer-file-name))
+ 	      ;; Select a buffer name to correspond
+ 	      (setq buffer-new-name
+ 		    (downcase (file-name-nondirectory buffer-file-name)))
+ 	      ;; Check to see if the buffer name is in use
+ 	      (setq buffer-name-list
+ 		    (mapcar (function buffer-name) (buffer-list)))
+ 	      (while (and buffer-name-list
+ 			  (not (string= buffer-new-name
+ 					(car buffer-name-list))))
+ 		(setq buffer-name-list (cdr buffer-name-list)))
+ 	      ;; Change the buffer name, if no conflict
+ 	      (if (not buffer-name-list)
+ 		  (rename-buffer buffer-new-name))))
  	(or buffer-file-name
  	    (progn
  	      (setq buffer-file-name
-- 
Roland Roberts                      BITNET: roberts@uornsrl
  Nuclear Structure Research Lab  INTERNET: rbr4@uhura.cc.rochester.edu
  271 East River Road                 UUCP: rochester!ur-cc!uhura!rbr4
  Rochester, NY  14267                AT&T: (716) 275-8962
Technical Details
Message-ID: <2919@ur-cc.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!uhura.cc.rochester.edu!rbr4
References: <2908@ur-cc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!uhura.cc.rochester.edu!rbr4
From: rbr4@uhura.cc.rochester.edu (Roland Roberts)
Newsgroups: gnu.emacs.vms,gnu.emacs,comp.emacs,comp.os.vms
Subject: Patch to files.el for VMS Dired
Message-ID: <2919@ur-cc.UUCP>
Date: 31 Aug 89 20:05:50 GMT
References: <2908@ur-cc.UUCP>
Reply-To: rbr4@uhura.cc.rochester.edu (Roland Roberts)
Followup-To: gnu.emacs.vms
Organization: University of Rochester
Lines: 60