view lisp/vms-patch.el @ 1052:b8defcaf1b61

* xterm.c (x_make_frame_invisible): Don't forget to check the return value of XWithdrawWindow; it could indicate that the window wasn't successfully redrawn. * xterm.c (x_make_frame_invisible): Use XWithdrawWindow when available [HAVE_X11R4]; send the UnmapNotify event when appropriate [HAVE_X11]; just unmap the window if that's all that's needed [not HAVE_X11]. * xterm.c (x_set_text_property): Removed; it's only called from one place. Who wants *another* layer of indirection? * xterm.c: Use the FRAME_X_WINDOW macro, for readability. * xterm.c (x_death_handler): Renamed to x_connection_closed. (x_term_init): Use x_connection_closed as the SIGPIPE handler. * xterm.c (acceptable_x_error_p, x_handler_error_gracefully, x_error_handler): Removed; you can't catch X errors this way, since you can't perform X operations from within an X error handler, and even though we call error, we're still within an X error handler. (x_error_quitter, x_error_catcher): New functions, for panicking on and catching X protocol errors. (x_caught_error_message): Buffer for caught X errors. (x_catch_errors, x_check_errors, x_uncatch_errors): New functions for catching errors. (x_term_init): Set the error handler to x_error_quitter, rather than x_error_handler. * xterm.c (x_death_handler): Renamed to x_connection_closed. (x_term_init): Use x_connection_closed as the SIGPIPE handler. * xterm.c (acceptable_x_error_p, x_handler_error_gracefully, x_error_handler): Removed; you can't catch X errors this way, since you can't perform X operations from within an X error handler, and even though we call error, we're still within an X error handler. (x_error_quitter, x_error_catcher): New functions, for panicking on and catching X protocol errors. (x_caught_error_message): Buffer for caught X errors. (x_catch_errors, x_check_errors, x_uncatch_errors): New functions for catching errors. (x_term_init): Set the error handler to x_error_quitter, rather than x_error_handler.
author Jim Blandy <jimb@redhat.com>
date Sat, 29 Aug 1992 03:31:07 +0000
parents 113281b361ec
children 69fc2c96e27e
line wrap: on
line source

;;; vms-patch.el --- override parts of files.el for VMS.

;; Copyright (C) 1986 Free Software Foundation, Inc.

;; Maintainer: FSF
;; Keywords: vms

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

;;; Code:

;;; Functions that need redefinition

;;; VMS file names are upper case, but buffer names are more
;;; convenient in lower case.

(defun create-file-buffer (filename)
  "Create a suitably named buffer for visiting FILENAME, and return it.
FILENAME (sans directory) is used unchanged if that name is free;
otherwise a string <2> or <3> or ... is appended to get an unused name."
  (generate-new-buffer (downcase (file-name-nondirectory filename))))

;;; Given a string FN, return a similar name which is a legal VMS filename.
;;; This is used to avoid invalid auto save file names.
(defun make-legal-file-name (fn)
  (setq fn (copy-sequence fn))
  (let ((dot nil) (indx 0) (len (length fn)) chr)
    (while (< indx len)
      (setq chr (aref fn indx))
      (cond
       ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t)))
       ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z))
		 (and (>= chr ?0) (<= chr ?9))
		 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0))))
	(aset fn indx ?_)))
      (setq indx (1+ indx))))
  fn)

;;; Auto save filesnames start with _$ and end with $.

(defun make-auto-save-file-name ()
  "Return file name to use for auto-saves of current buffer.
Does not consider auto-save-visited-file-name; that is checked
before calling this function.
This is a separate function so your .emacs file or site-init.el can redefine it.
See also auto-save-file-name-p."
  (if buffer-file-name
      (concat (file-name-directory buffer-file-name)
	      "_$"
	      (file-name-nondirectory buffer-file-name)
	      "$")
    (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$"))))

(defun auto-save-file-name-p (filename)
  "Return t if FILENAME can be yielded by make-auto-save-file-name.
FILENAME should lack slashes.
This is a separate function so your .emacs file or site-init.el can redefine it."
  (string-match "^_\\$.*\\$" filename))

(defun vms-suspend-resume-hook ()
  "When resuming suspended Emacs, check for file to be found.
If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file."
  (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME")))
    (if file (find-file file))))

(setq suspend-resume-hook 'vms-suspend-resume-hook)

(defun vms-suspend-hook ()
  "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined."
  (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
      (error "Can't suspend this emacs"))
  nil)

(setq suspend-hook 'vms-suspend-hook)

(defun vms-read-directory (dirname switches buffer)
  (save-excursion
    (set-buffer buffer)
    (subprocess-command-to-buffer
     (concat "DIRECTORY " switches " " dirname)
     buffer)
    (goto-char (point-min))
    ;; Remove all the trailing blanks.
    (while (search-forward " \n")
      (forward-char -1)
      (delete-horizontal-space))
    (goto-char (point-min))))

(setq dired-listing-switches
      "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)")

(setq print-region-function
      '(lambda (start end command ign1 ign2 ign3 &rest switches)
	 (write-region start end "sys$login:delete-me.txt")
	 (send-command-to-subprocess
	  1
	  (concat command
		  " sys$login:delete-me.txt/name=""GNUprintbuffer"" "
		  (mapconcat 'identity switches " "))
	  nil nil nil)))

;;; vms-patch.el ends here