Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
0818b15e
Commit
0818b15e
authored
Feb 12, 1995
by
Richard M. Stallman
Browse files
(next-history-element): Do nothing if n is 0.
Handle errors properly when history list is empty.
parent
4c0317b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
lisp/simple.el
lisp/simple.el
+20
-16
No files found.
lisp/simple.el
View file @
0818b15e
...
...
@@ -559,22 +559,26 @@ If N is negative, find the previous or Nth previous match."
(
defun
next-history-element
(
n
)
"Insert the next element of the minibuffer history into the minibuffer."
(
interactive
"p"
)
(
let
((
narg
(
min
(
max
1
(
-
minibuffer-history-position
n
))
(
length
(
symbol-value
minibuffer-history-variable
)))))
(
if
(
=
minibuffer-history-position
narg
)
(
error
(
if
(
=
minibuffer-history-position
1
)
"End of history; no next item"
"Beginning of history; no preceding item"
))
(
erase-buffer
)
(
setq
minibuffer-history-position
narg
)
(
let
((
elt
(
nth
(
1-
minibuffer-history-position
)
(
symbol-value
minibuffer-history-variable
))))
(
insert
(
if
minibuffer-history-sexp-flag
(
let
((
print-level
nil
))
(
prin1-to-string
elt
))
elt
)))
(
goto-char
(
point-min
)))))
(
or
(
zerop
n
)
(
let
((
narg
(
min
(
max
1
(
-
minibuffer-history-position
n
))
(
length
(
symbol-value
minibuffer-history-variable
)))))
(
if
(
or
(
zerop
narg
)
(
=
minibuffer-history-position
narg
))
(
error
(
if
(
if
(
zerop
narg
)
(
>
n
0
)
(
=
minibuffer-history-position
1
))
"End of history; no next item"
"Beginning of history; no preceding item"
))
(
erase-buffer
)
(
setq
minibuffer-history-position
narg
)
(
let
((
elt
(
nth
(
1-
minibuffer-history-position
)
(
symbol-value
minibuffer-history-variable
))))
(
insert
(
if
minibuffer-history-sexp-flag
(
let
((
print-level
nil
))
(
prin1-to-string
elt
))
elt
)))
(
goto-char
(
point-min
))))))
(
defun
previous-history-element
(
n
)
"Inserts the previous element of the minibuffer history into the minibuffer."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment