2002-07-05 23:15:06 +00:00
|
|
|
;; dos-w32.el --- Functions shared among MS-DOS and W32 (NT/95) platforms
|
1996-09-01 17:09:21 +00:00
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
;; Copyright (C) 1996, 2001-2020 Free Software Foundation, Inc.
|
1996-09-01 17:09:21 +00:00
|
|
|
|
1998-03-03 19:36:31 +00:00
|
|
|
;; Maintainer: Geoff Voelker <voelker@cs.washington.edu>
|
1996-09-01 17:09:21 +00:00
|
|
|
;; Keywords: internal
|
2010-08-29 16:17:13 +00:00
|
|
|
;; Package: emacs
|
1996-09-01 17:09:21 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1996-09-01 17:09:21 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
1996-09-01 17:09:21 +00:00
|
|
|
|
|
|
|
;; 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
|
2017-09-30 00:44:23 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1996-09-01 17:09:21 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; Parts of this code are duplicated functions taken from dos-fns.el
|
|
|
|
;; and winnt.el.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
;; Use ";" instead of ":" as a path separator (from files.el).
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(when (memq system-type '(ms-dos windows-nt))
|
|
|
|
(setq path-separator ";")
|
|
|
|
(push 'file-name-history minibuffer-history-case-insensitive-variables)
|
|
|
|
;; Set the null device (for compile.el).
|
|
|
|
(setq null-device "NUL")
|
|
|
|
(setq-default buffer-file-coding-system 'undecided-dos))
|
1996-09-01 17:09:21 +00:00
|
|
|
|
2013-02-09 12:52:01 +00:00
|
|
|
;; For distinguishing file types based upon suffixes. DEPRECATED, DO NOT USE!
|
2012-05-04 05:14:14 +00:00
|
|
|
(defcustom file-name-buffer-file-type-alist
|
|
|
|
'(("[:/].*config.sys$" . nil) ; config.sys text
|
1999-05-02 09:36:07 +00:00
|
|
|
("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|bin\\|ico\\|pif\\|class\\)$" . t)
|
1996-09-01 17:09:21 +00:00
|
|
|
; MS-Dos stuff
|
1999-05-02 09:36:07 +00:00
|
|
|
("\\.\\(dll\\|drv\\|386\\|vxd\\|fon\\|fnt\\|fot\\|ttf\\|grp\\)$" . t)
|
1997-09-02 23:52:43 +00:00
|
|
|
; Windows stuff
|
1999-12-10 13:37:42 +00:00
|
|
|
("\\.\\(bmp\\|wav\\|avi\\|mpg\\|jpg\\|tif\\|mov\\|au\\)$" . t)
|
1997-09-02 23:52:43 +00:00
|
|
|
; known binary data files
|
1996-09-01 17:09:21 +00:00
|
|
|
("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
|
|
|
|
; Packers
|
1997-09-02 23:52:43 +00:00
|
|
|
("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\|jar\\)$" . t)
|
1996-09-01 17:09:21 +00:00
|
|
|
; Unix stuff
|
2002-07-11 17:32:01 +00:00
|
|
|
("\\.sx[dmicw]$" . t) ; OpenOffice.org
|
2002-07-05 23:15:06 +00:00
|
|
|
("\\.tp[ulpw]$" . t) ; borland Pascal stuff
|
|
|
|
("[:/]tags$" . nil) ; emacs TAGS file
|
1996-09-01 17:09:21 +00:00
|
|
|
)
|
2013-02-09 12:52:01 +00:00
|
|
|
"Alist used in the past for distinguishing text files from binary files.
|
1996-09-01 17:09:21 +00:00
|
|
|
Each element has the form (REGEXP . TYPE), where REGEXP is matched
|
2013-02-09 12:52:01 +00:00
|
|
|
against the file name, and TYPE is nil for text, t for binary.
|
|
|
|
|
|
|
|
This variable is deprecated, not used anywhere, and will soon be deleted."
|
2012-05-04 05:14:14 +00:00
|
|
|
:type '(repeat (cons regexp boolean))
|
|
|
|
:group 'dos-fns
|
|
|
|
:group 'w32)
|
1996-09-01 17:09:21 +00:00
|
|
|
|
2013-02-09 12:52:01 +00:00
|
|
|
(make-obsolete-variable 'file-name-buffer-file-type-alist
|
|
|
|
'file-coding-system-alist
|
|
|
|
"24.4")
|
1997-07-18 22:54:23 +00:00
|
|
|
|
1997-07-22 21:49:49 +00:00
|
|
|
(defun find-buffer-file-type-coding-system (command)
|
2006-07-21 09:20:02 +00:00
|
|
|
"Choose a coding system for a file operation in COMMAND.
|
2007-05-22 11:21:13 +00:00
|
|
|
COMMAND is a list that specifies the operation, an I/O primitive, as its
|
2006-07-21 09:20:02 +00:00
|
|
|
CAR, and the arguments that might be given to that operation as its CDR.
|
|
|
|
If operation is `insert-file-contents', the coding system is chosen based
|
|
|
|
upon the filename (the CAR of the arguments beyond the operation), the contents
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
of `w32-untranslated-filesystem-list' and `file-name-buffer-file-type-alist',
|
2006-07-21 09:20:02 +00:00
|
|
|
and whether the file exists:
|
1997-07-20 01:30:54 +00:00
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
If it matches in `w32-untranslated-filesystem-list':
|
2000-12-02 11:29:40 +00:00
|
|
|
If the file exists: `undecided'
|
|
|
|
If the file does not exist: `undecided-unix'
|
1997-07-18 22:54:23 +00:00
|
|
|
Otherwise:
|
1997-07-20 01:30:54 +00:00
|
|
|
If the file exists: `undecided'
|
2009-08-28 04:21:14 +00:00
|
|
|
If the file does not exist default value of `buffer-file-coding-system'
|
1997-07-18 22:54:23 +00:00
|
|
|
|
2007-05-22 11:21:13 +00:00
|
|
|
Note that the CAR of arguments to `insert-file-contents' operation could
|
lisp/*.el: Fix typos; use string-match-p, looking-at-p, setq-local, defvar-local.
* lisp/allout-widgets.el (allout-widgets-mode-off)
(allout-widgets-mode-on, allout-widgets-pre-command-business)
(allout-widgets-post-command-business)
(allout-widgets-after-copy-or-kill-function)
(allout-widgets-after-undo-function, allout-test-range-overlaps)
(allout-decorate-item-and-context)
(allout-graphics-modification-handler): Fix typos in docstrings.
(allout-get-or-create-parent-widget): Use `looking-at-p'.
* lisp/cmuscheme.el (scheme-start-file): Doc fix.
(inferior-scheme-mode, switch-to-scheme): Fix typos in docstrings.
(scheme-input-filter): Use `string-match-p'.
* lisp/composite.el (compose-gstring-for-terminal): Fix typo in docstring.
* lisp/dired-x.el: Use Dired consistently in docstrings.
* lisp/dired.el: Use Dired consistently in docstrings.
(dired-readin, dired-mode): Use `setq-local'.
(dired-switches-alist): Make defvar-local.
(dired-buffers-for-dir): Use `zerop'.
(dired-safe-switches-p, dired-switches-escape-p)
(dired-insert-old-subdirs, dired-move-to-end-of-filename)
(dired-glob-regexp, dired-in-this-tree, dired-goto-file-1)
(dired-sort-set-mode-line, dired-sort-toggle, dired-sort-R-check):
(dired-goto-next-nontrivial-file): Use `string-match-p'.
(dired-align-file, dired-insert-directory, dired-mark-files-in-region)
(dired-toggle-marks, dired-mark-files-containing-regexp)
(dired-mark-symlinks, dired-mark-directories, dired-mark-executables)
(dired-flag-auto-save-files, dired-flag-backup-files):
Use `looking-at-p'.
(dired-mark-files-regexp, dired-build-subdir-alist):
Use `string-match-p', `looking-at-p'.
* lisp/dos-w32.el (untranslated-canonical-name, untranslated-file-p)
(direct-print-region-helper): Use `string-match-p'.
2013-06-21 12:24:37 +00:00
|
|
|
be a cons cell of the form (FILENAME . BUFFER), where BUFFER is a buffer
|
2007-05-22 11:21:13 +00:00
|
|
|
into which the file's contents were already read, but not yet decoded.
|
|
|
|
|
2013-02-09 12:52:01 +00:00
|
|
|
If operation is `write-region', the coding system is chosen based
|
|
|
|
upon the value of `buffer-file-coding-system'. If
|
|
|
|
`buffer-file-coding-system' is non-nil, its value is used.
|
1997-08-17 01:49:50 +00:00
|
|
|
Otherwise, it is `undecided-dos'.
|
|
|
|
|
2013-02-09 12:52:01 +00:00
|
|
|
The most common situation is when DOS and Unix files are read and
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
written, and their names do not match in `w32-untranslated-filesystem-list'.
|
2013-02-09 12:52:01 +00:00
|
|
|
In these cases, the coding system initially will be `undecided'.
|
|
|
|
As the file is read in the DOS case, the coding system will be
|
|
|
|
changed to `undecided-dos' as CR/LFs are detected. As the file
|
|
|
|
is read in the Unix case, the coding system will be changed to
|
|
|
|
`undecided-unix' as LFs are detected. In both cases,
|
|
|
|
`buffer-file-coding-system' will be set to the appropriate coding
|
|
|
|
system, and the value of `buffer-file-coding-system' will be used
|
|
|
|
when writing the file."
|
1997-08-17 01:49:50 +00:00
|
|
|
|
1997-07-18 22:54:23 +00:00
|
|
|
(let ((op (nth 0 command))
|
2009-01-17 12:35:50 +00:00
|
|
|
(undecided nil) (undecided-unix nil)
|
|
|
|
target target-buf)
|
2002-07-05 23:15:06 +00:00
|
|
|
(cond ((eq op 'insert-file-contents)
|
1997-07-18 22:54:23 +00:00
|
|
|
(setq target (nth 1 command))
|
2006-07-21 09:20:02 +00:00
|
|
|
;; If TARGET is a cons cell, it has the form (FILENAME . BUFFER),
|
|
|
|
;; where BUFFER is a buffer into which the file was already read,
|
|
|
|
;; but its contents were not yet decoded. (This form of the
|
|
|
|
;; arguments is used, e.g., in arc-mode.el.) This function
|
|
|
|
;; doesn't care about the contents, it only looks at the file's
|
|
|
|
;; name, which is the CAR of the cons cell.
|
2009-01-17 12:35:50 +00:00
|
|
|
(when (consp target)
|
|
|
|
(setq target-buf
|
|
|
|
(and (bufferp (cdr target))
|
|
|
|
(buffer-name (cdr target))))
|
|
|
|
(setq target (car target)))
|
2013-02-09 12:52:01 +00:00
|
|
|
(cond ((or
|
|
|
|
;; For any existing file, decide based on contents.
|
2009-01-17 12:35:50 +00:00
|
|
|
(file-exists-p target)
|
|
|
|
;; If TARGET does not exist as a file, replace its
|
|
|
|
;; base name with TARGET-BUF and try again. This
|
|
|
|
;; is for jka-compr's sake, which strips the
|
|
|
|
;; compression (.gz etc.) extension from the
|
|
|
|
;; FILENAME, but leaves it in the BUFFER's name.
|
|
|
|
(and (stringp target-buf)
|
|
|
|
(file-exists-p
|
|
|
|
(expand-file-name target-buf
|
|
|
|
(file-name-directory target)))))
|
1997-09-01 17:04:41 +00:00
|
|
|
(setq undecided t))
|
|
|
|
;; Next check for a non-DOS file system.
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
((w32-untranslated-file-p target)
|
1997-09-01 17:04:41 +00:00
|
|
|
(setq undecided-unix t)))
|
2013-02-09 12:52:01 +00:00
|
|
|
(cond (undecided-unix '(undecided-unix . undecided-unix))
|
1997-08-17 01:49:50 +00:00
|
|
|
(undecided '(undecided . undecided))
|
2009-08-28 04:21:14 +00:00
|
|
|
(t (cons (default-value 'buffer-file-coding-system)
|
|
|
|
(default-value 'buffer-file-coding-system)))))
|
1997-08-17 01:49:50 +00:00
|
|
|
((eq op 'write-region)
|
|
|
|
(if buffer-file-coding-system
|
|
|
|
(cons buffer-file-coding-system
|
|
|
|
buffer-file-coding-system)
|
1997-09-01 17:04:41 +00:00
|
|
|
;; Normally this is used only in a non-file-visiting
|
|
|
|
;; buffer, because normally buffer-file-coding-system is non-nil
|
|
|
|
;; in a file-visiting buffer.
|
2013-02-09 12:52:01 +00:00
|
|
|
'(undecided-dos . undecided-dos))))))
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(make-obsolete 'find-buffer-file-type-coding-system nil "24.4")
|
1996-09-01 17:09:21 +00:00
|
|
|
|
2002-07-05 23:15:06 +00:00
|
|
|
(defun find-file-binary (filename)
|
1996-09-01 17:09:21 +00:00
|
|
|
"Visit file FILENAME and treat it as binary."
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
;; FIXME: Why here rather than in files.el?
|
|
|
|
;; FIXME: Can't we use find-file-literally for the same purposes?
|
1996-09-01 17:09:21 +00:00
|
|
|
(interactive "FFind file binary: ")
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(let ((coding-system-for-read 'no-conversion)) ;; FIXME: undecided-unix?
|
1996-09-01 17:09:21 +00:00
|
|
|
(find-file filename)))
|
|
|
|
|
2002-07-05 23:15:06 +00:00
|
|
|
(defun find-file-text (filename)
|
1996-09-01 17:09:21 +00:00
|
|
|
"Visit file FILENAME and treat it as a text file."
|
|
|
|
(interactive "FFind file text: ")
|
2013-02-09 12:52:01 +00:00
|
|
|
(let ((coding-system-for-read 'undecided-dos))
|
1996-09-01 17:09:21 +00:00
|
|
|
(find-file filename)))
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(defun w32-find-file-not-found-set-buffer-file-coding-system ()
|
* x-dnd.el (x-dnd-maybe-call-test-function):
* window.el (split-window-vertically):
* whitespace.el (whitespace-help-on):
* vc-rcs.el (vc-rcs-consult-headers):
* userlock.el (ask-user-about-lock-help)
(ask-user-about-supersession-help):
* type-break.el (type-break-force-mode-line-update):
* time-stamp.el (time-stamp-conv-warn):
* terminal.el (te-set-output-log, te-more-break, te-filter)
(te-sentinel,terminal-emulator):
* term.el (make-term, term-exec, term-sentinel, term-read-input-ring)
(term-write-input-ring, term-check-source, term-start-output-log):
(term-display-buffer-line, term-dynamic-list-completions):
(term-ansi-make-term, serial-term):
* subr.el (selective-display):
* strokes.el (strokes-xpm-to-compressed-string, strokes-decode-buffer)
(strokes-encode-buffer, strokes-xpm-for-compressed-string):
* speedbar.el (speedbar-buffers-tail-notes, speedbar-buffers-item-info)
(speedbar-reconfigure-keymaps, speedbar-add-localized-speedbar-support)
(speedbar-remove-localized-speedbar-support)
(speedbar-set-mode-line-format, speedbar-create-tag-hierarchy)
(speedbar-update-special-contents, speedbar-buffer-buttons-engine)
(speedbar-buffers-line-directory):
* simple.el (shell-command-on-region, append-to-buffer)
(prepend-to-buffer):
* shadowfile.el (shadow-save-todo-file):
* scroll-bar.el (scroll-bar-set-window-start, scroll-bar-drag-1)
(scroll-bar-maybe-set-window-start):
* sb-image.el (speedbar-image-dump):
* saveplace.el (save-place-alist-to-file, save-places-to-alist)
(load-save-place-alist-from-file):
* ps-samp.el (ps-print-message-from-summary):
* ps-print.el (ps-flush-output, ps-insert-file, ps-get-boundingbox)
(ps-background-image, ps-begin-job, ps-do-despool):
* ps-bdf.el (bdf-find-file, bdf-read-font-info):
* printing.el (pr-interface, pr-ps-file-print, pr-find-buffer-visiting)
(pr-ps-message-from-summary, pr-lpr-message-from-summary):
(pr-call-process, pr-file-list, pr-interface-save):
* novice.el (disabled-command-function)
(enable-command, disable-command):
* mouse.el (mouse-buffer-menu-alist):
* mouse-copy.el (mouse-kill-preserving-secondary):
* macros.el (kbd-macro-query):
* ledit.el (ledit-go-to-lisp, ledit-go-to-liszt):
* informat.el (batch-info-validate):
* ido.el (ido-copy-current-word, ido-initiate-auto-merge):
* hippie-exp.el (try-expand-dabbrev-visible):
* help-mode.el (help-make-xrefs):
* help-fns.el (describe-variable):
* generic-x.el (bat-generic-mode-run-as-comint):
* finder.el (finder-mouse-select):
* find-dired.el (find-dired-sentinel):
* filesets.el (filesets-file-close):
* files.el (list-directory):
* faces.el (list-faces-display, describe-face):
* facemenu.el (list-colors-display):
* ezimage.el (ezimage-image-association-dump, ezimage-image-dump):
* epg.el (epg--process-filter, epg-cancel):
* epa.el (epa--marked-keys, epa--select-keys, epa-display-info)
(epa--read-signature-type):
* emerge.el (emerge-copy-as-kill-A, emerge-copy-as-kill-B)
(emerge-file-names):
* ehelp.el (electric-helpify):
* ediff.el (ediff-regions-wordwise, ediff-regions-linewise):
* ediff-vers.el (rcs-ediff-view-revision):
* ediff-util.el (ediff-setup):
* ediff-mult.el (ediff-append-custom-diff):
* ediff-diff.el (ediff-exec-process, ediff-process-sentinel)
(ediff-wordify):
* echistory.el (Electric-command-history-redo-expression):
* dos-w32.el (find-file-not-found-set-buffer-file-coding-system):
* disp-table.el (describe-display-table):
* dired.el (dired-find-buffer-nocreate):
* dired-aux.el (dired-rename-subdir, dired-dwim-target-directory):
* dabbrev.el (dabbrev--same-major-mode-p):
* chistory.el (list-command-history):
* apropos.el (apropos-documentation):
* allout.el (allout-obtain-passphrase):
(allout-copy-exposed-to-buffer):
(allout-verify-passphrase): Use with-current-buffer.
2009-11-13 22:19:45 +00:00
|
|
|
(with-current-buffer (current-buffer)
|
2000-10-27 19:24:25 +00:00
|
|
|
(let ((coding buffer-file-coding-system))
|
|
|
|
;; buffer-file-coding-system is already set by
|
|
|
|
;; find-operation-coding-system, which was called from
|
|
|
|
;; insert-file-contents. All that's left is to change
|
|
|
|
;; the EOL conversion, if required by the user.
|
|
|
|
(when (and (null coding-system-for-read)
|
|
|
|
(or inhibit-eol-conversion
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(w32-untranslated-file-p (buffer-file-name))))
|
2000-10-27 19:24:25 +00:00
|
|
|
(setq coding (coding-system-change-eol-conversion coding 0))
|
|
|
|
(setq buffer-file-coding-system coding))
|
2012-11-26 17:09:04 +00:00
|
|
|
nil)))
|
1997-08-17 01:49:50 +00:00
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
;; To set the default coding system on new files.
|
2006-06-23 10:39:05 +00:00
|
|
|
(add-hook 'find-file-not-found-functions
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
'w32-find-file-not-found-set-buffer-file-coding-system)
|
1996-09-01 17:09:21 +00:00
|
|
|
|
2008-05-23 04:44:07 +00:00
|
|
|
;;; To accommodate filesystems that do not require CR/LF translation.
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(define-obsolete-variable-alias 'untranslated-filesystem-list
|
|
|
|
'w32-untranslated-filesystem-list "24.4")
|
|
|
|
(defvar w32-untranslated-filesystem-list nil
|
2002-07-05 23:15:06 +00:00
|
|
|
"List of filesystems that require no CR/LF translation when reading
|
1996-09-01 17:09:21 +00:00
|
|
|
and writing files. Each filesystem in the list is a string naming
|
|
|
|
the directory prefix corresponding to the filesystem.")
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(defun w32-untranslated-canonical-name (filename)
|
1996-09-01 17:09:21 +00:00
|
|
|
"Return FILENAME in a canonicalized form for use with the functions
|
|
|
|
dealing with untranslated filesystems."
|
2003-01-31 15:24:20 +00:00
|
|
|
(if (memq system-type '(ms-dos windows-nt cygwin))
|
1997-01-20 01:07:48 +00:00
|
|
|
;; The canonical form for DOS/W32 is with A-Z downcased and all
|
1996-09-01 17:09:21 +00:00
|
|
|
;; directory separators changed to directory-sep-char.
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(let ((name
|
|
|
|
(mapconcat (lambda (char)
|
|
|
|
(char-to-string (if (and (<= ?A char ?Z))
|
|
|
|
(+ (- char ?A) ?a)
|
|
|
|
char)))
|
|
|
|
filename nil)))
|
1996-09-01 17:09:21 +00:00
|
|
|
;; Use expand-file-name to canonicalize directory separators, except
|
|
|
|
;; with bare drive letters (which would have the cwd appended).
|
1999-07-01 19:42:42 +00:00
|
|
|
;; Avoid expanding names that could trigger ange-ftp to prompt
|
|
|
|
;; for passwords, though.
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(if (or (string-match-p "^.:\\'" name)
|
lisp/*.el: Fix typos; use string-match-p, looking-at-p, setq-local, defvar-local.
* lisp/allout-widgets.el (allout-widgets-mode-off)
(allout-widgets-mode-on, allout-widgets-pre-command-business)
(allout-widgets-post-command-business)
(allout-widgets-after-copy-or-kill-function)
(allout-widgets-after-undo-function, allout-test-range-overlaps)
(allout-decorate-item-and-context)
(allout-graphics-modification-handler): Fix typos in docstrings.
(allout-get-or-create-parent-widget): Use `looking-at-p'.
* lisp/cmuscheme.el (scheme-start-file): Doc fix.
(inferior-scheme-mode, switch-to-scheme): Fix typos in docstrings.
(scheme-input-filter): Use `string-match-p'.
* lisp/composite.el (compose-gstring-for-terminal): Fix typo in docstring.
* lisp/dired-x.el: Use Dired consistently in docstrings.
* lisp/dired.el: Use Dired consistently in docstrings.
(dired-readin, dired-mode): Use `setq-local'.
(dired-switches-alist): Make defvar-local.
(dired-buffers-for-dir): Use `zerop'.
(dired-safe-switches-p, dired-switches-escape-p)
(dired-insert-old-subdirs, dired-move-to-end-of-filename)
(dired-glob-regexp, dired-in-this-tree, dired-goto-file-1)
(dired-sort-set-mode-line, dired-sort-toggle, dired-sort-R-check):
(dired-goto-next-nontrivial-file): Use `string-match-p'.
(dired-align-file, dired-insert-directory, dired-mark-files-in-region)
(dired-toggle-marks, dired-mark-files-containing-regexp)
(dired-mark-symlinks, dired-mark-directories, dired-mark-executables)
(dired-flag-auto-save-files, dired-flag-backup-files):
Use `looking-at-p'.
(dired-mark-files-regexp, dired-build-subdir-alist):
Use `string-match-p', `looking-at-p'.
* lisp/dos-w32.el (untranslated-canonical-name, untranslated-file-p)
(direct-print-region-helper): Use `string-match-p'.
2013-06-21 12:24:37 +00:00
|
|
|
(string-match-p "^/[^/:]+:" name))
|
1996-09-01 17:09:21 +00:00
|
|
|
name
|
|
|
|
(expand-file-name name)))
|
|
|
|
filename))
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(defun w32-untranslated-file-p (filename)
|
2002-07-05 23:15:06 +00:00
|
|
|
"Return t if FILENAME is on a filesystem that does not require
|
1996-09-01 17:09:21 +00:00
|
|
|
CR/LF translation, and nil otherwise."
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(let ((fs (w32-untranslated-canonical-name filename))
|
|
|
|
(ufs-list w32-untranslated-filesystem-list)
|
1996-09-01 17:09:21 +00:00
|
|
|
(found nil))
|
|
|
|
(while (and (not found) ufs-list)
|
lisp/*.el: Fix typos; use string-match-p, looking-at-p, setq-local, defvar-local.
* lisp/allout-widgets.el (allout-widgets-mode-off)
(allout-widgets-mode-on, allout-widgets-pre-command-business)
(allout-widgets-post-command-business)
(allout-widgets-after-copy-or-kill-function)
(allout-widgets-after-undo-function, allout-test-range-overlaps)
(allout-decorate-item-and-context)
(allout-graphics-modification-handler): Fix typos in docstrings.
(allout-get-or-create-parent-widget): Use `looking-at-p'.
* lisp/cmuscheme.el (scheme-start-file): Doc fix.
(inferior-scheme-mode, switch-to-scheme): Fix typos in docstrings.
(scheme-input-filter): Use `string-match-p'.
* lisp/composite.el (compose-gstring-for-terminal): Fix typo in docstring.
* lisp/dired-x.el: Use Dired consistently in docstrings.
* lisp/dired.el: Use Dired consistently in docstrings.
(dired-readin, dired-mode): Use `setq-local'.
(dired-switches-alist): Make defvar-local.
(dired-buffers-for-dir): Use `zerop'.
(dired-safe-switches-p, dired-switches-escape-p)
(dired-insert-old-subdirs, dired-move-to-end-of-filename)
(dired-glob-regexp, dired-in-this-tree, dired-goto-file-1)
(dired-sort-set-mode-line, dired-sort-toggle, dired-sort-R-check):
(dired-goto-next-nontrivial-file): Use `string-match-p'.
(dired-align-file, dired-insert-directory, dired-mark-files-in-region)
(dired-toggle-marks, dired-mark-files-containing-regexp)
(dired-mark-symlinks, dired-mark-directories, dired-mark-executables)
(dired-flag-auto-save-files, dired-flag-backup-files):
Use `looking-at-p'.
(dired-mark-files-regexp, dired-build-subdir-alist):
Use `string-match-p', `looking-at-p'.
* lisp/dos-w32.el (untranslated-canonical-name, untranslated-file-p)
(direct-print-region-helper): Use `string-match-p'.
2013-06-21 12:24:37 +00:00
|
|
|
(if (string-match-p (concat "^" (car ufs-list)) fs)
|
1996-09-01 17:09:21 +00:00
|
|
|
(setq found t)
|
|
|
|
(setq ufs-list (cdr ufs-list))))
|
|
|
|
found))
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(define-obsolete-function-alias 'add-untranslated-filesystem
|
|
|
|
'w32-add-untranslated-filesystem "24.4")
|
|
|
|
(defun w32-add-untranslated-filesystem (filesystem)
|
1996-09-01 17:09:21 +00:00
|
|
|
"Add FILESYSTEM to the list of filesystems that do not require
|
|
|
|
CR/LF translation. FILESYSTEM is a string containing the directory
|
2002-07-05 23:15:06 +00:00
|
|
|
prefix corresponding to the filesystem. For example, for a Unix
|
1996-09-01 17:09:21 +00:00
|
|
|
filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"."
|
2000-10-27 19:24:25 +00:00
|
|
|
;; We use "D", not "f", to avoid confusing the user: "f" prompts
|
|
|
|
;; with a directory, but RET returns the current buffer's file, not
|
|
|
|
;; its directory.
|
|
|
|
(interactive "DUntranslated file system: ")
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(let ((fs (w32-untranslated-canonical-name filesystem)))
|
|
|
|
(if (member fs w32-untranslated-filesystem-list)
|
|
|
|
w32-untranslated-filesystem-list
|
|
|
|
(push fs w32-untranslated-filesystem-list))))
|
|
|
|
|
1996-09-01 17:09:21 +00:00
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(define-obsolete-function-alias 'remove-untranslated-filesystem
|
|
|
|
'w32-remove-untranslated-filesystem "24.4")
|
|
|
|
(defun w32-remove-untranslated-filesystem (filesystem)
|
2002-07-05 23:15:06 +00:00
|
|
|
"Remove FILESYSTEM from the list of filesystems that do not require
|
1996-09-01 17:09:21 +00:00
|
|
|
CR/LF translation. FILESYSTEM is a string containing the directory
|
2002-07-05 23:15:06 +00:00
|
|
|
prefix corresponding to the filesystem. For example, for a Unix
|
1996-09-01 17:09:21 +00:00
|
|
|
filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"."
|
1997-05-20 18:51:22 +00:00
|
|
|
(interactive "fUntranslated file system: ")
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(setq w32-untranslated-filesystem-list
|
|
|
|
(delete (w32-untranslated-canonical-name filesystem)
|
|
|
|
w32-untranslated-filesystem-list)))
|
1996-09-01 17:09:21 +00:00
|
|
|
|
1999-01-17 19:00:24 +00:00
|
|
|
;;; Support for printing under DOS/Windows, see lpr.el and ps-print.el.
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(define-obsolete-variable-alias 'direct-print-region-use-command-dot-com
|
|
|
|
'w32-direct-print-region-use-command-dot-com "24.4")
|
|
|
|
(defcustom w32-direct-print-region-use-command-dot-com t
|
2012-05-04 05:14:14 +00:00
|
|
|
"If non-nil, use command.com to print on Windows 9x."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'dos-fns
|
|
|
|
:group 'w32)
|
1999-05-02 09:36:07 +00:00
|
|
|
|
1999-01-17 19:00:24 +00:00
|
|
|
;; Function to actually send data to the printer port.
|
|
|
|
;; Supports writing directly, and using various programs.
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(defun w32-direct-print-region-helper (printer
|
2013-07-24 04:37:11 +00:00
|
|
|
start end
|
|
|
|
lpr-prog
|
|
|
|
_delete-text _buf _display
|
|
|
|
rest)
|
1999-05-02 09:36:07 +00:00
|
|
|
(let* (;; Ignore case when matching known external program names.
|
1999-01-17 19:00:24 +00:00
|
|
|
(case-fold-search t)
|
|
|
|
;; Convert / to \ in printer name, for sake of external programs.
|
|
|
|
(printer
|
|
|
|
(if (stringp printer)
|
|
|
|
(subst-char-in-string ?/ ?\\ printer)
|
|
|
|
printer))
|
|
|
|
;; Find a directory that is local, to work-around Windows bug.
|
|
|
|
(safe-dir
|
|
|
|
(let ((safe-dirs (list "c:/" (getenv "windir") (getenv "TMPDIR"))))
|
|
|
|
(while (not (file-attributes (car safe-dirs)))
|
|
|
|
(setq safe-dirs (cdr safe-dirs)))
|
|
|
|
(car safe-dirs)))
|
|
|
|
(tempfile
|
1999-05-02 09:36:07 +00:00
|
|
|
(subst-char-in-string
|
|
|
|
?/ ?\\
|
|
|
|
(make-temp-name
|
1999-09-02 11:51:42 +00:00
|
|
|
(expand-file-name "EP" temporary-file-directory))))
|
1999-01-17 19:00:24 +00:00
|
|
|
;; capture output for diagnosis
|
|
|
|
(errbuf (list (get-buffer-create " *print-region-helper*") t)))
|
|
|
|
;; It seems that we must be careful about the directory name that
|
|
|
|
;; gets added to the printer port name by write-region when using
|
|
|
|
;; the standard "PRN" or "LPTx" ports, because the write can fail if
|
|
|
|
;; the directory is on a network drive. The same is true when
|
|
|
|
;; asking command.com to copy the file.
|
|
|
|
;; No action is needed for UNC printer names, which is just as well
|
|
|
|
;; because `expand-file-name' doesn't support UNC names on MS-DOS.
|
lisp/*.el: Fix typos; use string-match-p, looking-at-p, setq-local, defvar-local.
* lisp/allout-widgets.el (allout-widgets-mode-off)
(allout-widgets-mode-on, allout-widgets-pre-command-business)
(allout-widgets-post-command-business)
(allout-widgets-after-copy-or-kill-function)
(allout-widgets-after-undo-function, allout-test-range-overlaps)
(allout-decorate-item-and-context)
(allout-graphics-modification-handler): Fix typos in docstrings.
(allout-get-or-create-parent-widget): Use `looking-at-p'.
* lisp/cmuscheme.el (scheme-start-file): Doc fix.
(inferior-scheme-mode, switch-to-scheme): Fix typos in docstrings.
(scheme-input-filter): Use `string-match-p'.
* lisp/composite.el (compose-gstring-for-terminal): Fix typo in docstring.
* lisp/dired-x.el: Use Dired consistently in docstrings.
* lisp/dired.el: Use Dired consistently in docstrings.
(dired-readin, dired-mode): Use `setq-local'.
(dired-switches-alist): Make defvar-local.
(dired-buffers-for-dir): Use `zerop'.
(dired-safe-switches-p, dired-switches-escape-p)
(dired-insert-old-subdirs, dired-move-to-end-of-filename)
(dired-glob-regexp, dired-in-this-tree, dired-goto-file-1)
(dired-sort-set-mode-line, dired-sort-toggle, dired-sort-R-check):
(dired-goto-next-nontrivial-file): Use `string-match-p'.
(dired-align-file, dired-insert-directory, dired-mark-files-in-region)
(dired-toggle-marks, dired-mark-files-containing-regexp)
(dired-mark-symlinks, dired-mark-directories, dired-mark-executables)
(dired-flag-auto-save-files, dired-flag-backup-files):
Use `looking-at-p'.
(dired-mark-files-regexp, dired-build-subdir-alist):
Use `string-match-p', `looking-at-p'.
* lisp/dos-w32.el (untranslated-canonical-name, untranslated-file-p)
(direct-print-region-helper): Use `string-match-p'.
2013-06-21 12:24:37 +00:00
|
|
|
(if (and (stringp printer) (not (string-match-p "^\\\\" printer)))
|
1999-05-02 09:36:07 +00:00
|
|
|
(setq printer
|
|
|
|
(subst-char-in-string ?/ ?\\ (expand-file-name printer safe-dir))))
|
1999-01-17 19:00:24 +00:00
|
|
|
;; Handle known programs specially where necessary.
|
|
|
|
(unwind-protect
|
|
|
|
(cond
|
|
|
|
;; nprint.exe is the standard print command on Netware
|
2013-07-24 04:37:11 +00:00
|
|
|
((string-match-p "\\`nprint\\(\\.exe\\)?\\'"
|
|
|
|
(file-name-nondirectory lpr-prog))
|
1999-01-17 19:00:24 +00:00
|
|
|
(write-region start end tempfile nil 0)
|
|
|
|
(call-process lpr-prog nil errbuf nil
|
|
|
|
tempfile (concat "P=" printer)))
|
|
|
|
;; print.exe is a standard command on NT
|
2013-07-24 04:37:11 +00:00
|
|
|
((string-match-p "\\`print\\(\\.exe\\)?\\'"
|
|
|
|
(file-name-nondirectory lpr-prog))
|
1999-01-17 19:00:24 +00:00
|
|
|
;; Be careful not to invoke print.exe on MS-DOS or Windows 9x
|
|
|
|
;; though, because it is a TSR program there (hangs Emacs).
|
|
|
|
(or (and (eq system-type 'windows-nt)
|
|
|
|
(null (getenv "winbootdir")))
|
|
|
|
(error "Printing via print.exe is not supported on MS-DOS or Windows 9x"))
|
|
|
|
;; It seems that print.exe always appends a form-feed so we
|
|
|
|
;; should make sure to omit the last FF in the data.
|
|
|
|
(if (and (> end start)
|
|
|
|
(char-equal (char-before end) ?\C-l))
|
|
|
|
(setq end (1- end)))
|
|
|
|
;; cancel out annotate function for non-PS case
|
|
|
|
(let ((write-region-annotate-functions nil))
|
|
|
|
(write-region start end tempfile nil 0))
|
|
|
|
(call-process lpr-prog nil errbuf nil
|
|
|
|
(concat "/D:" printer) tempfile))
|
|
|
|
;; support lpr and similar programs for convenience, but
|
|
|
|
;; supply an explicit filename because the NT version of lpr
|
|
|
|
;; can't read from stdin.
|
|
|
|
((> (length lpr-prog) 0)
|
|
|
|
(write-region start end tempfile nil 0)
|
|
|
|
(setq rest (append rest (list tempfile)))
|
|
|
|
(apply 'call-process lpr-prog nil errbuf nil rest))
|
|
|
|
;; Run command.com to access printer port on Windows 9x, unless
|
|
|
|
;; we are supposed to append to an existing (non-empty) file,
|
2012-07-29 08:18:29 +00:00
|
|
|
;; to work around a bug in Windows 9x that prevents Windows
|
1999-01-17 19:00:24 +00:00
|
|
|
;; programs from accessing LPT ports reliably.
|
|
|
|
((and (eq system-type 'windows-nt)
|
|
|
|
(getenv "winbootdir")
|
1999-05-02 09:36:07 +00:00
|
|
|
;; Allow cop-out so command.com isn't invoked
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
w32-direct-print-region-use-command-dot-com
|
1999-01-17 19:00:24 +00:00
|
|
|
;; file-attributes fails on LPT ports on Windows 9x but
|
|
|
|
;; not on NT, so handle both cases for safety.
|
file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers. Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
|
|
|
(eq (or (file-attribute-size (file-attributes printer)) 0) 0))
|
1999-01-17 19:00:24 +00:00
|
|
|
(write-region start end tempfile nil 0)
|
|
|
|
(let ((w32-quote-process-args nil))
|
|
|
|
(call-process "command.com" nil errbuf nil "/c"
|
|
|
|
(format "copy /b %s %s" tempfile printer))))
|
|
|
|
;; write directly to the printer port
|
|
|
|
(t
|
|
|
|
(write-region start end printer t 0)))
|
|
|
|
;; ensure we remove the tempfile if created
|
|
|
|
(if (file-exists-p tempfile)
|
|
|
|
(delete-file tempfile)))))
|
|
|
|
|
1998-07-03 19:54:01 +00:00
|
|
|
(defvar printer-name)
|
|
|
|
|
2007-11-22 01:05:55 +00:00
|
|
|
(declare-function default-printer-name "w32fns.c")
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(define-obsolete-function-alias 'direct-print-region-function
|
|
|
|
'w32-direct-print-region-function "24.4")
|
|
|
|
(defun w32-direct-print-region-function (start end
|
|
|
|
&optional lpr-prog
|
|
|
|
delete-text buf display
|
|
|
|
&rest rest)
|
1998-07-03 19:54:01 +00:00
|
|
|
"DOS/Windows-specific function to print the region on a printer.
|
|
|
|
Writes the region to the device or file which is a value of
|
lisp/*.el: Fix typos; use string-match-p, looking-at-p, setq-local, defvar-local.
* lisp/allout-widgets.el (allout-widgets-mode-off)
(allout-widgets-mode-on, allout-widgets-pre-command-business)
(allout-widgets-post-command-business)
(allout-widgets-after-copy-or-kill-function)
(allout-widgets-after-undo-function, allout-test-range-overlaps)
(allout-decorate-item-and-context)
(allout-graphics-modification-handler): Fix typos in docstrings.
(allout-get-or-create-parent-widget): Use `looking-at-p'.
* lisp/cmuscheme.el (scheme-start-file): Doc fix.
(inferior-scheme-mode, switch-to-scheme): Fix typos in docstrings.
(scheme-input-filter): Use `string-match-p'.
* lisp/composite.el (compose-gstring-for-terminal): Fix typo in docstring.
* lisp/dired-x.el: Use Dired consistently in docstrings.
* lisp/dired.el: Use Dired consistently in docstrings.
(dired-readin, dired-mode): Use `setq-local'.
(dired-switches-alist): Make defvar-local.
(dired-buffers-for-dir): Use `zerop'.
(dired-safe-switches-p, dired-switches-escape-p)
(dired-insert-old-subdirs, dired-move-to-end-of-filename)
(dired-glob-regexp, dired-in-this-tree, dired-goto-file-1)
(dired-sort-set-mode-line, dired-sort-toggle, dired-sort-R-check):
(dired-goto-next-nontrivial-file): Use `string-match-p'.
(dired-align-file, dired-insert-directory, dired-mark-files-in-region)
(dired-toggle-marks, dired-mark-files-containing-regexp)
(dired-mark-symlinks, dired-mark-directories, dired-mark-executables)
(dired-flag-auto-save-files, dired-flag-backup-files):
Use `looking-at-p'.
(dired-mark-files-regexp, dired-build-subdir-alist):
Use `string-match-p', `looking-at-p'.
* lisp/dos-w32.el (untranslated-canonical-name, untranslated-file-p)
(direct-print-region-helper): Use `string-match-p'.
2013-06-21 12:24:37 +00:00
|
|
|
`printer-name' (which see), unless the value of `lpr-command'
|
1999-01-17 19:00:24 +00:00
|
|
|
indicates a specific program should be invoked."
|
1998-07-03 19:54:01 +00:00
|
|
|
|
|
|
|
;; DOS printers need the lines to end with CR-LF pairs, so make
|
|
|
|
;; sure it always happens that way, unless the buffer is binary.
|
|
|
|
(let* ((coding coding-system-for-write)
|
|
|
|
(coding-base
|
|
|
|
(if (null coding) 'undecided (coding-system-base coding)))
|
1998-12-02 23:01:50 +00:00
|
|
|
(eol-type (coding-system-eol-type coding-base))
|
1999-01-17 19:00:24 +00:00
|
|
|
;; Make each print-out eject the final page, but don't waste
|
|
|
|
;; paper if the file ends with a form-feed already.
|
1998-12-02 23:01:50 +00:00
|
|
|
(write-region-annotate-functions
|
|
|
|
(cons
|
2011-04-19 13:44:55 +00:00
|
|
|
(lambda (_start end)
|
2013-07-24 04:37:11 +00:00
|
|
|
(if (not (char-equal (char-before end) ?\f))
|
1998-12-02 23:01:50 +00:00
|
|
|
`((,end . "\f"))))
|
1999-01-17 19:00:24 +00:00
|
|
|
write-region-annotate-functions))
|
|
|
|
(printer (or (and (boundp 'dos-printer)
|
|
|
|
(stringp (symbol-value 'dos-printer))
|
|
|
|
(symbol-value 'dos-printer))
|
2004-01-28 23:32:55 +00:00
|
|
|
printer-name
|
|
|
|
(default-printer-name))))
|
1998-07-03 19:54:01 +00:00
|
|
|
(or (eq coding-system-for-write 'no-conversion)
|
|
|
|
(setq coding-system-for-write
|
|
|
|
(aref eol-type 1))) ; force conversion to DOS EOLs
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(w32-direct-print-region-helper printer start end lpr-prog
|
|
|
|
delete-text buf display rest)))
|
1999-01-17 19:00:24 +00:00
|
|
|
|
2007-10-21 19:35:11 +00:00
|
|
|
(defvar lpr-headers-switches)
|
1998-07-03 19:54:01 +00:00
|
|
|
|
|
|
|
;; Set this to nil if you have a port of the `pr' program
|
|
|
|
;; (e.g., from GNU Textutils), or if you have an `lpr'
|
|
|
|
;; program (see above) that can print page headers.
|
|
|
|
;; If `lpr-headers-switches' is non-nil (the default) and
|
|
|
|
;; `print-region-function' is set to `dos-print-region-function',
|
|
|
|
;; then requests to print page headers will be silently
|
|
|
|
;; ignored, and `print-buffer' and `print-region' produce
|
|
|
|
;; the same output as `lpr-buffer' and `lpr-region', accordingly.
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(when (memq system-type '(ms-dos windows-nt))
|
|
|
|
(setq lpr-headers-switches "(page headers are not supported)"))
|
1998-07-03 19:54:01 +00:00
|
|
|
|
|
|
|
(defvar ps-printer-name)
|
|
|
|
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(define-obsolete-function-alias 'direct-ps-print-region-function
|
|
|
|
'w32-direct-ps-print-region-function "24.4")
|
|
|
|
(defun w32-direct-ps-print-region-function (start end
|
|
|
|
&optional lpr-prog
|
|
|
|
delete-text buf display
|
|
|
|
&rest rest)
|
1999-01-17 19:00:24 +00:00
|
|
|
"DOS/Windows-specific function to print the region on a PostScript printer.
|
|
|
|
Writes the region to the device or file which is a value of
|
lisp/*.el: Fix typos; use string-match-p, looking-at-p, setq-local, defvar-local.
* lisp/allout-widgets.el (allout-widgets-mode-off)
(allout-widgets-mode-on, allout-widgets-pre-command-business)
(allout-widgets-post-command-business)
(allout-widgets-after-copy-or-kill-function)
(allout-widgets-after-undo-function, allout-test-range-overlaps)
(allout-decorate-item-and-context)
(allout-graphics-modification-handler): Fix typos in docstrings.
(allout-get-or-create-parent-widget): Use `looking-at-p'.
* lisp/cmuscheme.el (scheme-start-file): Doc fix.
(inferior-scheme-mode, switch-to-scheme): Fix typos in docstrings.
(scheme-input-filter): Use `string-match-p'.
* lisp/composite.el (compose-gstring-for-terminal): Fix typo in docstring.
* lisp/dired-x.el: Use Dired consistently in docstrings.
* lisp/dired.el: Use Dired consistently in docstrings.
(dired-readin, dired-mode): Use `setq-local'.
(dired-switches-alist): Make defvar-local.
(dired-buffers-for-dir): Use `zerop'.
(dired-safe-switches-p, dired-switches-escape-p)
(dired-insert-old-subdirs, dired-move-to-end-of-filename)
(dired-glob-regexp, dired-in-this-tree, dired-goto-file-1)
(dired-sort-set-mode-line, dired-sort-toggle, dired-sort-R-check):
(dired-goto-next-nontrivial-file): Use `string-match-p'.
(dired-align-file, dired-insert-directory, dired-mark-files-in-region)
(dired-toggle-marks, dired-mark-files-containing-regexp)
(dired-mark-symlinks, dired-mark-directories, dired-mark-executables)
(dired-flag-auto-save-files, dired-flag-backup-files):
Use `looking-at-p'.
(dired-mark-files-regexp, dired-build-subdir-alist):
Use `string-match-p', `looking-at-p'.
* lisp/dos-w32.el (untranslated-canonical-name, untranslated-file-p)
(direct-print-region-helper): Use `string-match-p'.
2013-06-21 12:24:37 +00:00
|
|
|
`ps-printer-name' (which see), unless the value of `ps-lpr-command'
|
1999-01-17 19:00:24 +00:00
|
|
|
indicates a specific program should be invoked."
|
|
|
|
|
|
|
|
(let ((printer (or (and (boundp 'dos-ps-printer)
|
|
|
|
(stringp (symbol-value 'dos-ps-printer))
|
|
|
|
(symbol-value 'dos-ps-printer))
|
2004-01-28 23:32:55 +00:00
|
|
|
ps-printer-name
|
|
|
|
(default-printer-name))))
|
Cleanup namespace of dos-w32.el.
* lisp/dos-w32.el (minibuffer-history-case-insensitive-variables)
(path-separator, null-device, buffer-file-coding-system)
(lpr-headers-switches): Check system-type before modifying them.
(find-buffer-file-type-coding-system): Mark obsolete.
(w32-find-file-not-found-set-buffer-file-coding-system): Rename from
find-file-not-found-set-buffer-file-coding-system.
(w32-untranslated-filesystem-list, w32-untranslated-canonical-name):
(w32-add-untranslated-filesystem, w32-remove-untranslated-filesystem)
(w32-direct-print-region-use-command-dot-com, w32-untranslated-file-p):
(w32-direct-print-region-helper, w32-direct-print-region-function)
(w32-direct-ps-print-region-function): Rename by adding a "w32-" prefix.
* lisp/startup.el (normal-top-level-add-subdirs-to-load-path):
* lisp/ps-print.el (ps-print-region-function):
* lisp/lpr.el (print-region-function): Use new name.
* lisp/simple.el (copy-region-as-kill): Fix call to region-extract-function.
* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add new `2-and' handler.
(byte-compile-and-folded): New function.
(=, <, >, <=, >=): Use it.
2013-10-30 02:45:53 +00:00
|
|
|
(w32-direct-print-region-helper printer start end lpr-prog
|
|
|
|
delete-text buf display rest)))
|
1999-01-17 19:00:24 +00:00
|
|
|
|
|
|
|
;(setq ps-lpr-command "gs")
|
1998-07-03 19:54:01 +00:00
|
|
|
|
1999-01-17 19:00:24 +00:00
|
|
|
;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60"
|
|
|
|
; "-sOutputFile=LPT1"))
|
1998-07-03 19:54:01 +00:00
|
|
|
|
1996-11-19 07:02:50 +00:00
|
|
|
(provide 'dos-w32)
|
1996-09-01 17:09:21 +00:00
|
|
|
|
1996-11-19 07:02:50 +00:00
|
|
|
;;; dos-w32.el ends here
|