File tree Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Expand file tree Collapse file tree 4 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -645,6 +645,15 @@ A history list for variable-name arguments read by
645
645
@code {read-variable }.
646
646
@end defvar
647
647
648
+ @defvar read-number-history
649
+ A history list for numbers read by @code {read-number }.
650
+ @end defvar
651
+
652
+ @defvar goto-line-history
653
+ A history list for arguments to @code {goto-line }. This variable is
654
+ buffer local.
655
+ @end defvar
656
+
648
657
@c Less common: coding-system-history, input-method-history,
649
658
@c command-history, grep-history, grep-find-history,
650
659
@c read-envvar-name-history, setenv-history, yes-or-no-p-history.
Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ GNU General Public License for more details.
65
65
You should have received a copy of the GNU General Public License
66
66
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
67
67
68
+ +++
69
+ ** 'read-number' now has its own history variable.
70
+ Additionally, the function now accepts a HIST argument which can be
71
+ used to specify a custom history variable.
72
+
73
+ +++
74
+ ** Input history for 'goto-line' is now local to every buffer.
75
+ Each buffer will keep a separate history of line numbers used with
76
+ 'goto-line'. This should help making faster the process of finding
77
+ line numbers that were previously jumped to.
78
+
68
79
69
80
Local variables:
70
81
coding: utf-8
Original file line number Diff line number Diff line change @@ -1212,6 +1212,10 @@ that uses or sets the mark."
1212
1212
1213
1213
;; Counting lines, one way or another.
1214
1214
1215
+ (defvar goto-line-history nil
1216
+ "History of values entered with `goto-line'.")
1217
+ (make-variable-buffer-local 'goto-line-history)
1218
+
1215
1219
(defun goto-line (line &optional buffer)
1216
1220
"Go to LINE, counting from line 1 at beginning of buffer.
1217
1221
If called interactively, a numeric prefix argument specifies
@@ -1256,7 +1260,8 @@ rather than line counts."
1256
1260
"")))
1257
1261
;; Read the argument, offering that number (if any) as default.
1258
1262
(list (read-number (format "Goto line%s: " buffer-prompt)
1259
- (list default (line-number-at-pos)))
1263
+ (list default (line-number-at-pos))
1264
+ 'goto-line-history)
1260
1265
buffer))))
1261
1266
;; Switch to the desired buffer, one way or another.
1262
1267
(if buffer
Original file line number Diff line number Diff line change @@ -2518,10 +2518,15 @@ by doing (clear-string STRING)."
2518
2518
; ; And of course, don't keep the sensitive data around.
2519
2519
(erase-buffer ))))))))
2520
2520
2521
- (defun read-number (prompt &optional default )
2521
+ (defvar read-number-history nil
2522
+ " The default history for the `read-number' function." )
2523
+
2524
+ (defun read-number (prompt &optional default hist )
2522
2525
" Read a numeric value in the minibuffer, prompting with PROMPT.
2523
2526
DEFAULT specifies a default value to return if the user just types RET.
2524
2527
The value of DEFAULT is inserted into PROMPT.
2528
+ HIST specifies a history list variable. See `read-from-minibuffer'
2529
+ for details of the HIST argument.
2525
2530
This function is used by the `interactive' code letter `n' ."
2526
2531
(let ((n nil )
2527
2532
(default1 (if (consp default ) (car default ) default )))
@@ -2535,7 +2540,7 @@ This function is used by the `interactive' code letter `n'."
2535
2540
(while
2536
2541
(progn
2537
2542
(let ((str (read-from-minibuffer
2538
- prompt nil nil nil nil
2543
+ prompt nil nil nil ( or hist 'read-number-history )
2539
2544
(when default
2540
2545
(if (consp default )
2541
2546
(mapcar 'number-to-string (delq nil default ))
You can’t perform that action at this time.
0 commit comments