diff options
| author | Stefan Monnier | 2013-10-29 22:14:16 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-10-29 22:14:16 -0400 |
| commit | 53b39e8977941c6b60deeeca3c0e54da9ec7961a (patch) | |
| tree | a8cc06eca243be50e6e018a8df438ac3a85ab7dd /lisp | |
| parent | 195ee2f0a990771753330ee912581da957eee034 (diff) | |
| download | emacs-53b39e8977941c6b60deeeca3c0e54da9ec7961a.tar.gz emacs-53b39e8977941c6b60deeeca3c0e54da9ec7961a.zip | |
* lisp/subr.el (custom-declare-variable-early): Remove function.
(custom-declare-variable-list): Remove var.
(error, user-error): Remove `while' loop.
(read-quoted-char-radix, read-quoted-char): Move to simple.el.
(user-emacs-directory-warning, locate-user-emacs-file):
Move to files.el.
* lisp/simple.el (read-quoted-char-radix, read-quoted-char):
* lisp/files.el (user-emacs-directory-warning, locate-user-emacs-file):
Move from subr.el.
* lisp/custom.el (custom-declare-variable-list): Don't process
custom-declare-variable-list.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/custom.el | 5 | ||||
| -rw-r--r-- | lisp/files.el | 51 | ||||
| -rw-r--r-- | lisp/simple.el | 61 | ||||
| -rw-r--r-- | lisp/subr.el | 133 |
5 files changed, 126 insertions, 136 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 85fb2cbb73e..d2c99e75f56 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,17 @@ | |||
| 1 | 2013-10-30 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2013-10-30 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * subr.el (custom-declare-variable-early): Remove function. | ||
| 4 | (custom-declare-variable-list): Remove var. | ||
| 5 | (error, user-error): Remove `while' loop. | ||
| 6 | (read-quoted-char-radix, read-quoted-char): Move to simple.el. | ||
| 7 | (user-emacs-directory-warning, locate-user-emacs-file): | ||
| 8 | Move to files.el. | ||
| 9 | * simple.el (read-quoted-char-radix, read-quoted-char): | ||
| 10 | * files.el (user-emacs-directory-warning, locate-user-emacs-file): | ||
| 11 | Move from subr.el. | ||
| 12 | * custom.el (custom-declare-variable-list): Don't process | ||
| 13 | custom-declare-variable-list. | ||
| 14 | |||
| 3 | * progmodes/python.el (python-shell-get-buffer): New function. | 15 | * progmodes/python.el (python-shell-get-buffer): New function. |
| 4 | (python-shell-get-process): Use it. | 16 | (python-shell-get-process): Use it. |
| 5 | (python-shell-send-string): Always use utf-8 and add a cookie to tell | 17 | (python-shell-send-string): Always use utf-8 and add a cookie to tell |
diff --git a/lisp/custom.el b/lisp/custom.el index d721198da0b..0df22a8b895 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -1489,11 +1489,6 @@ This means reset VARIABLE. (The argument IGNORED is ignored)." | |||
| 1489 | 1489 | ||
| 1490 | ;;; The End. | 1490 | ;;; The End. |
| 1491 | 1491 | ||
| 1492 | ;; Process the defcustoms for variables loaded before this file. | ||
| 1493 | (while custom-declare-variable-list | ||
| 1494 | (apply 'custom-declare-variable (car custom-declare-variable-list)) | ||
| 1495 | (setq custom-declare-variable-list (cdr custom-declare-variable-list))) | ||
| 1496 | |||
| 1497 | (provide 'custom) | 1492 | (provide 'custom) |
| 1498 | 1493 | ||
| 1499 | ;;; custom.el ends here | 1494 | ;;; custom.el ends here |
diff --git a/lisp/files.el b/lisp/files.el index cf3356014a1..d44401b4302 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -916,6 +916,57 @@ which we're looking." | |||
| 916 | (setq file nil)))) | 916 | (setq file nil)))) |
| 917 | (if root (file-name-as-directory root)))) | 917 | (if root (file-name-as-directory root)))) |
| 918 | 918 | ||
| 919 | (defcustom user-emacs-directory-warning t | ||
| 920 | "Non-nil means warn if cannot access `user-emacs-directory'. | ||
| 921 | Set this to nil at your own risk..." | ||
| 922 | :type 'boolean | ||
| 923 | :group 'initialization | ||
| 924 | :version "24.4") | ||
| 925 | |||
| 926 | (defun locate-user-emacs-file (new-name &optional old-name) | ||
| 927 | "Return an absolute per-user Emacs-specific file name. | ||
| 928 | If NEW-NAME exists in `user-emacs-directory', return it. | ||
| 929 | Else if OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME. | ||
| 930 | Else return NEW-NAME in `user-emacs-directory', creating the | ||
| 931 | directory if it does not exist." | ||
| 932 | (convert-standard-filename | ||
| 933 | (let* ((home (concat "~" (or init-file-user ""))) | ||
| 934 | (at-home (and old-name (expand-file-name old-name home))) | ||
| 935 | (bestname (abbreviate-file-name | ||
| 936 | (expand-file-name new-name user-emacs-directory)))) | ||
| 937 | (if (and at-home (not (file-readable-p bestname)) | ||
| 938 | (file-readable-p at-home)) | ||
| 939 | at-home | ||
| 940 | ;; Make sure `user-emacs-directory' exists, | ||
| 941 | ;; unless we're in batch mode or dumping Emacs. | ||
| 942 | (or noninteractive | ||
| 943 | purify-flag | ||
| 944 | (let (errtype) | ||
| 945 | (if (file-directory-p user-emacs-directory) | ||
| 946 | (or (file-accessible-directory-p user-emacs-directory) | ||
| 947 | (setq errtype "access")) | ||
| 948 | (let ((umask (default-file-modes))) | ||
| 949 | (unwind-protect | ||
| 950 | (progn | ||
| 951 | (set-default-file-modes ?\700) | ||
| 952 | (condition-case nil | ||
| 953 | (make-directory user-emacs-directory) | ||
| 954 | (error (setq errtype "create")))) | ||
| 955 | (set-default-file-modes umask)))) | ||
| 956 | (when (and errtype | ||
| 957 | user-emacs-directory-warning | ||
| 958 | (not (get 'user-emacs-directory-warning 'this-session))) | ||
| 959 | ;; Only warn once per Emacs session. | ||
| 960 | (put 'user-emacs-directory-warning 'this-session t) | ||
| 961 | (display-warning 'initialization | ||
| 962 | (format "\ | ||
| 963 | Unable to %s `user-emacs-directory' (%s). | ||
| 964 | Any data that would normally be written there may be lost! | ||
| 965 | If you never want to see this message again, | ||
| 966 | customize the variable `user-emacs-directory-warning'." | ||
| 967 | errtype user-emacs-directory))))) | ||
| 968 | bestname)))) | ||
| 969 | |||
| 919 | 970 | ||
| 920 | (defun executable-find (command) | 971 | (defun executable-find (command) |
| 921 | "Search for COMMAND in `exec-path' and return the absolute file name. | 972 | "Search for COMMAND in `exec-path' and return the absolute file name. |
diff --git a/lisp/simple.el b/lisp/simple.el index cd4df60e394..49108025a40 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -636,6 +636,67 @@ column specified by the function `current-left-margin'." | |||
| 636 | (delete-horizontal-space t)) | 636 | (delete-horizontal-space t)) |
| 637 | (indent-according-to-mode))) | 637 | (indent-according-to-mode))) |
| 638 | 638 | ||
| 639 | (defcustom read-quoted-char-radix 8 | ||
| 640 | "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. | ||
| 641 | Legitimate radix values are 8, 10 and 16." | ||
| 642 | :type '(choice (const 8) (const 10) (const 16)) | ||
| 643 | :group 'editing-basics) | ||
| 644 | |||
| 645 | (defun read-quoted-char (&optional prompt) | ||
| 646 | "Like `read-char', but do not allow quitting. | ||
| 647 | Also, if the first character read is an octal digit, | ||
| 648 | we read any number of octal digits and return the | ||
| 649 | specified character code. Any nondigit terminates the sequence. | ||
| 650 | If the terminator is RET, it is discarded; | ||
| 651 | any other terminator is used itself as input. | ||
| 652 | |||
| 653 | The optional argument PROMPT specifies a string to use to prompt the user. | ||
| 654 | The variable `read-quoted-char-radix' controls which radix to use | ||
| 655 | for numeric input." | ||
| 656 | (let ((message-log-max nil) done (first t) (code 0) translated) | ||
| 657 | (while (not done) | ||
| 658 | (let ((inhibit-quit first) | ||
| 659 | ;; Don't let C-h get the help message--only help function keys. | ||
| 660 | (help-char nil) | ||
| 661 | (help-form | ||
| 662 | "Type the special character you want to use, | ||
| 663 | or the octal character code. | ||
| 664 | RET terminates the character code and is discarded; | ||
| 665 | any other non-digit terminates the character code and is then used as input.")) | ||
| 666 | (setq translated (read-key (and prompt (format "%s-" prompt)))) | ||
| 667 | (if inhibit-quit (setq quit-flag nil))) | ||
| 668 | (if (integerp translated) | ||
| 669 | (setq translated (char-resolve-modifiers translated))) | ||
| 670 | (cond ((null translated)) | ||
| 671 | ((not (integerp translated)) | ||
| 672 | (setq unread-command-events | ||
| 673 | (listify-key-sequence (this-single-command-raw-keys)) | ||
| 674 | done t)) | ||
| 675 | ((/= (logand translated ?\M-\^@) 0) | ||
| 676 | ;; Turn a meta-character into a character with the 0200 bit set. | ||
| 677 | (setq code (logior (logand translated (lognot ?\M-\^@)) 128) | ||
| 678 | done t)) | ||
| 679 | ((and (<= ?0 translated) | ||
| 680 | (< translated (+ ?0 (min 10 read-quoted-char-radix)))) | ||
| 681 | (setq code (+ (* code read-quoted-char-radix) (- translated ?0))) | ||
| 682 | (and prompt (setq prompt (message "%s %c" prompt translated)))) | ||
| 683 | ((and (<= ?a (downcase translated)) | ||
| 684 | (< (downcase translated) | ||
| 685 | (+ ?a -10 (min 36 read-quoted-char-radix)))) | ||
| 686 | (setq code (+ (* code read-quoted-char-radix) | ||
| 687 | (+ 10 (- (downcase translated) ?a)))) | ||
| 688 | (and prompt (setq prompt (message "%s %c" prompt translated)))) | ||
| 689 | ((and (not first) (eq translated ?\C-m)) | ||
| 690 | (setq done t)) | ||
| 691 | ((not first) | ||
| 692 | (setq unread-command-events | ||
| 693 | (listify-key-sequence (this-single-command-raw-keys)) | ||
| 694 | done t)) | ||
| 695 | (t (setq code translated | ||
| 696 | done t))) | ||
| 697 | (setq first nil)) | ||
| 698 | code)) | ||
| 699 | |||
| 639 | (defun quoted-insert (arg) | 700 | (defun quoted-insert (arg) |
| 640 | "Read next input character and insert it. | 701 | "Read next input character and insert it. |
| 641 | This is useful for inserting control characters. | 702 | This is useful for inserting control characters. |
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 @@ | |||
| 29 | ;; Beware: while this file has tag `utf-8', before it's compiled, it gets | 29 | ;; Beware: while this file has tag `utf-8', before it's compiled, it gets |
| 30 | ;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap. | 30 | ;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap. |
| 31 | 31 | ||
| 32 | (defvar custom-declare-variable-list nil | ||
| 33 | "Record `defcustom' calls made before `custom.el' is loaded to handle them. | ||
| 34 | Each element of this list holds the arguments to one call to `defcustom'.") | ||
| 35 | |||
| 36 | ;; Use this, rather than defcustom, in subr.el and other files loaded | ||
| 37 | ;; before custom.el. | ||
| 38 | (defun custom-declare-variable-early (&rest arguments) | ||
| 39 | (setq custom-declare-variable-list | ||
| 40 | (cons arguments custom-declare-variable-list))) | ||
| 41 | |||
| 42 | (defmacro declare-function (_fn _file &optional _arglist _fileonly) | 32 | (defmacro declare-function (_fn _file &optional _arglist _fileonly) |
| 43 | "Tell the byte-compiler that function FN is defined, in FILE. | 33 | "Tell the byte-compiler that function FN is defined, in FILE. |
| 44 | Optional ARGLIST is the argument list used by the function. | 34 | 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 | |||
| 302 | letter but *do not* end with a period. Please follow this convention | 292 | letter but *do not* end with a period. Please follow this convention |
| 303 | for the sake of consistency." | 293 | for the sake of consistency." |
| 304 | (declare (advertised-calling-convention (string &rest args) "23.1")) | 294 | (declare (advertised-calling-convention (string &rest args) "23.1")) |
| 305 | (while t | 295 | (signal 'error (list (apply 'format args)))) |
| 306 | (signal 'error (list (apply 'format args))))) | ||
| 307 | 296 | ||
| 308 | (defun user-error (format &rest args) | 297 | (defun user-error (format &rest args) |
| 309 | "Signal a pilot error, making error message by passing all args to `format'. | 298 | "Signal a pilot error, making error message by passing all args to `format'. |
| @@ -313,8 +302,7 @@ for the sake of consistency. | |||
| 313 | This is just like `error' except that `user-error's are expected to be the | 302 | This is just like `error' except that `user-error's are expected to be the |
| 314 | result of an incorrect manipulation on the part of the user, rather than the | 303 | result of an incorrect manipulation on the part of the user, rather than the |
| 315 | result of an actual problem." | 304 | result of an actual problem." |
| 316 | (while t | 305 | (signal 'user-error (list (apply #'format format args)))) |
| 317 | (signal 'user-error (list (apply #'format format args))))) | ||
| 318 | 306 | ||
| 319 | (defun define-error (name message &optional parent) | 307 | (defun define-error (name message &optional parent) |
| 320 | "Define NAME as a new error signal. | 308 | "Define NAME as a new error signal. |
| @@ -1943,17 +1931,6 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'." | |||
| 1943 | 1931 | ||
| 1944 | ;;;; Input and display facilities. | 1932 | ;;;; Input and display facilities. |
| 1945 | 1933 | ||
| 1946 | (defvar read-quoted-char-radix 8 | ||
| 1947 | "Radix for \\[quoted-insert] and other uses of `read-quoted-char'. | ||
| 1948 | Legitimate radix values are 8, 10 and 16.") | ||
| 1949 | |||
| 1950 | (custom-declare-variable-early | ||
| 1951 | 'read-quoted-char-radix 8 | ||
| 1952 | "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. | ||
| 1953 | Legitimate radix values are 8, 10 and 16." | ||
| 1954 | :type '(choice (const 8) (const 10) (const 16)) | ||
| 1955 | :group 'editing-basics) | ||
| 1956 | |||
| 1957 | (defconst read-key-empty-map (make-sparse-keymap)) | 1934 | (defconst read-key-empty-map (make-sparse-keymap)) |
| 1958 | 1935 | ||
| 1959 | (defvar read-key-delay 0.01) ;Fast enough for 100Hz repeat rate, hopefully. | 1936 | (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'." | |||
| 2009 | (cancel-timer timer) | 1986 | (cancel-timer timer) |
| 2010 | (use-global-map old-global-map)))) | 1987 | (use-global-map old-global-map)))) |
| 2011 | 1988 | ||
| 2012 | (defun read-quoted-char (&optional prompt) | ||
| 2013 | "Like `read-char', but do not allow quitting. | ||
| 2014 | Also, if the first character read is an octal digit, | ||
| 2015 | we read any number of octal digits and return the | ||
| 2016 | specified character code. Any nondigit terminates the sequence. | ||
| 2017 | If the terminator is RET, it is discarded; | ||
| 2018 | any other terminator is used itself as input. | ||
| 2019 | |||
| 2020 | The optional argument PROMPT specifies a string to use to prompt the user. | ||
| 2021 | The variable `read-quoted-char-radix' controls which radix to use | ||
| 2022 | for numeric input." | ||
| 2023 | (let ((message-log-max nil) done (first t) (code 0) translated) | ||
| 2024 | (while (not done) | ||
| 2025 | (let ((inhibit-quit first) | ||
| 2026 | ;; Don't let C-h get the help message--only help function keys. | ||
| 2027 | (help-char nil) | ||
| 2028 | (help-form | ||
| 2029 | "Type the special character you want to use, | ||
| 2030 | or the octal character code. | ||
| 2031 | RET terminates the character code and is discarded; | ||
| 2032 | any other non-digit terminates the character code and is then used as input.")) | ||
| 2033 | (setq translated (read-key (and prompt (format "%s-" prompt)))) | ||
| 2034 | (if inhibit-quit (setq quit-flag nil))) | ||
| 2035 | (if (integerp translated) | ||
| 2036 | (setq translated (char-resolve-modifiers translated))) | ||
| 2037 | (cond ((null translated)) | ||
| 2038 | ((not (integerp translated)) | ||
| 2039 | (setq unread-command-events | ||
| 2040 | (listify-key-sequence (this-single-command-raw-keys)) | ||
| 2041 | done t)) | ||
| 2042 | ((/= (logand translated ?\M-\^@) 0) | ||
| 2043 | ;; Turn a meta-character into a character with the 0200 bit set. | ||
| 2044 | (setq code (logior (logand translated (lognot ?\M-\^@)) 128) | ||
| 2045 | done t)) | ||
| 2046 | ((and (<= ?0 translated) | ||
| 2047 | (< translated (+ ?0 (min 10 read-quoted-char-radix)))) | ||
| 2048 | (setq code (+ (* code read-quoted-char-radix) (- translated ?0))) | ||
| 2049 | (and prompt (setq prompt (message "%s %c" prompt translated)))) | ||
| 2050 | ((and (<= ?a (downcase translated)) | ||
| 2051 | (< (downcase translated) | ||
| 2052 | (+ ?a -10 (min 36 read-quoted-char-radix)))) | ||
| 2053 | (setq code (+ (* code read-quoted-char-radix) | ||
| 2054 | (+ 10 (- (downcase translated) ?a)))) | ||
| 2055 | (and prompt (setq prompt (message "%s %c" prompt translated)))) | ||
| 2056 | ((and (not first) (eq translated ?\C-m)) | ||
| 2057 | (setq done t)) | ||
| 2058 | ((not first) | ||
| 2059 | (setq unread-command-events | ||
| 2060 | (listify-key-sequence (this-single-command-raw-keys)) | ||
| 2061 | done t)) | ||
| 2062 | (t (setq code translated | ||
| 2063 | done t))) | ||
| 2064 | (setq first nil)) | ||
| 2065 | code)) | ||
| 2066 | |||
| 2067 | (defvar read-passwd-map | 1989 | (defvar read-passwd-map |
| 2068 | ;; BEWARE: `defconst' would purecopy it, breaking the sharing with | 1990 | ;; BEWARE: `defconst' would purecopy it, breaking the sharing with |
| 2069 | ;; minibuffer-local-map along the way! | 1991 | ;; minibuffer-local-map along the way! |
| @@ -2574,57 +2496,6 @@ mode.") | |||
| 2574 | Various programs in Emacs store information in this directory. | 2496 | Various programs in Emacs store information in this directory. |
| 2575 | Note that this should end with a directory separator. | 2497 | Note that this should end with a directory separator. |
| 2576 | See also `locate-user-emacs-file'.") | 2498 | See also `locate-user-emacs-file'.") |
| 2577 | |||
| 2578 | (custom-declare-variable-early 'user-emacs-directory-warning t | ||
| 2579 | "Non-nil means warn if cannot access `user-emacs-directory'. | ||
| 2580 | Set this to nil at your own risk..." | ||
| 2581 | :type 'boolean | ||
| 2582 | :group 'initialization | ||
| 2583 | :version "24.4") | ||
| 2584 | |||
| 2585 | (defun locate-user-emacs-file (new-name &optional old-name) | ||
| 2586 | "Return an absolute per-user Emacs-specific file name. | ||
| 2587 | If NEW-NAME exists in `user-emacs-directory', return it. | ||
| 2588 | Else if OLD-NAME is non-nil and ~/OLD-NAME exists, return ~/OLD-NAME. | ||
| 2589 | Else return NEW-NAME in `user-emacs-directory', creating the | ||
| 2590 | directory if it does not exist." | ||
| 2591 | (convert-standard-filename | ||
| 2592 | (let* ((home (concat "~" (or init-file-user ""))) | ||
| 2593 | (at-home (and old-name (expand-file-name old-name home))) | ||
| 2594 | (bestname (abbreviate-file-name | ||
| 2595 | (expand-file-name new-name user-emacs-directory)))) | ||
| 2596 | (if (and at-home (not (file-readable-p bestname)) | ||
| 2597 | (file-readable-p at-home)) | ||
| 2598 | at-home | ||
| 2599 | ;; Make sure `user-emacs-directory' exists, | ||
| 2600 | ;; unless we're in batch mode or dumping Emacs. | ||
| 2601 | (or noninteractive | ||
| 2602 | purify-flag | ||
| 2603 | (let (errtype) | ||
| 2604 | (if (file-directory-p user-emacs-directory) | ||
| 2605 | (or (file-accessible-directory-p user-emacs-directory) | ||
| 2606 | (setq errtype "access")) | ||
| 2607 | (let ((umask (default-file-modes))) | ||
| 2608 | (unwind-protect | ||
| 2609 | (progn | ||
| 2610 | (set-default-file-modes ?\700) | ||
| 2611 | (condition-case nil | ||
| 2612 | (make-directory user-emacs-directory) | ||
| 2613 | (error (setq errtype "create")))) | ||
| 2614 | (set-default-file-modes umask)))) | ||
| 2615 | (when (and errtype | ||
| 2616 | user-emacs-directory-warning | ||
| 2617 | (not (get 'user-emacs-directory-warning 'this-session))) | ||
| 2618 | ;; Only warn once per Emacs session. | ||
| 2619 | (put 'user-emacs-directory-warning 'this-session t) | ||
| 2620 | (display-warning 'initialization | ||
| 2621 | (format "\ | ||
| 2622 | Unable to %s `user-emacs-directory' (%s). | ||
| 2623 | Any data that would normally be written there may be lost! | ||
| 2624 | If you never want to see this message again, | ||
| 2625 | customize the variable `user-emacs-directory-warning'." | ||
| 2626 | errtype user-emacs-directory))))) | ||
| 2627 | bestname)))) | ||
| 2628 | 2499 | ||
| 2629 | ;;;; Misc. useful functions. | 2500 | ;;;; Misc. useful functions. |
| 2630 | 2501 | ||