(msdos-face-setup): Use `terminal-frame' for initial frame setup.
[bpt/emacs.git] / lisp / w32-fns.el
index 3ce4aed..28b7519 100644 (file)
@@ -1,4 +1,5 @@
-;; winnt.el --- Lisp routines for Windows NT.
+;;; winnt.el --- Lisp routines for Windows NT.
+
 ;; Copyright (C) 1994 Free Software Foundation, Inc.
 
 ;; Author: Geoff Voelker (voelker@cs.washington.edu)
@@ -16,8 +17,9 @@
 ;; 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.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
@@ -50,6 +52,7 @@
    (purecopy "%n")
    (purecopy ")%]--")
    (purecopy '(line-number-mode "L%l--"))
+   (purecopy '(column-number-mode "C%c--"))
    (purecopy '(-3 . "%p"))
    (purecopy "-%-")))
 
 ;; for executing its command line argument (from simple.el).
 (setq shell-command-switch "/c")
 
+;; For appending suffixes to directories and files in shell completions.
+(add-hook 'shell-mode-hook 
+         '(lambda () (setq comint-completion-addsuffix '("\\" . " "))))
+
 ;; Use ";" instead of ":" as a path separator (from files.el).
 (setq path-separator ";")
 
+;; Set the null device (for compile.el).
+(setq grep-null-device "NUL")
+
+;; Set the grep regexp to match entries with drive letters.
+(setq grep-regexp-alist
+  '(("^\\(\\([a-zA-Z]:\\)?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 3)))
+
 ;; Taken from dos-fn.el ... don't want all that's in the file, maybe
 ;; separate it out someday.
 
@@ -123,10 +137,58 @@ against the file name, and TYPE is nil for text, t for binary.")
 ;;; To set the default file type on new files.
 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type)
 
+;;; For using attached Unix filesystems.
+(defun save-to-unix-hook ()
+  (save-excursion
+    (setq buffer-file-type t))
+  nil)
+
+(defun revert-from-unix-hook ()
+  (save-excursion
+    (setq buffer-file-type (find-buffer-file-type (buffer-file-name))))
+  nil)
+
+;; Really should provide this capability at the drive letter granularity.
+(defun using-unix-filesystems (flag)
+  "Read and write all files assuming that they are on a drive attached 
+to a remote Unix file system.  No CR/LF translation is done on any files
+in this case.  This behavior is activated when FLAG is t and deactived
+when FLAG is any other value."
+  (if flag
+      (progn
+       (add-hook 'write-file-hooks 'save-to-unix-hook)
+       (add-hook 'after-save-hook 'revert-from-unix-hook))
+    (progn
+      (remove-hook 'write-file-hooks 'save-to-unix-hook)
+      (remove-hook 'after-save-hook 'revert-from-unix-hook))))
+
+;;; Avoid creating auto-save file names containing illegal characters
+;;; (primarily "*", eg. for the *mail* buffer).
+(fset 'original-make-auto-save-file-name
+      (symbol-function 'make-auto-save-file-name))
+
+(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' as that variable is checked
+before calling this function.  You can redefine this for customization.
+See also `auto-save-file-name-p'."
+  (let ((name (original-make-auto-save-file-name))
+       (start 0))
+    ;; destructively replace occurences of * or ? with $
+    (while (string-match "[?*]" name start)
+      (aset name (match-beginning 0) ?$)
+      (setq start (1+ (match-end 0))))
+    name))
+
 ;;; Fix interface to (X-specific) mouse.el
-(defalias 'window-frame 'ignore)
-(defalias 'x-set-selection 'ignore)
-(fset 'x-get-selection '(lambda (&rest rest) ""))
+(defun x-set-selection (type data)
+  (or type (setq type 'PRIMARY))
+  (put 'x-selections type data))
+
+(defun x-get-selection (&optional type data-type)
+  (or type (setq type 'PRIMARY))
+  (get 'x-selections type))
+
 (fmakunbound 'font-menu-add-default)
 (global-unset-key [C-down-mouse-1])
 (global-unset-key [C-down-mouse-2])