aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-10-20 20:01:41 +0000
committerKarl Heuer1994-10-20 20:01:41 +0000
commitdaaf01970edc72b5ed233ac7d4cf248c240126eb (patch)
tree44faec87820016f616a81118b52257621b4ef168
parentbe76511435d831ab62858740ebc5e897ba996ebd (diff)
downloademacs-daaf01970edc72b5ed233ac7d4cf248c240126eb.tar.gz
emacs-daaf01970edc72b5ed233ac7d4cf248c240126eb.zip
(repeat-matching-complex-command): Fix check for empty pattern. Simplify.
(default-command-history-filter-garbage): Fix doc string. (list-command-history-filter, list-command-history-max): Likewise.
-rw-r--r--lisp/chistory.el26
1 files changed, 12 insertions, 14 deletions
diff --git a/lisp/chistory.el b/lisp/chistory.el
index 64fe7c8688d..db04beae381 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -24,7 +24,7 @@
24;;; Commentary: 24;;; Commentary:
25 25
26;; This really has nothing to do with list-command-history per se, but 26;; This really has nothing to do with list-command-history per se, but
27;; its a nice alternative to C-x ESC (repeat-complex-command) and 27;; its a nice alternative to C-x ESC ESC (repeat-complex-command) and
28;; functions as a lister if given no pattern. It's not important 28;; functions as a lister if given no pattern. It's not important
29;; enough to warrant a file of its own. 29;; enough to warrant a file of its own.
30 30
@@ -39,19 +39,16 @@ command history is offered. The form is placed in the minibuffer for
39editing and the result is evaluated." 39editing and the result is evaluated."
40 (interactive "sRedo Command (regexp): ") 40 (interactive "sRedo Command (regexp): ")
41 (if pattern 41 (if pattern
42 (if (equal (setq pattern 42 (if (string-match "[^ \t]" pattern)
43 (substring pattern 43 (setq pattern (substring pattern (match-beginning 0)))
44 (or (string-match "[ \t]*[^ \t]" pattern) 44 (setq pattern nil)))
45 (length pattern))))
46 "")
47 (setq pattern nil)))
48 (let ((history command-history) 45 (let ((history command-history)
49 (temp) 46 (temp)
50 (what)) 47 (what))
51 (while (and history (not what)) 48 (while (and history (not what))
52 (setq temp (car history)) 49 (setq temp (car history))
53 (if (and (or (not pattern) (string-match pattern (symbol-name (car temp)))) 50 (if (and (or (not pattern) (string-match pattern (symbol-name (car temp))))
54 (y-or-n-p (format "Redo %s? " (setq temp (prin1-to-string temp))))) 51 (y-or-n-p (format "Redo %S? " temp)))
55 (setq what (car history)) 52 (setq what (car history))
56 (setq history (cdr history)))) 53 (setq history (cdr history))))
57 (if (not what) 54 (if (not what)
@@ -65,13 +62,15 @@ editing and the result is evaluated."
65 '(command-history-mode 62 '(command-history-mode
66 list-command-history 63 list-command-history
67 electric-command-history) 64 electric-command-history)
68 "*A list of symbols. If `default-list-command-history-filter' is 65 "*A list of symbols to be ignored by `default-command-history-filter'.
69given a list whose car is an element of this list, then it will return 66It that function is given a list whose car is an element of this list,
70non-nil (indicating the list should be discarded from the history). 67then it will return non-nil (indicating the list should be discarded from
68the history).
71Initially, all commands related to the command history are discarded.") 69Initially, all commands related to the command history are discarded.")
72 70
73(defvar list-command-history-filter 'default-command-history-filter 71(defvar list-command-history-filter 'default-command-history-filter
74 "If non-nil, should be the name of a function of one argument. 72 "Predicate to test which commands should be excluded from the history listing.
73If non-nil, should be the name of a function of one argument.
75It is passed each element of the command history when 74It is passed each element of the command history when
76\\[list-command-history] is called. If the filter returns non-nil for 75\\[list-command-history] is called. If the filter returns non-nil for
77some element, that element is excluded from the history listing. The 76some element, that element is excluded from the history listing. The
@@ -84,8 +83,7 @@ from the command history."
84 (memq (car frob) default-command-history-filter-garbage))) 83 (memq (car frob) default-command-history-filter-garbage)))
85 84
86(defvar list-command-history-max 32 85(defvar list-command-history-max 32
87 "*If non-nil, should be a positive number which specifies the maximum 86 "*If non-nil, maximum length of the listing produced by `list-command-history'.")
88length of the Command History listing produced by `list-command-history'.")
89 87
90;;;###autoload 88;;;###autoload
91(defun list-command-history () 89(defun list-command-history ()