diff options
| author | Richard M. Stallman | 1992-09-14 06:53:22 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-09-14 06:53:22 +0000 |
| commit | 854c16c5e2f9de97b8ecceefa0a05d84085e0994 (patch) | |
| tree | 40cf3c16804e0a8f5664a25959783a69b9c940e4 | |
| parent | 5d68c2c227eb79f3eca2323f86780f8b7b178c49 (diff) | |
| download | emacs-854c16c5e2f9de97b8ecceefa0a05d84085e0994.tar.gz emacs-854c16c5e2f9de97b8ecceefa0a05d84085e0994.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/mail/rmail.el | 17 | ||||
| -rw-r--r-- | lisp/simple.el | 71 |
2 files changed, 67 insertions, 21 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 62f067ff057..17ae38a227d 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -1604,13 +1604,16 @@ the body of the original message; otherwise copy the current message." | |||
| 1604 | (progn (search-forward "\n\n") (point)) | 1604 | (progn (search-forward "\n\n") (point)) |
| 1605 | (point-max))))) | 1605 | (point-max))))) |
| 1606 | ;; Start sending a new message; default header fields from the original. | 1606 | ;; Start sending a new message; default header fields from the original. |
| 1607 | (if (mail-other-window nil to subj irp2 cc (current-buffer)) | 1607 | ;; Turn off the usual actions for initializing the message body |
| 1608 | ;; Insert original text as initial text of new draft message. | 1608 | ;; because we want to get only the text from the failure message. |
| 1609 | (progn | 1609 | (let (mail-signature mail-setup-hook) |
| 1610 | (goto-char (point-max)) | 1610 | (if (mail-other-window nil to subj irp2 cc (current-buffer)) |
| 1611 | (insert orig-message) | 1611 | ;; Insert original text as initial text of new draft message. |
| 1612 | (goto-char (point-min)) | 1612 | (progn |
| 1613 | (end-of-line))))) | 1613 | (goto-char (point-max)) |
| 1614 | (insert orig-message) | ||
| 1615 | (goto-char (point-min)) | ||
| 1616 | (end-of-line)))))) | ||
| 1614 | 1617 | ||
| 1615 | ;;;; *** Rmail Specify Inbox Files *** | 1618 | ;;;; *** Rmail Specify Inbox Files *** |
| 1616 | 1619 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 3499fbd5549..298ecaed024 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -340,6 +340,10 @@ Other major modes are defined by comparison with this one." | |||
| 340 | (interactive) | 340 | (interactive) |
| 341 | (kill-all-local-variables)) | 341 | (kill-all-local-variables)) |
| 342 | 342 | ||
| 343 | (defvar read-expression-map (copy-keymap minibuffer-local-map) | ||
| 344 | "Minibuffer keymap used for reading Lisp expressions.") | ||
| 345 | (define-key read-expression-map "\M-\t" 'lisp-complete-symbol) | ||
| 346 | |||
| 343 | (put 'eval-expression 'disabled t) | 347 | (put 'eval-expression 'disabled t) |
| 344 | 348 | ||
| 345 | ;; We define this, rather than making eval interactive, | 349 | ;; We define this, rather than making eval interactive, |
| @@ -347,7 +351,8 @@ Other major modes are defined by comparison with this one." | |||
| 347 | (defun eval-expression (expression) | 351 | (defun eval-expression (expression) |
| 348 | "Evaluate EXPRESSION and print value in minibuffer. | 352 | "Evaluate EXPRESSION and print value in minibuffer. |
| 349 | Value is also consed on to front of the variable `values'." | 353 | Value is also consed on to front of the variable `values'." |
| 350 | (interactive "xEval: ") | 354 | (interactive (list (read-from-minibuffer "Eval: " |
| 355 | nil read-expression-map t))) | ||
| 351 | (setq values (cons (eval expression) values)) | 356 | (setq values (cons (eval expression) values)) |
| 352 | (prin1 (car values) t)) | 357 | (prin1 (car values) t)) |
| 353 | 358 | ||
| @@ -355,8 +360,9 @@ Value is also consed on to front of the variable `values'." | |||
| 355 | "Prompting with PROMPT, let user edit COMMAND and eval result. | 360 | "Prompting with PROMPT, let user edit COMMAND and eval result. |
| 356 | COMMAND is a Lisp expression. Let user edit that expression in | 361 | COMMAND is a Lisp expression. Let user edit that expression in |
| 357 | the minibuffer, then read and evaluate the result." | 362 | the minibuffer, then read and evaluate the result." |
| 358 | (let ((command (read-minibuffer prompt | 363 | (let ((command (read-from-minibuffer prompt |
| 359 | (prin1-to-string command)))) | 364 | (prin1-to-string command) |
| 365 | read-expression-map t))) | ||
| 360 | ;; Add edited command to command history, unless redundant. | 366 | ;; Add edited command to command history, unless redundant. |
| 361 | (or (equal command (car command-history)) | 367 | (or (equal command (car command-history)) |
| 362 | (setq command-history (cons command command-history))) | 368 | (setq command-history (cons command command-history))) |
| @@ -377,13 +383,17 @@ to get different commands to edit and resubmit." | |||
| 377 | (minibuffer-history-sexp-flag t) | 383 | (minibuffer-history-sexp-flag t) |
| 378 | newcmd) | 384 | newcmd) |
| 379 | (if elt | 385 | (if elt |
| 380 | (let ((minibuffer-history-variable ' command-history)) | 386 | (progn |
| 381 | (setq newcmd (read-from-minibuffer "Redo: " | 387 | (setq newcmd (read-from-minibuffer "Redo: " |
| 382 | (prin1-to-string elt) | 388 | (prin1-to-string elt) |
| 383 | minibuffer-local-map | 389 | read-expression-map |
| 384 | t | 390 | t |
| 385 | (cons 'command-history | 391 | (cons 'command-history |
| 386 | arg))) | 392 | arg))) |
| 393 | ;; If command was added to command-history as a string, | ||
| 394 | ;; get rid of that. We want only evallable expressions there. | ||
| 395 | (if (stringp (car command-history)) | ||
| 396 | (setq command-history (cdr command-history))) | ||
| 387 | ;; If command to be redone does not match front of history, | 397 | ;; If command to be redone does not match front of history, |
| 388 | ;; add it to the history. | 398 | ;; add it to the history. |
| 389 | (or (equal newcmd (car command-history)) | 399 | (or (equal newcmd (car command-history)) |
| @@ -391,10 +401,17 @@ to get different commands to edit and resubmit." | |||
| 391 | (eval newcmd)) | 401 | (eval newcmd)) |
| 392 | (ding)))) | 402 | (ding)))) |
| 393 | 403 | ||
| 394 | (defvar minibuffer-history nil) | 404 | (defvar minibuffer-history nil |
| 395 | (defvar minibuffer-history-sexp-flag nil) | 405 | "Default minibuffer history list. |
| 406 | This is used for all minibuffer input | ||
| 407 | except when an alternate history list is specified.") | ||
| 408 | (defvar minibuffer-history-sexp-flag nil | ||
| 409 | "Nonzero when doing history operations on `command-history'. | ||
| 410 | More generally, indicates that the history list being acted on | ||
| 411 | contains expressions rather than strings.") | ||
| 396 | (setq minibuffer-history-variable 'minibuffer-history) | 412 | (setq minibuffer-history-variable 'minibuffer-history) |
| 397 | (setq minibuffer-history-position nil) | 413 | (setq minibuffer-history-position nil) |
| 414 | (defvar minibuffer-history-search-history nil) | ||
| 398 | 415 | ||
| 399 | (mapcar | 416 | (mapcar |
| 400 | (function (lambda (key-and-command) | 417 | (function (lambda (key-and-command) |
| @@ -406,15 +423,27 @@ to get different commands to edit and resubmit." | |||
| 406 | '(minibuffer-local-map | 423 | '(minibuffer-local-map |
| 407 | minibuffer-local-ns-map | 424 | minibuffer-local-ns-map |
| 408 | minibuffer-local-completion-map | 425 | minibuffer-local-completion-map |
| 409 | minibuffer-local-must-match-map)))) | 426 | minibuffer-local-must-match-map |
| 427 | read-expression-map)))) | ||
| 410 | '(("\en" . next-history-element) ([next] . next-history-element) | 428 | '(("\en" . next-history-element) ([next] . next-history-element) |
| 411 | ("\ep" . previous-history-element) ([prior] . previous-history-element) | 429 | ("\ep" . previous-history-element) ([prior] . previous-history-element) |
| 412 | ("\er" . previous-matching-history-element) | 430 | ("\er" . previous-matching-history-element) |
| 413 | ("\es" . next-matching-history-element))) | 431 | ("\es" . next-matching-history-element))) |
| 414 | 432 | ||
| 415 | (put 'previous-matching-history-element 'enable-recursive-minibuffers t) | ||
| 416 | (defun previous-matching-history-element (regexp n) | 433 | (defun previous-matching-history-element (regexp n) |
| 417 | (interactive "sPrevious element matching (regexp): \np") | 434 | "Find the previous history element that matches REGEXP. |
| 435 | \(Previous history elements refer to earlier actions.) | ||
| 436 | With prefix argument N, search for Nth previous match. | ||
| 437 | If N is negative, find the next or Nth next match." | ||
| 438 | (interactive | ||
| 439 | (let ((enable-recursive-minibuffers t) | ||
| 440 | (minibuffer-history-sexp-flag nil)) | ||
| 441 | (list (read-from-minibuffer "Previous element matching (regexp): " | ||
| 442 | nil | ||
| 443 | minibuffer-local-map | ||
| 444 | nil | ||
| 445 | 'minibuffer-history-search-history) | ||
| 446 | (prefix-numeric-value current-prefix-arg)))) | ||
| 418 | (let ((history (symbol-value minibuffer-history-variable)) | 447 | (let ((history (symbol-value minibuffer-history-variable)) |
| 419 | prevpos | 448 | prevpos |
| 420 | (pos minibuffer-history-position)) | 449 | (pos minibuffer-history-position)) |
| @@ -429,18 +458,32 @@ to get different commands to edit and resubmit." | |||
| 429 | (if minibuffer-history-sexp-flag | 458 | (if minibuffer-history-sexp-flag |
| 430 | (prin1-to-string (nth (1- pos) history)) | 459 | (prin1-to-string (nth (1- pos) history)) |
| 431 | (nth (1- pos) history))) | 460 | (nth (1- pos) history))) |
| 432 | (setq n (+ n (if (< n 0) -1 1))))) | 461 | (setq n (+ n (if (< n 0) 1 -1))))) |
| 433 | (setq minibuffer-history-position pos) | 462 | (setq minibuffer-history-position pos) |
| 434 | (erase-buffer) | 463 | (erase-buffer) |
| 435 | (let ((elt (nth (1- pos) history))) | 464 | (let ((elt (nth (1- pos) history))) |
| 436 | (insert (if minibuffer-history-sexp-flag | 465 | (insert (if minibuffer-history-sexp-flag |
| 437 | (prin1-to-string elt) | 466 | (prin1-to-string elt) |
| 438 | elt))) | 467 | elt))) |
| 439 | (goto-char (point-min)))) | 468 | (goto-char (point-min))) |
| 469 | (if (or (eq (car (car command-history)) 'previous-matching-history-element) | ||
| 470 | (eq (car (car command-history)) 'next-matching-history-element)) | ||
| 471 | (setq command-history (cdr command-history)))) | ||
| 440 | 472 | ||
| 441 | (put 'next-matching-history-element 'enable-recursive-minibuffers t) | ||
| 442 | (defun next-matching-history-element (regexp n) | 473 | (defun next-matching-history-element (regexp n) |
| 443 | (interactive "sNext element matching (regexp): \np") | 474 | "Find the next history element that matches REGEXP. |
| 475 | \(The next history element refers to a more recent action.) | ||
| 476 | With prefix argument N, search for Nth next match. | ||
| 477 | If N is negative, find the previous or Nth previous match." | ||
| 478 | (interactive | ||
| 479 | (let ((enable-recursive-minibuffers t) | ||
| 480 | (minibuffer-history-sexp-flag nil)) | ||
| 481 | (list (read-from-minibuffer "Next element matching (regexp): " | ||
| 482 | nil | ||
| 483 | minibuffer-local-map | ||
| 484 | nil | ||
| 485 | 'minibuffer-history-search-history) | ||
| 486 | (prefix-numeric-value current-prefix-arg)))) | ||
| 444 | (previous-matching-history-element regexp (- n))) | 487 | (previous-matching-history-element regexp (- n))) |
| 445 | 488 | ||
| 446 | (defun next-history-element (n) | 489 | (defun next-history-element (n) |