aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-08-29 04:35:38 +0000
committerRichard M. Stallman1996-08-29 04:35:38 +0000
commit77aa8edfb641b58ed7e10f1484f32a78dab49f76 (patch)
tree89989b8eb779e1fdafb8b0c8f23841b79e749531 /src
parent21fbc8e5aec8803e1cd19c8c0eb7f5bae8df2ae4 (diff)
downloademacs-77aa8edfb641b58ed7e10f1484f32a78dab49f76.tar.gz
emacs-77aa8edfb641b58ed7e10f1484f32a78dab49f76.zip
(Vhistory_length, Qhistory_length): New variables.
(syms_of_minibuf): Register and initialise these. (read_minibuf): Truncate history list if needed.
Diffstat (limited to 'src')
-rw-r--r--src/minibuf.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 0d107f97b1b..35f562fa0e5 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -46,9 +46,12 @@ Lisp_Object minibuf_save_list;
46/* Depth in minibuffer invocations. */ 46/* Depth in minibuffer invocations. */
47int minibuf_level; 47int minibuf_level;
48 48
49/* Nonzero means display completion help for invalid input */ 49/* Nonzero means display completion help for invalid input. */
50int auto_help; 50int auto_help;
51 51
52/* The maximum length of a minibuffer history. */
53Lisp_Object Qhistory_length, Vhistory_length;
54
52/* Fread_minibuffer leaves the input here as a string. */ 55/* Fread_minibuffer leaves the input here as a string. */
53Lisp_Object last_minibuf_string; 56Lisp_Object last_minibuf_string;
54 57
@@ -356,8 +359,27 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
356 if (NILP (histval) 359 if (NILP (histval)
357 || (CONSP (histval) 360 || (CONSP (histval)
358 && NILP (Fequal (last_minibuf_string, Fcar (histval))))) 361 && NILP (Fequal (last_minibuf_string, Fcar (histval)))))
359 Fset (Vminibuffer_history_variable, 362 {
360 Fcons (last_minibuf_string, histval)); 363 Lisp_Object length;
364
365 histval = Fcons (last_minibuf_string, histval);
366 Fset (Vminibuffer_history_variable, histval);
367
368 /* Truncate if requested. */
369 length = Fget (Vminibuffer_history_variable, Qhistory_length);
370 if (NILP (length)) length = Vhistory_length;
371 if (INTEGERP (length)) {
372 if (XINT (length) <= 0)
373 Fset (Vminibuffer_history_variable, Qnil);
374 else
375 {
376 Lisp_Object temp;
377
378 temp = Fnthcdr (Fsub1 (length), histval);
379 if (CONSP (temp)) Fsetcdr (temp, Qnil);
380 }
381 }
382 }
361 } 383 }
362 384
363 /* If Lisp form desired instead of string, parse it. */ 385 /* If Lisp form desired instead of string, parse it. */
@@ -1794,6 +1816,9 @@ syms_of_minibuf ()
1794 Qminibuffer_exit_hook = intern ("minibuffer-exit-hook"); 1816 Qminibuffer_exit_hook = intern ("minibuffer-exit-hook");
1795 staticpro (&Qminibuffer_exit_hook); 1817 staticpro (&Qminibuffer_exit_hook);
1796 1818
1819 Qhistory_length = intern ("history-length");
1820 staticpro (&Qhistory_length);
1821
1797 DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook, 1822 DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook,
1798 "Normal hook run just after entry to minibuffer."); 1823 "Normal hook run just after entry to minibuffer.");
1799 Vminibuffer_setup_hook = Qnil; 1824 Vminibuffer_setup_hook = Qnil;
@@ -1802,6 +1827,13 @@ syms_of_minibuf ()
1802 "Normal hook run just after exit from minibuffer."); 1827 "Normal hook run just after exit from minibuffer.");
1803 Vminibuffer_exit_hook = Qnil; 1828 Vminibuffer_exit_hook = Qnil;
1804 1829
1830 DEFVAR_LISP ("history-length", &Vhistory_length,
1831 "*Maximum length for history lists before truncation takes place.\n\
1832A number means that length; t means infinite. Truncation takes place\n\
1833just after a new element is inserted. Setting the history-length\n\
1834property of a history variable overrides this default.");
1835 XSETFASTINT (Vhistory_length, 30);
1836
1805 DEFVAR_BOOL ("completion-auto-help", &auto_help, 1837 DEFVAR_BOOL ("completion-auto-help", &auto_help,
1806 "*Non-nil means automatically provide help for invalid completion input."); 1838 "*Non-nil means automatically provide help for invalid completion input.");
1807 auto_help = 1; 1839 auto_help = 1;