diff options
| author | Richard M. Stallman | 1992-07-24 03:42:21 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-07-24 03:42:21 +0000 |
| commit | ebb61177e366e5783efa1d18c216f4528b306cf6 (patch) | |
| tree | 549f040cc079a8e1a8e4fc1b15175667d5d4da04 | |
| parent | 65583c2412373877bd9a542c685ce9254574f9fd (diff) | |
| download | emacs-ebb61177e366e5783efa1d18c216f4528b306cf6.tar.gz emacs-ebb61177e366e5783efa1d18c216f4528b306cf6.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/simple.el | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 840bd77a4b0..c607a9d1a32 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -352,10 +352,25 @@ the minibuffer, then read and evaluate the result." | |||
| 352 | 352 | ||
| 353 | ;; (defvar repeat-complex-command nil) | 353 | ;; (defvar repeat-complex-command nil) |
| 354 | 354 | ||
| 355 | (defvar repeat-complex-command-map (copy-keymap minibuffer-local-map)) | 355 | (defvar minibuffer-history nil) |
| 356 | (define-key repeat-complex-command-map "\ep" 'previous-complex-command) | 356 | (defvar minibuffer-history-variable 'minibuffer-history) |
| 357 | (define-key repeat-complex-command-map "\en" 'next-complex-command) | 357 | (defvar minibuffer-history-position nil) |
| 358 | (defun repeat-complex-command (repeat-complex-command-arg) | 358 | |
| 359 | (define-key minibuffer-local-map "\en" 'next-history-element) | ||
| 360 | (define-key minibuffer-local-ns-map "\en" 'next-history-element) | ||
| 361 | (define-key minibuffer-local-ns-map "\en" 'next-history-element) | ||
| 362 | (define-key minibuffer-local-completion-map "\en" 'next-history-element) | ||
| 363 | (define-key minibuffer-local-completion-map "\en" 'next-history-element) | ||
| 364 | (define-key minibuffer-local-must-match-map "\en" 'next-history-element) | ||
| 365 | |||
| 366 | (define-key minibuffer-local-map "\ep" 'previous-history-element) | ||
| 367 | (define-key minibuffer-local-ns-map "\ep" 'previous-history-element) | ||
| 368 | (define-key minibuffer-local-ns-map "\ep" 'previous-history-element) | ||
| 369 | (define-key minibuffer-local-completion-map "\ep" 'previous-history-element) | ||
| 370 | (define-key minibuffer-local-completion-map "\ep" 'previous-history-element) | ||
| 371 | (define-key minibuffer-local-must-match-map "\ep" 'previous-history-element) | ||
| 372 | |||
| 373 | (defun repeat-complex-command (arg) | ||
| 359 | "Edit and re-evaluate last complex command, or ARGth from last. | 374 | "Edit and re-evaluate last complex command, or ARGth from last. |
| 360 | A complex command is one which used the minibuffer. | 375 | A complex command is one which used the minibuffer. |
| 361 | The command is placed in the minibuffer as a Lisp form for editing. | 376 | The command is placed in the minibuffer as a Lisp form for editing. |
| @@ -366,13 +381,14 @@ Whilst editing the command, the following commands are available: | |||
| 366 | \\{repeat-complex-command-map}" | 381 | \\{repeat-complex-command-map}" |
| 367 | (interactive "p") | 382 | (interactive "p") |
| 368 | (let ((elt (nth (1- repeat-complex-command-arg) command-history)) | 383 | (let ((elt (nth (1- repeat-complex-command-arg) command-history)) |
| 384 | (minibuffer-history-position arg) | ||
| 369 | (repeat-complex-command-flag t) | 385 | (repeat-complex-command-flag t) |
| 370 | newcmd) | 386 | newcmd) |
| 371 | (if elt | 387 | (if elt |
| 372 | (progn | 388 | (let ((minibuffer-history-variable ' command-history)) |
| 373 | (setq newcmd (read-from-minibuffer "Redo: " | 389 | (setq newcmd (read-from-minibuffer "Redo: " |
| 374 | (prin1-to-string elt) | 390 | (prin1-to-string elt) |
| 375 | repeat-complex-command-map | 391 | minibuffer-local-map |
| 376 | t)) | 392 | t)) |
| 377 | ;; If command to be redone does not match front of history, | 393 | ;; If command to be redone does not match front of history, |
| 378 | ;; add it to the history. | 394 | ;; add it to the history. |
| @@ -381,22 +397,22 @@ Whilst editing the command, the following commands are available: | |||
| 381 | (eval newcmd)) | 397 | (eval newcmd)) |
| 382 | (ding)))) | 398 | (ding)))) |
| 383 | 399 | ||
| 384 | (defun next-complex-command (n) | 400 | (defun next-history-element (n) |
| 385 | "Inserts the next element of `command-history' into the minibuffer." | 401 | "Insert the next element of the minibuffer history into the minibuffer." |
| 386 | (interactive "p") | 402 | (interactive "p") |
| 387 | (let ((narg (min (max 1 (- repeat-complex-command-arg n)) | 403 | (let ((narg (min (max 1 (- minibuffer-history-position n)) |
| 388 | (length command-history)))) | 404 | (length (symbol-value minibuffer-history-variable))))) |
| 389 | (if (= repeat-complex-command-arg narg) | 405 | (if (= minibuffer-history-position narg) |
| 390 | (error (if (= repeat-complex-command-arg 1) | 406 | (error (if (= minibuffer-history-position 1) |
| 391 | "No following item in command history" | 407 | "No following item in minibuffer history" |
| 392 | "No preceding item in command history")) | 408 | "No preceding item in minibuffer history")) |
| 393 | (erase-buffer) | 409 | (erase-buffer) |
| 394 | (setq repeat-complex-command-arg narg) | 410 | (setq minibuffer-history-position narg) |
| 395 | (insert (prin1-to-string (nth (1- repeat-complex-command-arg) | 411 | (insert (prin1-to-string (nth (1- minibuffer-history-position) |
| 396 | command-history))) | 412 | (symbol-value minibuffer-history-variable)))) |
| 397 | (goto-char (point-min))))) | 413 | (goto-char (point-min))))) |
| 398 | 414 | ||
| 399 | (defun previous-complex-command (n) | 415 | (defun previous-history-element (n) |
| 400 | "Inserts the previous element of `command-history' into the minibuffer." | 416 | "Inserts the previous element of `command-history' into the minibuffer." |
| 401 | (interactive "p") | 417 | (interactive "p") |
| 402 | (if repeat-complex-command-flag | 418 | (if repeat-complex-command-flag |
| @@ -794,6 +810,10 @@ yanking point; just return the Nth kill forward." | |||
| 794 | (let ((interprogram-paste (and (= n 0) | 810 | (let ((interprogram-paste (and (= n 0) |
| 795 | interprogram-paste-function | 811 | interprogram-paste-function |
| 796 | (funcall interprogram-paste-function)))) | 812 | (funcall interprogram-paste-function)))) |
| 813 | ;;; RMS: Turn off the interprogram paste feature | ||
| 814 | ;;; because currently it is wedged: it is always | ||
| 815 | ;;; giving a null string. | ||
| 816 | (setq interprogram-paste nil) | ||
| 797 | (if interprogram-paste | 817 | (if interprogram-paste |
| 798 | (progn | 818 | (progn |
| 799 | ;; Disable the interprogram cut function when we add the new | 819 | ;; Disable the interprogram cut function when we add the new |