mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
739e3dbe05
* lisp/allout.el (allout-abbreviate-flattened-numbering) (allout-mode-deactivate-hook): * lisp/ansi-color.el (ansi-color-unfontify-region): * lisp/auth-source.el (auth-source-hide-passwords) (auth-source-user-or-password) (auth-source-forget-user-or-password): * lisp/cedet/data-debug.el (data-debug-map): * lisp/cedet/semantic/grammar.el (semantic-grammar-syntax-table) (semantic-grammar-map): * lisp/chistory.el (command-history-map): * lisp/comint.el (comint-dynamic-complete) (comint-dynamic-complete-as-filename) (comint-dynamic-simple-complete): * lisp/dired-x.el (read-filename-at-point) (dired-x-submit-report): * lisp/dos-fns.el (register-name-alist, make-register) (register-value, set-register-value, intdos, mode25, mode4350): * lisp/emacs-lisp/bytecomp.el (byte-compile-disable-print-circle): * lisp/emacs-lisp/chart.el (chart-map): * lisp/emacs-lisp/package.el (package-menu-view-commentary): * lisp/emacs-lock.el (toggle-emacs-lock, emacs-lock-from-exiting): * lisp/erc/erc.el (erc-complete-word): * lisp/eshell/em-cmpl.el (eshell-cmpl-suffix-list): * lisp/eshell/esh-util.el (eshell-for): * lisp/files.el (inhibit-first-line-modes-regexps) (inhibit-first-line-modes-suffixes): * lisp/gnus/gnus-msg.el (gnus-outgoing-message-group) (gnus-debug-files, gnus-debug-exclude-variables): * lisp/gnus/gnus-registry.el (gnus-registry-user-format-function-M): * lisp/gnus/gnus.el (gnus-local-domain, gnus-carpal): * lisp/gnus/nnimap.el (nnimap-split-rule): * lisp/iimage.el (turn-on-iimage-mode): * lisp/image.el (image-extension-data, image-library-alist): * lisp/mail/emacsbug.el (report-emacs-bug-pretest-address): * lisp/mail/mail-utils.el (rmail-dont-reply-to): * lisp/mail/mailalias.el (mail-complete-function) (mail-completion-at-point-function): * lisp/mail/rmail.el (rmail-dont-reply-to-names) (rmail-default-dont-reply-to-names): * lisp/mail/sendmail.el (mail-mailer-swallows-blank-line) (mail-sent-via): * lisp/menu-bar.el (menu-bar-kill-ring-save): * lisp/minibuffer.el (completion-annotate-function) (minibuffer-local-filename-must-match-map): * lisp/msb.el (msb-after-load-hooks): * lisp/obsolete/eieio-compat.el (eieio-defmethod) (eieio-defgeneric): * lisp/obsolete/info-edit.el (Info-edit-map): * lisp/obsolete/starttls.el (starttls-any-program-available): * lisp/progmodes/cfengine.el (cfengine-mode-abbrevs): * lisp/progmodes/cwarn.el (turn-on-cwarn-mode): * lisp/progmodes/make-mode.el (makefile-complete): * lisp/progmodes/meta-mode.el (meta-complete-symbol) (meta-mode-map): * lisp/progmodes/pascal.el (pascal-toggle-completions) (pascal-last-completions, pascal-show-completions): * lisp/progmodes/prolog.el (prolog-char-quote-workaround): * lisp/progmodes/which-func.el (which-func-mode): [FUNCTION] * lisp/simple.el (count-lines-region, minibuffer-completing-symbol): * lisp/speedbar.el (speedbar-syntax-table, speedbar-key-map): * lisp/strokes.el (strokes-report-bug): * lisp/subr.el (condition-case-no-debug): * lisp/term/ns-win.el (ns-alternatives-map) (ns-store-cut-buffer-internal): * lisp/term/w32-win.el (w32-default-color-map): * lisp/term/x-win.el (x-cut-buffer-or-selection-value): * lisp/textmodes/bibtex.el (bibtex-complete) (bibtex-entry-field-alist): * lisp/textmodes/reftex-index.el (reftex-index-map) (reftex-index-phrases-map): * lisp/textmodes/reftex-sel.el (reftex-select-label-map) (reftex-select-bib-map): * lisp/textmodes/reftex-toc.el (reftex-toc-map): * lisp/textmodes/rst.el (rst-block-face, rst-external-face) (rst-definition-face, rst-directive-face, rst-comment-face) (rst-emphasis1-face, rst-emphasis2-face, rst-literal-face) (rst-reference-face): * lisp/vc/vc-hooks.el (vc-toggle-read-only): * lisp/view.el (view-return-to-alist) (view-return-to-alist-update): Remove many functions and variables obsolete since 24.1. * lisp/textmodes/bibtex.el (bibtex-entry-alist): Don't use above removed variable 'bibtex-entry-field-alist'. * lisp/cedet/data-debug.el (data-debug-edebug-expr) (data-debug-eval-expression): * lisp/emacs-lisp/trace.el (trace--read-args): * lisp/files-x.el (read-file-local-variable-value): * lisp/simple.el (read--expression): Don't use above removed variable 'minibuffer-completing-symbol'. * lisp/textmodes/rst.el (rst-font-lock-keywords): Don't use above removed variables. * src/w32fns.c (Fw32_default_color_map): Delete obsolete function. (syms_of_w32fns): Delete defsubr for above defun. * src/keyboard.c (syms_of_keyboard) <Vdeferred_action_list> <Vdeferred_action_function>: Delete DEFVARs. <Qdeferred_action_function>: Delete DEFSYM. (syms_of_keyboard_for_pdumper): Adjust for above change. (command_loop_1): Don't run deferred-action-function hook. * lisp/subr.el (deferred-action-list, deferred-action-function): Delete obsoletion statements. * lisp/emacs-lisp/ert-x.el (ert-simulate-command): Don't run 'deferred-action-list' hook. * doc/lispref/hooks.texi (Standard Hooks): Delete 'deferred-action-function'. * lisp/emacs-lisp/lisp.el (field-complete): * lisp/eshell/em-cmpl.el (eshell-cmpl-initialize): * lisp/gnus/gnus-msg.el (gnus-inews-insert-gcc): * lisp/gnus/nnmail.el (nnmail-fancy-expiry-target): * lisp/mail/mail-utils.el (mail-dont-reply-to): * lisp/mail/sendmail.el (sendmail-send-it): * lisp/mail/smtpmail.el (smtpmail-send-it): * lisp/minibuffer.el (minibuffer-completion-help): * lisp/progmodes/python.el: Don't use above removed items. * lisp/emacs-lisp/eieio-core.el: * lisp/mail/mailalias.el (mail-complete-alist): Doc fixes; don't refer to above removed items. ; * etc/NEWS: List removed items.
299 lines
11 KiB
EmacsLisp
299 lines
11 KiB
EmacsLisp
;;; dos-fns.el --- MS-Dos specific functions -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 1991, 1993, 1995-1996, 2001-2022 Free Software
|
|
;; Foundation, Inc.
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
|
;; Keywords: internal
|
|
;; Package: emacs
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;; Part of this code is taken from (or derived from) demacs.
|
|
|
|
;;; Code:
|
|
|
|
(declare-function int86 "dosfns.c")
|
|
(declare-function msdos-long-file-names "msdos.c")
|
|
|
|
;; See convert-standard-filename in files.el.
|
|
(defun dos-convert-standard-filename (filename)
|
|
"Convert a standard file's name to something suitable for MS-DOS.
|
|
This means to guarantee valid names and perhaps to canonicalize
|
|
certain patterns.
|
|
|
|
This function is called by `convert-standard-filename'.
|
|
|
|
On Windows and DOS, replace invalid characters. On DOS, make
|
|
sure to obey the 8.3 limitations."
|
|
(if (or (not (stringp filename))
|
|
;; This catches the case where FILENAME is "x:" or "x:/" or
|
|
;; "/", thus preventing infinite recursion.
|
|
(string-match "\\`\\([a-zA-Z]:\\)?[/\\]?\\'" filename))
|
|
filename
|
|
(let ((flen (length filename)))
|
|
;; If FILENAME has a trailing slash, remove it and recurse.
|
|
(if (memq (aref filename (1- flen)) '(?/ ?\\))
|
|
(concat (dos-convert-standard-filename
|
|
(substring filename 0 (1- flen)))
|
|
"/")
|
|
(let* (;; ange-ftp gets in the way for names like "/foo:bar".
|
|
;; We need to inhibit all magic file names, because
|
|
;; remote file names should never be passed through
|
|
;; this function, as they are not meant for the local
|
|
;; filesystem!
|
|
(file-name-handler-alist nil)
|
|
(dir
|
|
;; If FILENAME is "x:foo", file-name-directory returns
|
|
;; "x:/bar/baz", substituting the current working
|
|
;; directory on drive x:. We want to be left with "x:"
|
|
;; instead.
|
|
(if (and (< 1 flen)
|
|
(eq (aref filename 1) ?:)
|
|
(null (string-match "[/\\]" filename)))
|
|
(substring filename 0 2)
|
|
(file-name-directory filename)))
|
|
(dlen-m-1 (1- (length dir)))
|
|
(string (copy-sequence (file-name-nondirectory filename)))
|
|
(lastchar (aref string (1- (length string))))
|
|
i firstdot)
|
|
(cond
|
|
((msdos-long-file-names)
|
|
;; Replace characters that are invalid even on Windows.
|
|
(while (setq i (string-match "[?*:<>|\"\000-\037]" string))
|
|
(aset string i ?!)))
|
|
((not (member string '("" "." "..")))
|
|
;; Change a leading period to a leading underscore.
|
|
(if (= (aref string 0) ?.)
|
|
(aset string 0 ?_))
|
|
;; If the name is longer than 8 chars, and doesn't have a
|
|
;; period, and we have a dash or underscore that isn't too
|
|
;; close to the beginning, change that to a period. This
|
|
;; is so we could salvage more characters of the original
|
|
;; name by pushing them into the extension.
|
|
(if (and (not (string-search "." string))
|
|
(> (length string) 8)
|
|
;; We don't gain anything if we put the period closer
|
|
;; than 5 chars from the beginning (5 + 3 = 8).
|
|
(setq i (string-match "[-_]" string 5)))
|
|
(aset string i ?\.))
|
|
;; Get rid of invalid characters.
|
|
(while (setq i (string-match
|
|
"[^-a-zA-Z0-9_.%~^$!#&{}@`'()\200-\376]"
|
|
string))
|
|
(aset string i ?_))
|
|
;; If we don't have a period in the first 8 chars, insert one.
|
|
;; This enables having 3 more characters from the original
|
|
;; name in the extension.
|
|
(if (> (or (string-search "." string) (length string))
|
|
8)
|
|
(setq string
|
|
(concat (substring string 0 8)
|
|
"."
|
|
(substring string 8))))
|
|
(setq firstdot (or (string-search "." string)
|
|
(1- (length string))))
|
|
;; Truncate to 3 chars after the first period.
|
|
(if (> (length string) (+ firstdot 4))
|
|
(setq string (substring string 0 (+ firstdot 4))))
|
|
;; Change all periods except the first one into underscores.
|
|
;; (DOS doesn't allow more than one period.)
|
|
(while (string-search "." string (1+ firstdot))
|
|
(setq i (string-search "." string (1+ firstdot)))
|
|
(aset string i ?_))
|
|
;; If the last character of the original filename was `~' or `#',
|
|
;; make sure the munged name ends with it also. This is so that
|
|
;; backup and auto-save files retain their telltale form.
|
|
(if (memq lastchar '(?~ ?#))
|
|
(aset string (1- (length string)) lastchar))))
|
|
(concat (if (and (stringp dir)
|
|
(memq (aref dir dlen-m-1) '(?/ ?\\)))
|
|
(concat (dos-convert-standard-filename
|
|
(substring dir 0 dlen-m-1))
|
|
"/")
|
|
(dos-convert-standard-filename dir))
|
|
string))))))
|
|
|
|
(defun dos-8+3-filename (filename)
|
|
"Truncate FILENAME to DOS 8+3 limits."
|
|
(if (or (not (stringp filename))
|
|
(< (length filename) 5)) ; too short to give any trouble
|
|
filename
|
|
(let ((flen (length filename)))
|
|
;; If FILENAME has a trailing slash, remove it and recurse.
|
|
(if (memq (aref filename (1- flen)) '(?/ ?\\))
|
|
(concat (dos-8+3-filename (substring filename 0 (1- flen)))
|
|
"/")
|
|
(let* (;; ange-ftp gets in the way for names like "/foo:bar".
|
|
;; We need to inhibit all magic file names, because
|
|
;; remote file names should never be passed through
|
|
;; this function, as they are not meant for the local
|
|
;; filesystem!
|
|
(file-name-handler-alist nil)
|
|
(dir
|
|
;; If FILENAME is "x:foo", file-name-directory returns
|
|
;; "x:/bar/baz", substituting the current working
|
|
;; directory on drive x:. We want to be left with "x:"
|
|
;; instead.
|
|
(if (and (< 1 flen)
|
|
(eq (aref filename 1) ?:)
|
|
(null (string-match "[/\\]" filename)))
|
|
(substring filename 0 2)
|
|
(file-name-directory filename)))
|
|
(dlen-m-1 (1- (length dir)))
|
|
(string (copy-sequence (file-name-nondirectory filename)))
|
|
(strlen (length string))
|
|
(lastchar (aref string (1- strlen)))
|
|
firstdot)
|
|
(setq firstdot (string-search "." string))
|
|
(cond
|
|
(firstdot
|
|
;; Truncate the extension to 3 characters.
|
|
(if (> strlen (+ firstdot 4))
|
|
(setq string (substring string 0 (+ firstdot 4))))
|
|
;; Truncate the basename to 8 characters.
|
|
(if (> firstdot 8)
|
|
(setq string (concat (substring string 0 8)
|
|
"."
|
|
(substring string (1+ firstdot))))))
|
|
((> strlen 8)
|
|
;; No dot; truncate file name to 8 characters.
|
|
(setq string (substring string 0 8))))
|
|
;; If the last character of the original filename was `~',
|
|
;; make sure the munged name ends with it also. This is so
|
|
;; a backup file retains its final `~'.
|
|
(if (equal lastchar ?~)
|
|
(aset string (1- (length string)) lastchar))
|
|
(concat (if (and (stringp dir)
|
|
(memq (aref dir dlen-m-1) '(?/ ?\\)))
|
|
(concat (dos-8+3-filename (substring dir 0 dlen-m-1))
|
|
"/")
|
|
;; Recurse to truncate the leading directories.
|
|
(dos-8+3-filename dir))
|
|
string))))))
|
|
|
|
;; This is for the sake of standard file names elsewhere in Emacs that
|
|
;; are defined as constant strings or via defconst, and whose
|
|
;; conversion via `dos-convert-standard-filename' does not give good
|
|
;; enough results.
|
|
(defun dosified-file-name (file-name)
|
|
"Return a variant of FILE-NAME that is valid on MS-DOS filesystems.
|
|
|
|
This function is for those rare cases where `dos-convert-standard-filename'
|
|
does not do a job that is good enough, e.g. if you need to preserve the
|
|
file-name extension. It recognizes only certain specific file names
|
|
that are used in Emacs Lisp sources; any other file name will be
|
|
returned unaltered."
|
|
(cond
|
|
;; See files.el:dir-locals-file.
|
|
((string= file-name ".dir-locals")
|
|
"_dir-locals")
|
|
(t
|
|
file-name)))
|
|
|
|
;; See dos-vars.el for defcustom.
|
|
(defvar msdos-shells)
|
|
|
|
;; Override settings chosen at startup.
|
|
(defun dos-set-default-process-coding-system ()
|
|
(setq default-process-coding-system
|
|
'(undecided-dos . undecided-dos)))
|
|
|
|
(add-hook 'before-init-hook 'dos-set-default-process-coding-system)
|
|
|
|
;; File names defined in preloaded packages can be incorrect or
|
|
;; invalid if long file names were available during dumping, but not
|
|
;; at runtime, or vice versa, and if the default file name begins with
|
|
;; a period. Their defcustom's need to be reevaluated at startup. To
|
|
;; see if the list of defcustom's below is up to date, run the command
|
|
;; "M-x apropos-value RET ~/\. RET".
|
|
(defun dos-reevaluate-defcustoms ()
|
|
;; This is not needed in Emacs 23.2 and later, as trash-directory is
|
|
;; initialized as nil. But something like this might become
|
|
;; necessary in the future, so I'm keeping it here as a reminder.
|
|
;(custom-reevaluate-setting 'trash-directory)
|
|
)
|
|
|
|
(add-hook 'before-init-hook 'dos-reevaluate-defcustoms)
|
|
|
|
(defvar dos-register-name-alist
|
|
'((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5)
|
|
(cflag . 6) (flags . 7)
|
|
(al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
|
|
(ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
|
|
|
|
(defun dos-make-register ()
|
|
(make-vector 8 0))
|
|
|
|
(defun dos-register-value (regs name)
|
|
(let ((where (cdr (assoc name dos-register-name-alist))))
|
|
(cond ((consp where)
|
|
(let ((tem (aref regs (car where))))
|
|
(if (zerop (cdr where))
|
|
(% tem 256)
|
|
(/ tem 256))))
|
|
((numberp where)
|
|
(aref regs where))
|
|
(t nil))))
|
|
|
|
(defun dos-set-register-value (regs name value)
|
|
(and (numberp value)
|
|
(>= value 0)
|
|
(let ((where (cdr (assoc name dos-register-name-alist))))
|
|
(cond ((consp where)
|
|
(let ((tem (aref regs (car where)))
|
|
(value (logand value 255)))
|
|
(aset regs
|
|
(car where)
|
|
(if (zerop (cdr where))
|
|
(logior (logand tem 65280) value)
|
|
(logior (logand tem 255) (ash value 8))))))
|
|
((numberp where)
|
|
(aset regs where (logand value 65535))))))
|
|
regs)
|
|
|
|
(defsubst dos-intdos (regs)
|
|
"Issue the DOS Int 21h with registers REGS.
|
|
|
|
REGS should be a vector produced by `dos-make-register'
|
|
and `dos-set-register-value', which see."
|
|
(int86 33 regs))
|
|
|
|
;; Backward compatibility for obsolescent functions which
|
|
;; set screen size.
|
|
|
|
(defun dos-mode25 ()
|
|
"Change the number of screen rows to 25."
|
|
(interactive)
|
|
(set-frame-size (selected-frame) 80 25))
|
|
|
|
(defun dos-mode4350 ()
|
|
"Change the number of rows to 43 or 50.
|
|
Emacs always tries to set the screen height to 50 rows first.
|
|
If this fails, it will try to set it to 43 rows, on the assumption
|
|
that your video hardware might not support 50-line mode."
|
|
(interactive)
|
|
(set-frame-size (selected-frame) 80 50)
|
|
(if (eq (frame-height (selected-frame)) 50)
|
|
nil ; the original built-in function returned nil
|
|
(set-frame-size (selected-frame) 80 43)))
|
|
|
|
(provide 'dos-fns)
|
|
|
|
;;; dos-fns.el ends here
|