diff options
| author | Chong Yidong | 2008-11-16 20:02:49 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-11-16 20:02:49 +0000 |
| commit | 08640de52c5c5add4039f0b7334eaba967d66055 (patch) | |
| tree | 40028c8bc674e71f281cfb7e4b501c51626809bc | |
| parent | f5f895cf8e2fcce0b591092ec5804f9ccbe000e9 (diff) | |
| download | emacs-08640de52c5c5add4039f0b7334eaba967d66055.tar.gz emacs-08640de52c5c5add4039f0b7334eaba967d66055.zip | |
(read-passwd): Yank current kill if the user enters C-y.
| -rw-r--r-- | lisp/subr.el | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index ccb235b5c4d..fac523d4a7f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1781,7 +1781,9 @@ If optional CONFIRM is non-nil, read the password twice to make sure. | |||
| 1781 | Optional DEFAULT is a default password to use instead of empty input. | 1781 | Optional DEFAULT is a default password to use instead of empty input. |
| 1782 | 1782 | ||
| 1783 | This function echoes `.' for each character that the user types. | 1783 | This function echoes `.' for each character that the user types. |
| 1784 | The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. | 1784 | |
| 1785 | The user ends with RET, LFD, or ESC. DEL or C-h rubs out. | ||
| 1786 | C-y yanks the current kill. C-u kills line. | ||
| 1785 | C-g quits; if `inhibit-quit' was non-nil around this function, | 1787 | C-g quits; if `inhibit-quit' was non-nil around this function, |
| 1786 | then it returns nil if the user types C-g, but quit-flag remains set. | 1788 | then it returns nil if the user types C-g, but quit-flag remains set. |
| 1787 | 1789 | ||
| @@ -1818,21 +1820,32 @@ by doing (clear-string STRING)." | |||
| 1818 | (setq c (read-char-exclusive nil t)) | 1820 | (setq c (read-char-exclusive nil t)) |
| 1819 | (and (/= c ?\r) (/= c ?\n) (/= c ?\e))) | 1821 | (and (/= c ?\r) (/= c ?\n) (/= c ?\e))) |
| 1820 | (clear-this-command-keys) | 1822 | (clear-this-command-keys) |
| 1821 | (if (= c ?\C-u) | 1823 | (cond ((= c ?\C-u) ; kill line |
| 1822 | (progn | 1824 | (and (arrayp pass) (clear-string pass)) |
| 1823 | (and (arrayp pass) (clear-string pass)) | 1825 | (setq pass "")) |
| 1824 | (setq pass "")) | 1826 | ((= c ?\C-y) ; yank |
| 1825 | (if (and (/= c ?\b) (/= c ?\177)) | 1827 | (let* ((str (condition-case nil |
| 1826 | (let* ((new-char (char-to-string c)) | 1828 | (current-kill 0) |
| 1827 | (new-pass (concat pass new-char))) | 1829 | (error nil))) |
| 1828 | (and (arrayp pass) (clear-string pass)) | 1830 | new-pass) |
| 1829 | (clear-string new-char) | 1831 | (when str |
| 1830 | (setq c ?\0) | 1832 | (setq new-pass |
| 1831 | (setq pass new-pass)) | 1833 | (concat pass |
| 1832 | (if (> (length pass) 0) | 1834 | (substring-no-properties str))) |
| 1833 | (let ((new-pass (substring pass 0 -1))) | 1835 | (and (arrayp pass) (clear-string pass)) |
| 1834 | (and (arrayp pass) (clear-string pass)) | 1836 | (setq c ?\0) |
| 1835 | (setq pass new-pass)))))) | 1837 | (setq pass new-pass)))) |
| 1838 | ((and (/= c ?\b) (/= c ?\177)) ; insert char | ||
| 1839 | (let* ((new-char (char-to-string c)) | ||
| 1840 | (new-pass (concat pass new-char))) | ||
| 1841 | (and (arrayp pass) (clear-string pass)) | ||
| 1842 | (clear-string new-char) | ||
| 1843 | (setq c ?\0) | ||
| 1844 | (setq pass new-pass))) | ||
| 1845 | ((> (length pass) 0) ; rubout | ||
| 1846 | (let ((new-pass (substring pass 0 -1))) | ||
| 1847 | (and (arrayp pass) (clear-string pass)) | ||
| 1848 | (setq pass new-pass))))) | ||
| 1836 | (message nil) | 1849 | (message nil) |
| 1837 | (or pass default ""))))) | 1850 | (or pass default ""))))) |
| 1838 | 1851 | ||