diff options
Diffstat (limited to 'lisp/subr.el')
| -rw-r--r-- | lisp/subr.el | 133 |
1 files changed, 2 insertions, 131 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 0267366f1a8..4df9c9a2a6c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -29,16 +29,6 @@ ;; Beware: while this file has tag `utf-8', before it's compiled, it gets ;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap. -(defvar custom-declare-variable-list nil - "Record `defcustom' calls made before `custom.el' is loaded to handle them. -Each element of this list holds the arguments to one call to `defcustom'.") - -;; Use this, rather than defcustom, in subr.el and other files loaded -;; before custom.el. -(defun custom-declare-variable-early (&rest arguments) - (setq custom-declare-variable-list - (cons arguments custom-declare-variable-list))) - (defmacro declare-function (_fn _file &optional _arglist _fileonly) "Tell the byte-compiler that function FN is defined, in FILE. Optional ARGLIST is the argument list used by the function. @@ -302,8 +292,7 @@ In Emacs, the convention is that error messages start with a capital letter but *do not* end with a period. Please follow this convention for the sake of consistency." (declare (advertised-calling-convention (string &rest args) "23.1")) - (while t - (signal 'error (list (apply 'format args))))) + (signal 'error (list (apply 'format args)))) (defun user-error (format &rest args) "Signal a pilot error, making error message by passing all args to `format'. @@ -313,8 +302,7 @@ for the sake of consistency. This is just like `error' except that `user-error's are expected to be the result of an incorrect manipulation on the part of the user, rather than the result of an actual problem." - (while t - (signal 'user-error (list (apply #'format format args))))) + (signal 'user-error (list (apply #'format format args)))) (defun define-error (name message &optional parent) "Define NAME as a new error signal. @@ -1943,17 +1931,6 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'." ;;;; Input and display facilities. -(defvar read-quoted-char-radix 8 - "Radix for \\[quoted-insert] and other uses of `read-quoted-char'. -Legitimate radix values are 8, 10 and 16.") - -(custom-declare-variable-early - 'read-quoted-char-radix 8 - "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. -Legitimate radix values are 8, 10 and 16." - :type '(choice (const 8) (const 10) (const 16)) - :group 'editing-basics) - (defconst read-key-empty-map (make-sparse-keymap)) (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully. @@ -2009,61 +1986,6 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." (cancel-timer timer) (use-global-map old-global-map)))) -(defun read-quoted-char (&optional prompt) - "Like `read-char', but do not allow quitting. -Also, if the first character read is an octal digit, -we read any number of octal digits and return the -specified character code. Any nondigit terminates the sequence. -If the terminator is RET, it is discarded; -any other terminator is used itself as input. - -The optional argument PROMPT specifies a string to use to prompt the user. -The variable `read-quoted-char-radix' controls which radix to use -for numeric input." - (let ((message-log-max nil) done (first t) (code 0) translated) - (while (not done) - (let ((inhibit-quit first) - ;; Don't let C-h get the help message--only help function keys. - (help-char nil) - (help-form - "Type the special character you want to use, -or the octal character code. -RET terminates the character code and is discarded; -any other non-digit terminates the character code and is then used as input.")) - (setq translated (read-key (and prompt (format "%s-" prompt)))) - (if inhibit-quit (setq quit-flag nil))) - (if (integerp translated) - (setq translated (char-resolve-modifiers translated))) - (cond ((null translated)) - ((not (integerp translated)) - (setq unread-command-events - (listify-key-sequence (this-single-command-raw-keys)) - done t)) - ((/= (logand translated ?\M-\^@) 0) - ;; Turn a meta-character into a character with the 0200 bit set. - (setq code (logior (logand translated (lognot ?\M-\^@)) 128) - done t)) - ((and (<= ?0 translated) - (< translated (+ ?0 (min 10 read-quoted-char-radix)))) - (setq code (+ (* code read-quoted-char-radix) (- translated ?0))) - (and prompt (setq prompt (message "%s %c" prompt translated)))) - ((and (<= ?a (downcase translated)) - (< (downcase translated) - (+ ?a -10 (min 36 read-quoted-char-radix)))) - (setq code (+ (* code read-quoted-char-radix) - (+ 10 (- (downcase translated) ?a)))) - (and prompt (setq prompt (message "%s %c" prompt translated)))) - ((and (not first) (eq translated ?\C-m)) - (setq done t)) - ((not first) - (setq unread-command-events - (listify-key-sequence (this-single-command-raw-keys)) - done t)) - (t (setq code translated - done t))) - (setq first nil)) - code)) - (defvar read-passwd-map ;; BEWARE: `defconst' would purecopy it, breaking the sharing with ;; minibuffer-local-map along the way! @@ -2574,57 +2496,6 @@ mode.") Various programs in Emacs store information in this directory. Note that this should end with a directory separator. See also `locate-user-emacs-file'.") - -(custom-declare-variable-early 'user-emacs-directory-warning t - "Non-nil means warn if cannot access `user-emacs-directory'. -Set this to nil at your own risk..." - :type 'boolean - :group 'initialization - :version "24.4") - -(defun locate-user-emacs-file (new-name &optional old-name) - "Return an absolute per-user Emacs-specific file name. -If NEW-NAME exists in `user-emacs-directory', return it. -Else if OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME. -Else return NEW-NAME in `user-emacs-directory', creating the -directory if it does not exist." - (convert-standard-filename - (let* ((home (concat "~" (or init-file-user ""))) - (at-home (and old-name (expand-file-name old-name home))) - (bestname (abbreviate-file-name - (expand-file-name new-name user-emacs-directory)))) - (if (and at-home (not (file-readable-p bestname)) - (file-readable-p at-home)) - at-home - ;; Make sure `user-emacs-directory' exists, - ;; unless we're in batch mode or dumping Emacs. - (or noninteractive - purify-flag - (let (errtype) - (if (file-directory-p user-emacs-directory) - (or (file-accessible-directory-p user-emacs-directory) - (setq errtype "access")) - (let ((umask (default-file-modes))) - (unwind-protect - (progn - (set-default-file-modes ?\700) - (condition-case nil - (make-directory user-emacs-directory) - (error (setq errtype "create")))) - (set-default-file-modes umask)))) - (when (and errtype - user-emacs-directory-warning - (not (get 'user-emacs-directory-warning 'this-session))) - ;; Only warn once per Emacs session. - (put 'user-emacs-directory-warning 'this-session t) - (display-warning 'initialization - (format "\ -Unable to %s `user-emacs-directory' (%s). -Any data that would normally be written there may be lost! -If you never want to see this message again, -customize the variable `user-emacs-directory-warning'." - errtype user-emacs-directory))))) - bestname)))) ;;;; Misc. useful functions. |
