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
645645@code {read-variable }.
646646@end defvar
647647
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+
648657@c Less common: coding-system-history, input-method-history,
649658@c command-history, grep-history, grep-find-history,
650659@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.
6565You should have received a copy of the GNU General Public License
6666along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
6767
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+
6879
6980Local variables:
7081coding: utf-8
Original file line number Diff line number Diff line change @@ -1212,6 +1212,10 @@ that uses or sets the mark."
12121212
12131213;; Counting lines, one way or another.
12141214
1215+ (defvar goto-line-history nil
1216+ "History of values entered with `goto-line'.")
1217+ (make-variable-buffer-local 'goto-line-history)
1218+
12151219(defun goto-line (line &optional buffer)
12161220 "Go to LINE, counting from line 1 at beginning of buffer.
12171221If called interactively, a numeric prefix argument specifies
@@ -1256,7 +1260,8 @@ rather than line counts."
12561260 "")))
12571261 ;; Read the argument, offering that number (if any) as default.
12581262 (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)
12601265 buffer))))
12611266 ;; Switch to the desired buffer, one way or another.
12621267 (if buffer
Original file line number Diff line number Diff line change @@ -2518,10 +2518,15 @@ by doing (clear-string STRING)."
25182518 ; ; And of course, don't keep the sensitive data around.
25192519 (erase-buffer ))))))))
25202520
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 )
25222525 " Read a numeric value in the minibuffer, prompting with PROMPT.
25232526DEFAULT specifies a default value to return if the user just types RET.
25242527The 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.
25252530This function is used by the `interactive' code letter `n' ."
25262531 (let ((n nil )
25272532 (default1 (if (consp default ) (car default ) default )))
@@ -2535,7 +2540,7 @@ This function is used by the `interactive' code letter `n'."
25352540 (while
25362541 (progn
25372542 (let ((str (read-from-minibuffer
2538- prompt nil nil nil nil
2543+ prompt nil nil nil ( or hist 'read-number-history )
25392544 (when default
25402545 (if (consp default )
25412546 (mapcar 'number-to-string (delq nil default ))
You can’t perform that action at this time.
0 commit comments