If the file does not exist default value of `buffer-file-coding-system'
Note that the CAR of arguments to `insert-file-contents' operation could
-be a cons cell of the form \(FILENAME . BUFFER\), where BUFFER is a buffer
+be a cons cell of the form (FILENAME . BUFFER), where BUFFER is a buffer
into which the file's contents were already read, but not yet decoded.
If operation is `write-region', the coding system is chosen based
;; with bare drive letters (which would have the cwd appended).
;; Avoid expanding names that could trigger ange-ftp to prompt
;; for passwords, though.
- (if (or (string-match "^.:$" name)
- (string-match "^/[^/:]+:" name))
+ (if (or (string-match-p "^.:$" name)
+ (string-match-p "^/[^/:]+:" name))
name
(expand-file-name name)))
filename))
(ufs-list untranslated-filesystem-list)
(found nil))
(while (and (not found) ufs-list)
- (if (string-match (concat "^" (car ufs-list)) fs)
+ (if (string-match-p (concat "^" (car ufs-list)) fs)
(setq found t)
(setq ufs-list (cdr ufs-list))))
found))
;; Function to actually send data to the printer port.
;; Supports writing directly, and using various programs.
(defun direct-print-region-helper (printer
- start end
- lpr-prog
- _delete-text _buf _display
- rest)
+ start end
+ lpr-prog
+ _delete-text _buf _display
+ rest)
(let* (;; Ignore case when matching known external program names.
(case-fold-search t)
;; Convert / to \ in printer name, for sake of external programs.
;; 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.
- (if (and (stringp printer) (not (string-match "^\\\\" printer)))
+ (if (and (stringp printer) (not (string-match-p "^\\\\" printer)))
(setq printer
(subst-char-in-string ?/ ?\\ (expand-file-name printer safe-dir))))
;; Handle known programs specially where necessary.
(unwind-protect
(cond
;; nprint.exe is the standard print command on Netware
- ((string-match "^nprint\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog))
+ ((string-match-p "\\`nprint\\(\\.exe\\)?\\'"
+ (file-name-nondirectory lpr-prog))
(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
- ((string-match "^print\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog))
+ ((string-match-p "\\`print\\(\\.exe\\)?\\'"
+ (file-name-nondirectory lpr-prog))
;; 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)
&rest rest)
"DOS/Windows-specific function to print the region on a printer.
Writes the region to the device or file which is a value of
-`printer-name' \(which see\), unless the value of `lpr-command'
+`printer-name' (which see), unless the value of `lpr-command'
indicates a specific program should be invoked."
;; DOS printers need the lines to end with CR-LF pairs, so make
(write-region-annotate-functions
(cons
(lambda (_start end)
- (if (not (char-equal (char-before end) ?\C-l))
+ (if (not (char-equal (char-before end) ?\f))
`((,end . "\f"))))
write-region-annotate-functions))
(printer (or (and (boundp 'dos-printer)
(direct-print-region-helper printer start end lpr-prog
delete-text buf display rest)))
-(defvar print-region-function)
(defvar lpr-headers-switches)
-(setq print-region-function 'direct-print-region-function)
;; Set this to nil if you have a port of the `pr' program
;; (e.g., from GNU Textutils), or if you have an `lpr'
&rest rest)
"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
-`ps-printer-name' \(which see\), unless the value of `ps-lpr-command'
+`ps-printer-name' (which see), unless the value of `ps-lpr-command'
indicates a specific program should be invoked."
(let ((printer (or (and (boundp 'dos-ps-printer)
(direct-print-region-helper printer start end lpr-prog
delete-text buf display rest)))
-(defvar ps-print-region-function)
-(setq ps-print-region-function 'direct-ps-print-region-function)
-
;(setq ps-lpr-command "gs")
;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60"