Mercurial > emacs
annotate lisp/dos-w32.el @ 99501:e3acb52d33e1
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-yank): Make any prefix force normal yanking.
Suppress folding if text would be swallowed into a folded
subtree.
(org-yank-folded-subtrees, org-yank): Docstring updates.
* org-agenda.el (org-agenda-compare-effort): Treat no effort
defined as 0.
* org-exp.el (org-export-language-setup): Add Catalan and
Esperanto language entries.
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-refile): Allow refiling of entire regions.
* org-clock.el (org-clock-time%): New function.
* org.el (org-entry-get, org-entry-delete): Use safer regexps to
retrieve property values.
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-list): Handle the value `only' of
org-agenda-show-log'.
(org-agenda-log-mode): Interpret a double prefix arg.
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-html-footnotes-section): New variable.
(org-export-as-html): Use `org-export-html-footnotes-section' to
insert the footnotes.
(org-export-language-setup): Add "Footnotes" to language words.
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-yank): Fix bug when not inserting a subtree.
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org-vm.el (org-vm-follow-link): Call `vm-preview-current-message'
instead of `vm-beginning-of-message'.
* org.el (org-make-link-regexps): Make sure that links to gnus can
contain brackets.
2008-11-12 Carsten Dominik <carsten.dominik@gmail.com>
* org-attach.el (org-attach-dir): Remove duplicate ID creation
code.
* org-id.el (org-id-new): Use `org-trim' to extract the uuid from
shell output.
* org.el (org-link-abbrev-alist): Improve customization type.
* org-attach.el (org-attach-expand-link, org-attach-expand): New
functions.
* org-agenda.el (org-agenda-get-progress): Renamed from
`org-get-closed'. Implement searching for state changes as well.
(org-agenda-log-mode-items): New option.
(org-agenda-log-mode): New option prefix argument, interpreted as
request to show all possible progress info.
(org-agenda-get-day-entries): Call `org-get-progress' instead of
`org-get-closed'.
(org-agenda-set-mode-name): Handle the more complex log mode
settings.
(org-get-closed): New alias, pointing to `org-get-progress'.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-file-apps-defaults-gnu)
(org-file-apps-defaults-macosx)
(org-file-apps-defaults-windowsnt): Add an entry defining the
system command.
(org-file-apps): Allow `system' as key and value.
(org-open-at-point): Explain the effect of a double prefix arg.
(org-open-file): If the argument `in-emacs' is (16),
i.e. corresponding to a double prefix argument, try to open the
file externally.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-insert-link): Abbreviate absolute files names in
links. Also, fix a bug in which the double C-u prefix would not
be honored.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-insert-heading): If buffer does not end with a
newline, add one if necessary to insert headline correctly.
* org-exp.el (org-export-as-html): Make sure that <hr/> is between
paragraphs, not inside.
* org.el (org-todo): Quote
`org-agenda-headline-snapshot-before-repeat'.
* org-exp.el (org-export-as-html): Fully process link descriptions.
(org-export-html-format-desc): New function.
(org-export-as-html): Collect footnotes into the correct basket.
(org-html-protect): No longer protect quotations marks here, this
goes wrong.
* org-agenda.el (org-agenda-remove-marked-text): Bind variable
BEG.
* org-compat.el (org-fit-window-to-buffer): New function (not
really, a preliminary and incomplete version was present earlier,
but not used).
* org.el (org-fast-todo-selection, org-fast-tag-selection): Use
`org-fit-window-to-buffer'.
* org-exp.el (org-export): Use `org-fit-window-to-buffer'.
* org-agenda.el (org-agenda-get-restriction-and-command)
(org-fit-agenda-window, org-agenda-convert-date): Use
`org-fit-window-to-buffer'.
* org-exp.el (org-export-as-html): Process href links through
`org-export-html-format-href'.
(org-export-html-format-href): New function.
* org-agenda.el (org-agenda-todo): Update only the current
headline if this is a repeated TODO, marked done for today.
(org-agenda-change-all-lines): New argument JUST-THIS, to change
only the current line.
* org.el (org-todo): Take a snapshot of the headline if the
repeater might change it.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org-publish.el (org-publish-find-title): Remove buffers visited
only for extracting the title.
* org-exp.el (org-export-html-style)
(org-export-html-style-default): Mark style definitions as
unparsed CDATA.
* org-publish.el (org-publish-validate-link): Function
re-introduced.
2008-11-12 Charles Sebold <csebold@gmail.com>
* org-plot.el (org-plot/add-options-to-plist): Supports timefmt
property.
(org-plot-quote-timestamp-field): New function.
(org-plot-quote-tsv-field): Call timestamp field function when
necessary rather than just quoting as a string.
(org-plot/gnuplot-to-data): Pass in timefmt property.
(org-plot/gnuplot-script): Supports timefmt property.
(org-plot/gnuplot): Checks for timestamp column before checking
for text index column.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-insert-heading): Improve behavior with hidden subtrees.
* org-publish.el (org-publish-org-index): Create a section in the
index file.
(org-publish-org-index): Stop linking to directories.
* org.el (org-emphasis-alist): Use span instead of <u> to
underline text.
* org-exp.el (org-export-as-html): Make sure <p> is closed before
<pre> sections.
2008-11-12 Sebastian Rose <sebastian_rose@gmx.de>
* org-jsinfo.el (org-infojs-template): Remove language attribute
from script tag.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org-agenda.el (org-agenda-remove-marked-text): New function.
(org-agenda-mark-filtered-text)
(org-agenda-unmark-filtered-text): New functions.
(org-write-agenda): Remove fltered text.
* org.el (org-make-tags-matcher): Give access to TODO "property"
without speed penalty.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-link-frame-setup): Add `org-gnus-no-new-news' as an
option.
(org-store-link-props): Make sure adding to the plist works
correctly.
* org-gnus.el (org-gnus-no-new-news): New function.
(org-gnus-follow-link): Allow the article ID to be a message-id,
in addition to allowing article numbers. Message IDs make much
more roubust links.
(org-gnus-store-link): Use message-id to create link.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-emphasize): Reverse the selection array.
(org-emphasis-alist): Set <code> tags for the verbatim
environment.
* org-remember.el (org-remember-handler): Fix bug with
prefix-related changing of the note storage target.
* org-exp.el (org-print-icalendar-entries): Make the exported
priorities compatible with RFC 2445.
* org-clock.el (org-clock-save): Insert time stamp without
dependence on time-stamp.el.
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org.el ("saveplace"): If saveplace puts point into an invisible
location, make it visible.
(org-make-tags-matcher): Allow inactive time stamps in time
comparisons.
(org-yank-adjusted-subtrees): New option.
(org-yank): Incorporate adjusting trees.
(org-paste-subtree): New argument FOR-YANK which will cause
insertion at point without backing up over white lines, and leave
point at the end of the inserted text. Also if the cursor is
at the beginning of a headline, use the same level or the inserted
tree.
* org-publish.el (org-publish-get-base-files-1): Deal correctly
with broken symlinks
2008-11-12 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-select-tags, org-get-current-options):
Fix typo.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Wed, 12 Nov 2008 08:01:06 +0000 |
parents | 54b3c5554f6f |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
1 ;; dos-w32.el --- Functions shared among MS-DOS and W32 (NT/95) platforms |
16026 | 2 |
74439 | 3 ;; Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005, |
79721 | 4 ;; 2006, 2007, 2008 Free Software Foundation, Inc. |
16026 | 5 |
21059 | 6 ;; Maintainer: Geoff Voelker <voelker@cs.washington.edu> |
16026 | 7 ;; Keywords: internal |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
16026 | 12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
16026 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
16026 | 23 |
24 ;;; Commentary: | |
25 | |
26 ;; Parts of this code are duplicated functions taken from dos-fns.el | |
27 ;; and winnt.el. | |
28 | |
29 ;;; Code: | |
30 | |
31 ;; Use ";" instead of ":" as a path separator (from files.el). | |
32 (setq path-separator ";") | |
33 | |
22256
9f422336200e
(minibuffer-history-case-insensitive-variables):
Richard M. Stallman <rms@gnu.org>
parents:
21567
diff
changeset
|
34 (setq minibuffer-history-case-insensitive-variables |
9f422336200e
(minibuffer-history-case-insensitive-variables):
Richard M. Stallman <rms@gnu.org>
parents:
21567
diff
changeset
|
35 (cons 'file-name-history minibuffer-history-case-insensitive-variables)) |
9f422336200e
(minibuffer-history-case-insensitive-variables):
Richard M. Stallman <rms@gnu.org>
parents:
21567
diff
changeset
|
36 |
16026 | 37 ;; Set the null device (for compile.el). |
22607
3c91c17a1a0f
(null-device): Renamed from grep-null-device.
Andrew Innes <andrewi@gnu.org>
parents:
22256
diff
changeset
|
38 (setq null-device "NUL") |
16026 | 39 |
40 ;; For distinguishing file types based upon suffixes. | |
41 (defvar file-name-buffer-file-type-alist | |
42 '( | |
43 ("[:/].*config.sys$" . nil) ; config.sys text | |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
44 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|bin\\|ico\\|pif\\|class\\)$" . t) |
16026 | 45 ; MS-Dos stuff |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
46 ("\\.\\(dll\\|drv\\|386\\|vxd\\|fon\\|fnt\\|fot\\|ttf\\|grp\\)$" . t) |
19690
ceed5706d45e
(file-name-buffer-file-type-alist): Add more
Geoff Voelker <voelker@cs.washington.edu>
parents:
19656
diff
changeset
|
47 ; Windows stuff |
26798
89a8ac5aa753
(file-name-buffer-file-type-alist): Add `$' at end of
Gerd Moellmann <gerd@gnu.org>
parents:
25482
diff
changeset
|
48 ("\\.\\(bmp\\|wav\\|avi\\|mpg\\|jpg\\|tif\\|mov\\|au\\)$" . t) |
19690
ceed5706d45e
(file-name-buffer-file-type-alist): Add more
Geoff Voelker <voelker@cs.washington.edu>
parents:
19656
diff
changeset
|
49 ; known binary data files |
16026 | 50 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) |
51 ; Packers | |
19690
ceed5706d45e
(file-name-buffer-file-type-alist): Add more
Geoff Voelker <voelker@cs.washington.edu>
parents:
19656
diff
changeset
|
52 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\|jar\\)$" . t) |
16026 | 53 ; Unix stuff |
46300 | 54 ("\\.sx[dmicw]$" . t) ; OpenOffice.org |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
55 ("\\.tp[ulpw]$" . t) ; borland Pascal stuff |
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
56 ("[:/]tags$" . nil) ; emacs TAGS file |
16026 | 57 ) |
58 "*Alist for distinguishing text files from binary files. | |
59 Each element has the form (REGEXP . TYPE), where REGEXP is matched | |
60 against the file name, and TYPE is nil for text, t for binary.") | |
61 | |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
62 ;; Return the pair matching filename on file-name-buffer-file-type-alist, |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
63 ;; or nil otherwise. |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
64 (defun find-buffer-file-type-match (filename) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
65 (let ((alist file-name-buffer-file-type-alist) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
66 (found nil)) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
67 (let ((case-fold-search t)) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
68 (setq filename (file-name-sans-versions filename)) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
69 (while (and (not found) alist) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
70 (if (string-match (car (car alist)) filename) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
71 (setq found (car alist))) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
72 (setq alist (cdr alist))) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
73 found))) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
74 |
77105
58ccc73db59e
(default-buffer-file-type): Add defvar to quieten byte-compiler.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
75 ;; Silence compiler. Defined in src/buffer.c on DOS_NT. |
58ccc73db59e
(default-buffer-file-type): Add defvar to quieten byte-compiler.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
76 (defvar default-buffer-file-type) |
58ccc73db59e
(default-buffer-file-type): Add defvar to quieten byte-compiler.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
77 |
19656
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
78 ;; Don't check for untranslated file systems here. |
16026 | 79 (defun find-buffer-file-type (filename) |
19656
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
80 (let ((match (find-buffer-file-type-match filename)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
81 (code)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
82 (if (not match) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
83 default-buffer-file-type |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
84 (setq code (cdr match)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
85 (cond ((memq code '(nil t)) code) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
86 ((and (symbolp code) (fboundp code)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
87 (funcall code filename)))))) |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
88 |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
89 (setq-default buffer-file-coding-system 'undecided-dos) |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
90 |
18912
d6d9a466fad2
(find-buffer-file-type-coding-system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
18872
diff
changeset
|
91 (defun find-buffer-file-type-coding-system (command) |
72052
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
92 "Choose a coding system for a file operation in COMMAND. |
77775
52935906feab
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
77105
diff
changeset
|
93 COMMAND is a list that specifies the operation, an I/O primitive, as its |
72052
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
94 CAR, and the arguments that might be given to that operation as its CDR. |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
95 If operation is `insert-file-contents', the coding system is chosen based |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
96 upon the filename (the CAR of the arguments beyond the operation), the contents |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
97 of `untranslated-filesystem-list' and `file-name-buffer-file-type-alist', |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
98 and whether the file exists: |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
99 |
18872
8c7bcffd7327
(find-buffer-file-type-coding-system):
Geoff Voelker <voelker@cs.washington.edu>
parents:
18863
diff
changeset
|
100 If it matches in `untranslated-filesystem-list': |
34110
a47622945cee
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
32983
diff
changeset
|
101 If the file exists: `undecided' |
a47622945cee
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
32983
diff
changeset
|
102 If the file does not exist: `undecided-unix' |
18872
8c7bcffd7327
(find-buffer-file-type-coding-system):
Geoff Voelker <voelker@cs.washington.edu>
parents:
18863
diff
changeset
|
103 If it matches in `file-name-buffer-file-type-alist': |
8c7bcffd7327
(find-buffer-file-type-coding-system):
Geoff Voelker <voelker@cs.washington.edu>
parents:
18863
diff
changeset
|
104 If the match is t (for binary): `no-conversion' |
8c7bcffd7327
(find-buffer-file-type-coding-system):
Geoff Voelker <voelker@cs.washington.edu>
parents:
18863
diff
changeset
|
105 If the match is nil (for dos-text): `undecided-dos' |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
106 Otherwise: |
18872
8c7bcffd7327
(find-buffer-file-type-coding-system):
Geoff Voelker <voelker@cs.washington.edu>
parents:
18863
diff
changeset
|
107 If the file exists: `undecided' |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
108 If the file does not exist: default-buffer-file-coding-system |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
109 |
77775
52935906feab
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
77105
diff
changeset
|
110 Note that the CAR of arguments to `insert-file-contents' operation could |
52935906feab
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
77105
diff
changeset
|
111 be a cons cell of the form \(FILENAME . BUFFER\), where BUFFER is a buffer |
52935906feab
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
77105
diff
changeset
|
112 into which the file's contents were already read, but not yet decoded. |
52935906feab
(find-buffer-file-type-coding-system): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
77105
diff
changeset
|
113 |
72052
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
114 If operation is `write-region', the coding system is chosen based upon |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
115 the value of `buffer-file-coding-system' and `buffer-file-type'. If |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
116 `buffer-file-coding-system' is non-nil, its value is used. If it is |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
117 nil and `buffer-file-type' is t, the coding system is `no-conversion'. |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
118 Otherwise, it is `undecided-dos'. |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
119 |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
120 The two most common situations are when DOS and Unix files are read |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
121 and written, and their names do not match in |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
122 `untranslated-filesystem-list' and `file-name-buffer-file-type-alist'. |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
123 In these cases, the coding system initially will be `undecided'. As |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
124 the file is read in the DOS case, the coding system will be changed to |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
125 `undecided-dos' as CR/LFs are detected. As the file is read in the |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
126 Unix case, the coding system will be changed to `undecided-unix' as |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
127 LFs are detected. In both cases, `buffer-file-coding-system' will be |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
128 set to the appropriate coding system, and the value of |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
129 `buffer-file-coding-system' will be used when writing the file." |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
130 |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
131 (let ((op (nth 0 command)) |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
132 (target) |
18863
62090ffa4583
(find-buffer-file-type-coding-system):
Richard M. Stallman <rms@gnu.org>
parents:
18858
diff
changeset
|
133 (binary nil) (text nil) |
19656
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
134 (undecided nil) (undecided-unix nil)) |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
135 (cond ((eq op 'insert-file-contents) |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
136 (setq target (nth 1 command)) |
72052
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
137 ;; If TARGET is a cons cell, it has the form (FILENAME . BUFFER), |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
138 ;; where BUFFER is a buffer into which the file was already read, |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
139 ;; but its contents were not yet decoded. (This form of the |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
140 ;; arguments is used, e.g., in arc-mode.el.) This function |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
141 ;; doesn't care about the contents, it only looks at the file's |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
142 ;; name, which is the CAR of the cons cell. |
d317c5ea9079
(find-buffer-file-type-coding-system): Support calls where `(nth 1 command)'
Eli Zaretskii <eliz@gnu.org>
parents:
71428
diff
changeset
|
143 (if (consp target) (setq target (car target))) |
19656
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
144 ;; First check for a file name that indicates |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
145 ;; it is truly binary. |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
146 (setq binary (find-buffer-file-type target)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
147 (cond (binary) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
148 ;; Next check for files that MUST use DOS eol conversion. |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
149 ((find-buffer-file-type-match target) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
150 (setq text t)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
151 ;; For any other existing file, decide based on contents. |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
152 ((file-exists-p target) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
153 (setq undecided t)) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
154 ;; Next check for a non-DOS file system. |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
155 ((untranslated-file-p target) |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
156 (setq undecided-unix t))) |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
157 (cond (binary '(no-conversion . no-conversion)) |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
158 (text '(undecided-dos . undecided-dos)) |
19656
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
159 (undecided-unix '(undecided-unix . undecided-unix)) |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
160 (undecided '(undecided . undecided)) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
161 (t (cons default-buffer-file-coding-system |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
162 default-buffer-file-coding-system)))) |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
163 ((eq op 'write-region) |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
164 (if buffer-file-coding-system |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
165 (cons buffer-file-coding-system |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
166 buffer-file-coding-system) |
19656
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
167 ;; Normally this is used only in a non-file-visiting |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
168 ;; buffer, because normally buffer-file-coding-system is non-nil |
98e7893f8679
(find-buffer-file-type): Don't check for untranslated file systems here.
Richard M. Stallman <rms@gnu.org>
parents:
19400
diff
changeset
|
169 ;; in a file-visiting buffer. |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
170 (if buffer-file-type |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
171 '(no-conversion . no-conversion) |
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
172 '(undecided-dos . undecided-dos))))))) |
18858
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
173 |
ad717015a2de
(find-buffer-file-type-coding-system)
Richard M. Stallman <rms@gnu.org>
parents:
17901
diff
changeset
|
174 (modify-coding-system-alist 'file "" 'find-buffer-file-type-coding-system) |
16026 | 175 |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
176 (defun find-file-binary (filename) |
16026 | 177 "Visit file FILENAME and treat it as binary." |
178 (interactive "FFind file binary: ") | |
179 (let ((file-name-buffer-file-type-alist '(("" . t)))) | |
180 (find-file filename))) | |
181 | |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
182 (defun find-file-text (filename) |
16026 | 183 "Visit file FILENAME and treat it as a text file." |
184 (interactive "FFind file text: ") | |
185 (let ((file-name-buffer-file-type-alist '(("" . nil)))) | |
186 (find-file filename))) | |
187 | |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
188 (defun find-file-not-found-set-buffer-file-coding-system () |
16026 | 189 (save-excursion |
190 (set-buffer (current-buffer)) | |
32983
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
191 (let ((coding buffer-file-coding-system)) |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
192 ;; buffer-file-coding-system is already set by |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
193 ;; find-operation-coding-system, which was called from |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
194 ;; insert-file-contents. All that's left is to change |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
195 ;; the EOL conversion, if required by the user. |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
196 (when (and (null coding-system-for-read) |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
197 (or inhibit-eol-conversion |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
198 (untranslated-file-p (buffer-file-name)))) |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
199 (setq coding (coding-system-change-eol-conversion coding 0)) |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
200 (setq buffer-file-coding-system coding)) |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
201 (setq buffer-file-type (eq buffer-file-coding-system 'no-conversion))))) |
16026 | 202 |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
203 ;;; To set the default coding system on new files. |
71428
4dc3f74ad23f
(top level): Use find-file-not-found-functions instead of the obsolete
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
204 (add-hook 'find-file-not-found-functions |
19400
95183e63d1dd
Set default coding system to undecided-dos.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18912
diff
changeset
|
205 'find-file-not-found-set-buffer-file-coding-system) |
16026 | 206 |
95241 | 207 ;;; To accommodate filesystems that do not require CR/LF translation. |
16026 | 208 (defvar untranslated-filesystem-list nil |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
209 "List of filesystems that require no CR/LF translation when reading |
16026 | 210 and writing files. Each filesystem in the list is a string naming |
211 the directory prefix corresponding to the filesystem.") | |
212 | |
213 (defun untranslated-canonical-name (filename) | |
214 "Return FILENAME in a canonicalized form for use with the functions | |
215 dealing with untranslated filesystems." | |
49549
99be3a1e2589
Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents:
46300
diff
changeset
|
216 (if (memq system-type '(ms-dos windows-nt cygwin)) |
16889
8de32e992e4d
Change uses of win32 to w32.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16591
diff
changeset
|
217 ;; The canonical form for DOS/W32 is with A-Z downcased and all |
16026 | 218 ;; directory separators changed to directory-sep-char. |
219 (let ((name nil)) | |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
220 (setq name (mapconcat |
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
221 '(lambda (char) |
16026 | 222 (if (and (<= ?A char) (<= char ?Z)) |
223 (char-to-string (+ (- char ?A) ?a)) | |
224 (char-to-string char))) | |
225 filename nil)) | |
226 ;; Use expand-file-name to canonicalize directory separators, except | |
227 ;; with bare drive letters (which would have the cwd appended). | |
24913
76764b2157af
(untranslated-canonical-name): Avoid expanding
Andrew Innes <andrewi@gnu.org>
parents:
24658
diff
changeset
|
228 ;; Avoid expanding names that could trigger ange-ftp to prompt |
76764b2157af
(untranslated-canonical-name): Avoid expanding
Andrew Innes <andrewi@gnu.org>
parents:
24658
diff
changeset
|
229 ;; for passwords, though. |
76764b2157af
(untranslated-canonical-name): Avoid expanding
Andrew Innes <andrewi@gnu.org>
parents:
24658
diff
changeset
|
230 (if (or (string-match "^.:$" name) |
76764b2157af
(untranslated-canonical-name): Avoid expanding
Andrew Innes <andrewi@gnu.org>
parents:
24658
diff
changeset
|
231 (string-match "^/[^/:]+:" name)) |
16026 | 232 name |
233 (expand-file-name name))) | |
234 filename)) | |
235 | |
236 (defun untranslated-file-p (filename) | |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
237 "Return t if FILENAME is on a filesystem that does not require |
16026 | 238 CR/LF translation, and nil otherwise." |
239 (let ((fs (untranslated-canonical-name filename)) | |
240 (ufs-list untranslated-filesystem-list) | |
241 (found nil)) | |
242 (while (and (not found) ufs-list) | |
243 (if (string-match (concat "^" (car ufs-list)) fs) | |
244 (setq found t) | |
245 (setq ufs-list (cdr ufs-list)))) | |
246 found)) | |
247 | |
248 (defun add-untranslated-filesystem (filesystem) | |
249 "Add FILESYSTEM to the list of filesystems that do not require | |
250 CR/LF translation. FILESYSTEM is a string containing the directory | |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
251 prefix corresponding to the filesystem. For example, for a Unix |
16026 | 252 filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." |
32983
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
253 ;; We use "D", not "f", to avoid confusing the user: "f" prompts |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
254 ;; with a directory, but RET returns the current buffer's file, not |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
255 ;; its directory. |
a7eb5c4fe0ba
(find-file-not-found-set-buffer-file-coding-system):
Eli Zaretskii <eliz@gnu.org>
parents:
26798
diff
changeset
|
256 (interactive "DUntranslated file system: ") |
16026 | 257 (let ((fs (untranslated-canonical-name filesystem))) |
258 (if (member fs untranslated-filesystem-list) | |
259 untranslated-filesystem-list | |
260 (setq untranslated-filesystem-list | |
261 (cons fs untranslated-filesystem-list))))) | |
262 | |
263 (defun remove-untranslated-filesystem (filesystem) | |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
264 "Remove FILESYSTEM from the list of filesystems that do not require |
16026 | 265 CR/LF translation. FILESYSTEM is a string containing the directory |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
266 prefix corresponding to the filesystem. For example, for a Unix |
16026 | 267 filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." |
17901
6ea4d90cc76b
(add-untranslated-filesystem)
Richard M. Stallman <rms@gnu.org>
parents:
16889
diff
changeset
|
268 (interactive "fUntranslated file system: ") |
46188
7864bcf48126
(file-name-buffer-file-type-alist): Add knowledge of .sx[dmicw] file
Francesco Potortì <pot@gnu.org>
parents:
38001
diff
changeset
|
269 (setq untranslated-filesystem-list |
16026 | 270 (delete (untranslated-canonical-name filesystem) |
271 untranslated-filesystem-list))) | |
272 | |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
273 ;;; Support for printing under DOS/Windows, see lpr.el and ps-print.el. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
274 |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
275 (defvar direct-print-region-use-command-dot-com t |
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
276 "*Control whether command.com is used to print on Windows 9x.") |
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
277 |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
278 ;; Function to actually send data to the printer port. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
279 ;; Supports writing directly, and using various programs. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
280 (defun direct-print-region-helper (printer |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
281 start end |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
282 lpr-prog |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
283 delete-text buf display |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
284 rest) |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
285 (let* (;; Ignore case when matching known external program names. |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
286 (case-fold-search t) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
287 ;; Convert / to \ in printer name, for sake of external programs. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
288 (printer |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
289 (if (stringp printer) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
290 (subst-char-in-string ?/ ?\\ printer) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
291 printer)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
292 ;; Find a directory that is local, to work-around Windows bug. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
293 (safe-dir |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
294 (let ((safe-dirs (list "c:/" (getenv "windir") (getenv "TMPDIR")))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
295 (while (not (file-attributes (car safe-dirs))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
296 (setq safe-dirs (cdr safe-dirs))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
297 (car safe-dirs))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
298 (tempfile |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
299 (subst-char-in-string |
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
300 ?/ ?\\ |
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
301 (make-temp-name |
25482
f1d437596538
(direct-print-region-helper): Use temporary-file-directory.
Eli Zaretskii <eliz@gnu.org>
parents:
24913
diff
changeset
|
302 (expand-file-name "EP" temporary-file-directory)))) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
303 ;; capture output for diagnosis |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
304 (errbuf (list (get-buffer-create " *print-region-helper*") t))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
305 ;; It seems that we must be careful about the directory name that |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
306 ;; gets added to the printer port name by write-region when using |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
307 ;; the standard "PRN" or "LPTx" ports, because the write can fail if |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
308 ;; the directory is on a network drive. The same is true when |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
309 ;; asking command.com to copy the file. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
310 ;; No action is needed for UNC printer names, which is just as well |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
311 ;; because `expand-file-name' doesn't support UNC names on MS-DOS. |
24213
3c29f6165eca
(direct-print-region-helper): Check for printer
Geoff Voelker <voelker@cs.washington.edu>
parents:
24092
diff
changeset
|
312 (if (and (stringp printer) (not (string-match "^\\\\" printer))) |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
313 (setq printer |
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
314 (subst-char-in-string ?/ ?\\ (expand-file-name printer safe-dir)))) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
315 ;; Handle known programs specially where necessary. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
316 (unwind-protect |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
317 (cond |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
318 ;; nprint.exe is the standard print command on Netware |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
319 ((string-match "^nprint\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
320 (write-region start end tempfile nil 0) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
321 (call-process lpr-prog nil errbuf nil |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
322 tempfile (concat "P=" printer))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
323 ;; print.exe is a standard command on NT |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
324 ((string-match "^print\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
325 ;; Be careful not to invoke print.exe on MS-DOS or Windows 9x |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
326 ;; though, because it is a TSR program there (hangs Emacs). |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
327 (or (and (eq system-type 'windows-nt) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
328 (null (getenv "winbootdir"))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
329 (error "Printing via print.exe is not supported on MS-DOS or Windows 9x")) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
330 ;; It seems that print.exe always appends a form-feed so we |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
331 ;; should make sure to omit the last FF in the data. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
332 (if (and (> end start) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
333 (char-equal (char-before end) ?\C-l)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
334 (setq end (1- end))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
335 ;; cancel out annotate function for non-PS case |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
336 (let ((write-region-annotate-functions nil)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
337 (write-region start end tempfile nil 0)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
338 (call-process lpr-prog nil errbuf nil |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
339 (concat "/D:" printer) tempfile)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
340 ;; support lpr and similar programs for convenience, but |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
341 ;; supply an explicit filename because the NT version of lpr |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
342 ;; can't read from stdin. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
343 ((> (length lpr-prog) 0) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
344 (write-region start end tempfile nil 0) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
345 (setq rest (append rest (list tempfile))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
346 (apply 'call-process lpr-prog nil errbuf nil rest)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
347 ;; Run command.com to access printer port on Windows 9x, unless |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
348 ;; we are supposed to append to an existing (non-empty) file, |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
349 ;; to work around a bug in Windows 9x that prevents Win32 |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
350 ;; programs from accessing LPT ports reliably. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
351 ((and (eq system-type 'windows-nt) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
352 (getenv "winbootdir") |
24658
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
353 ;; Allow cop-out so command.com isn't invoked |
7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
Andrew Innes <andrewi@gnu.org>
parents:
24515
diff
changeset
|
354 direct-print-region-use-command-dot-com |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
355 ;; file-attributes fails on LPT ports on Windows 9x but |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
356 ;; not on NT, so handle both cases for safety. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
357 (eq (or (nth 7 (file-attributes printer)) 0) 0)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
358 (write-region start end tempfile nil 0) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
359 (let ((w32-quote-process-args nil)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
360 (call-process "command.com" nil errbuf nil "/c" |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
361 (format "copy /b %s %s" tempfile printer)))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
362 ;; write directly to the printer port |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
363 (t |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
364 (write-region start end printer t 0))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
365 ;; ensure we remove the tempfile if created |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
366 (if (file-exists-p tempfile) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
367 (delete-file tempfile))))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
368 |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
369 (defvar printer-name) |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
370 |
86289
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86277
diff
changeset
|
371 (declare-function default-printer-name "w32fns.c") |
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86277
diff
changeset
|
372 |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
373 (defun direct-print-region-function (start end |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
374 &optional lpr-prog |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
375 delete-text buf display |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
376 &rest rest) |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
377 "DOS/Windows-specific function to print the region on a printer. |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
378 Writes the region to the device or file which is a value of |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
379 `printer-name' \(which see\), unless the value of `lpr-command' |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
380 indicates a specific program should be invoked." |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
381 |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
382 ;; DOS printers need the lines to end with CR-LF pairs, so make |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
383 ;; sure it always happens that way, unless the buffer is binary. |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
384 (let* ((coding coding-system-for-write) |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
385 (coding-base |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
386 (if (null coding) 'undecided (coding-system-base coding))) |
23802
4052a2875390
(direct-print-region-function): Try to ensure that
Geoff Voelker <voelker@cs.washington.edu>
parents:
23682
diff
changeset
|
387 (eol-type (coding-system-eol-type coding-base)) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
388 ;; Make each print-out eject the final page, but don't waste |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
389 ;; paper if the file ends with a form-feed already. |
23802
4052a2875390
(direct-print-region-function): Try to ensure that
Geoff Voelker <voelker@cs.washington.edu>
parents:
23682
diff
changeset
|
390 (write-region-annotate-functions |
4052a2875390
(direct-print-region-function): Try to ensure that
Geoff Voelker <voelker@cs.washington.edu>
parents:
23682
diff
changeset
|
391 (cons |
4052a2875390
(direct-print-region-function): Try to ensure that
Geoff Voelker <voelker@cs.washington.edu>
parents:
23682
diff
changeset
|
392 (lambda (start end) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
393 (if (not (char-equal (char-before end) ?\C-l)) |
23802
4052a2875390
(direct-print-region-function): Try to ensure that
Geoff Voelker <voelker@cs.washington.edu>
parents:
23682
diff
changeset
|
394 `((,end . "\f")))) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
395 write-region-annotate-functions)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
396 (printer (or (and (boundp 'dos-printer) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
397 (stringp (symbol-value 'dos-printer)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
398 (symbol-value 'dos-printer)) |
53740
19655fe347ec
Added support for the `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
399 printer-name |
19655fe347ec
Added support for the `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
400 (default-printer-name)))) |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
401 (or (eq coding-system-for-write 'no-conversion) |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
402 (setq coding-system-for-write |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
403 (aref eol-type 1))) ; force conversion to DOS EOLs |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
404 (direct-print-region-helper printer start end lpr-prog |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
405 delete-text buf display rest))) |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
406 |
85512
589532be95ec
* w32-fns.el (w32-quote-process-args):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
407 (defvar print-region-function) |
589532be95ec
* w32-fns.el (w32-quote-process-args):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
408 (defvar lpr-headers-switches) |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
409 (setq print-region-function 'direct-print-region-function) |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
410 |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
411 ;; Set this to nil if you have a port of the `pr' program |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
412 ;; (e.g., from GNU Textutils), or if you have an `lpr' |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
413 ;; program (see above) that can print page headers. |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
414 ;; If `lpr-headers-switches' is non-nil (the default) and |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
415 ;; `print-region-function' is set to `dos-print-region-function', |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
416 ;; then requests to print page headers will be silently |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
417 ;; ignored, and `print-buffer' and `print-region' produce |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
418 ;; the same output as `lpr-buffer' and `lpr-region', accordingly. |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
419 (setq lpr-headers-switches "(page headers are not supported)") |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
420 |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
421 (defvar ps-printer-name) |
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
422 |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
423 (defun direct-ps-print-region-function (start end |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
424 &optional lpr-prog |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
425 delete-text buf display |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
426 &rest rest) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
427 "DOS/Windows-specific function to print the region on a PostScript printer. |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
428 Writes the region to the device or file which is a value of |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
429 `ps-printer-name' \(which see\), unless the value of `ps-lpr-command' |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
430 indicates a specific program should be invoked." |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
431 |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
432 (let ((printer (or (and (boundp 'dos-ps-printer) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
433 (stringp (symbol-value 'dos-ps-printer)) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
434 (symbol-value 'dos-ps-printer)) |
53740
19655fe347ec
Added support for the `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
435 ps-printer-name |
19655fe347ec
Added support for the `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
436 (default-printer-name)))) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
437 (direct-print-region-helper printer start end lpr-prog |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
438 delete-text buf display rest))) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
439 |
85512
589532be95ec
* w32-fns.el (w32-quote-process-args):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
440 (defvar ps-print-region-function) |
24092
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
441 (setq ps-print-region-function 'direct-ps-print-region-function) |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
442 |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
443 ;(setq ps-lpr-command "gs") |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
444 |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
445 ;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60" |
d98712ec1252
(find-buffer-file-type-coding-system): Use
Andrew Innes <andrewi@gnu.org>
parents:
23802
diff
changeset
|
446 ; "-sOutputFile=LPT1")) |
22678
e3fe83134880
(direct-print-region-function): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
22607
diff
changeset
|
447 |
16591
afb15f49a0c9
Use new file name dos-w32.el
Geoff Voelker <voelker@cs.washington.edu>
parents:
16234
diff
changeset
|
448 (provide 'dos-w32) |
16026 | 449 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
450 ;; arch-tag: dcfefdd2-362f-4fbc-9141-9634f5f4d6a7 |
16591
afb15f49a0c9
Use new file name dos-w32.el
Geoff Voelker <voelker@cs.washington.edu>
parents:
16234
diff
changeset
|
451 ;;; dos-w32.el ends here |