annotate lisp/chistory.el @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128

typos.
author Jeff Law <law@redhat.com>
date Wed, 10 Sep 1997 21:16:20 +0000
parents 83f275dcd93a
children ac1673121774
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; chistory.el --- list command history
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
3 ;; Copyright (C) 1985 Free Software Foundation, Inc.
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
5 ;; Author: K. Shane Hartman
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
6 ;; Maintainer: FSF
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; any later version.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 9626
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 9626
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 9626
diff changeset
23 ;; Boston, MA 02111-1307, USA.
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
25 ;;; Commentary:
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;; This really has nothing to do with list-command-history per se, but
9626
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
28 ;; its a nice alternative to C-x ESC ESC (repeat-complex-command) and
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; functions as a lister if given no pattern. It's not important
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;; enough to warrant a file of its own.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
32 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
33
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;;;###autoload
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 (defun repeat-matching-complex-command (&optional pattern)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 "Edit and re-evaluate complex command with name matching PATTERN.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 Matching occurrences are displayed, most recent first, until you select
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 a form for evaluation. If PATTERN is empty (or nil), every form in the
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 command history is offered. The form is placed in the minibuffer for
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 editing and the result is evaluated."
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 (interactive "sRedo Command (regexp): ")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (if pattern
9626
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
43 (if (string-match "[^ \t]" pattern)
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
44 (setq pattern (substring pattern (match-beginning 0)))
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
45 (setq pattern nil)))
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 (let ((history command-history)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 (temp)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 (what))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (while (and history (not what))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (setq temp (car history))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (if (and (or (not pattern) (string-match pattern (symbol-name (car temp))))
9626
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
52 (y-or-n-p (format "Redo %S? " temp)))
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (setq what (car history))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 (setq history (cdr history))))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 (if (not what)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (error "Command history exhausted")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 ;; Try to remove any useless command history element for this command.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (if (eq (car (car command-history)) 'repeat-matching-complex-command)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (setq command-history (cdr command-history)))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (edit-and-eval-command "Redo: " what))))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (defvar default-command-history-filter-garbage
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 '(command-history-mode
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 list-command-history
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 electric-command-history)
9626
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
66 "*A list of symbols to be ignored by `default-command-history-filter'.
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
67 It that function is given a list whose car is an element of this list,
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
68 then it will return non-nil (indicating the list should be discarded from
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
69 the history).
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 Initially, all commands related to the command history are discarded.")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 (defvar list-command-history-filter 'default-command-history-filter
9626
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
73 "Predicate to test which commands should be excluded from the history listing.
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
74 If non-nil, should be the name of a function of one argument.
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 It is passed each element of the command history when
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 \\[list-command-history] is called. If the filter returns non-nil for
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 some element, that element is excluded from the history listing. The
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 default filter removes commands associated with the command-history.")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (defun default-command-history-filter (frob)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 "Filter commands matching `default-command-history-filter-garbage' list
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 from the command history."
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (or (not (consp frob))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (memq (car frob) default-command-history-filter-garbage)))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (defvar list-command-history-max 32
9626
e928e72d3342 (repeat-matching-complex-command): Fix check for empty pattern. Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 2452
diff changeset
87 "*If non-nil, maximum length of the listing produced by `list-command-history'.")
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 ;;;###autoload
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (defun list-command-history ()
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 "List history of commands typed to minibuffer.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 The number of commands listed is controlled by `list-command-history-max'.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 Calls value of `list-command-history-filter' (if non-nil) on each history
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 element to judge if that element should be excluded from the list.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 The buffer is left in Command History mode."
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (interactive)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (with-output-to-temp-buffer
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 "*Command History*"
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (let ((history command-history)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 (buffer-read-only nil)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 (count (or list-command-history-max -1)))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (while (and (/= count 0) history)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (if (and (boundp 'list-command-history-filter)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 list-command-history-filter
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 (funcall list-command-history-filter (car history)))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 nil
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 (setq count (1- count))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 (prin1 (car history))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 (terpri))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (setq history (cdr history))))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (save-excursion
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (set-buffer "*Command History*")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 (goto-char (point-min))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 (if (eobp)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (error "No command history")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (Command-history-setup)))))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (defun Command-history-setup (&optional majormode modename keymap)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (set-buffer "*Command History*")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (use-local-map (or keymap command-history-map))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 (lisp-mode-variables nil)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (set-syntax-table emacs-lisp-mode-syntax-table)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (setq buffer-read-only t)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (use-local-map (or keymap command-history-map))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (setq major-mode (or majormode 'command-history-mode))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (setq mode-name (or modename "Command History")))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (defvar command-history-hook nil
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 "If non-nil, its value is called on entry to `command-history-mode'.")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (defvar command-history-map nil)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 (if command-history-map
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 nil
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 (setq command-history-map
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 (nconc (make-sparse-keymap) shared-lisp-mode-map))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (suppress-keymap command-history-map)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 (define-key command-history-map "x" 'command-history-repeat)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (define-key command-history-map "\n" 'next-line)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 (define-key command-history-map "\r" 'next-line)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (define-key command-history-map "\177" 'previous-line))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (defun command-history-repeat ()
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 "Repeat the command shown on the current line.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 The buffer for that command is the previous current buffer."
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (interactive)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (save-excursion
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (eval (prog1
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (save-excursion
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 (beginning-of-line)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 (read (current-buffer)))
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (set-buffer
2452
5c9d9b33f249 (repeat-history-command): Bug fix. Someone forgot a car.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
153 (car (cdr (buffer-list))))))))
411
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 ;;;###autoload
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (defun command-history-mode ()
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 "Major mode for examining commands from `command-history'.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 The number of commands listed is controlled by `list-command-history-max'.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 The command history is filtered by `list-command-history-filter' if non-nil.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 Use \\<command-history-map>\\[command-history-repeat] to repeat the command on the current line.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 Otherwise much like Emacs-Lisp Mode except that there is no self-insertion
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 and digits provide prefix arguments. Tab does not indent.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 \\{command-history-map}
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 Calls the value of `command-history-hook' if that is non-nil.
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 The Command History listing is recomputed each time this mode is invoked."
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 (interactive)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 (list-command-history)
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 (pop-to-buffer "*Command History*")
cb75ab565260 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 (run-hooks 'command-history-hook))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 411
diff changeset
171
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 411
diff changeset
172 (provide 'chistory)
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 411
diff changeset
173
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
174 ;;; chistory.el ends here