diff options
| author | Richard M. Stallman | 2003-05-17 15:53:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-05-17 15:53:12 +0000 |
| commit | 4f9f637a5b1d30726d26f3ed4ad12a335af4ea56 (patch) | |
| tree | 53b80096b9d2b9f1cf6276ef389988425cdafe5b /src | |
| parent | fdf91be0320d1ff17fe20ac924bd55474b5132ec (diff) | |
| download | emacs-4f9f637a5b1d30726d26f3ed4ad12a335af4ea56.tar.gz emacs-4f9f637a5b1d30726d26f3ed4ad12a335af4ea56.zip | |
(read_minibuf): If buffer is empty, record the default in the history.
(Fminibuffer_complete_word): When deleting the overlap, take account
of its real position.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/minibuf.c | 28 |
2 files changed, 28 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ae5f2d339a2..8d5073eec83 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2003-05-17 Richard M. Stallman <rms@gnu.org> | 1 | 2003-05-17 Richard M. Stallman <rms@gnu.org> |
| 2 | 2 | ||
| 3 | * minibuf.c (read_minibuf): If buffer is empty, record the default | ||
| 4 | in the history. | ||
| 5 | (Fminibuffer_complete_word): When deleting the overlap, take account | ||
| 6 | of its real position. | ||
| 7 | |||
| 8 | * fns.c (map_char_table): Fix previous change. | ||
| 9 | |||
| 3 | * syntax.c (find_defun_start): | 10 | * syntax.c (find_defun_start): |
| 4 | When open_paren_in_column_0_is_defun_start, | 11 | When open_paren_in_column_0_is_defun_start, |
| 5 | return beginning of buffer. | 12 | return beginning of buffer. |
diff --git a/src/minibuf.c b/src/minibuf.c index 667f944ab6a..417e023469d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -415,7 +415,7 @@ minibuffer_completion_contents () | |||
| 415 | match the front of that history list exactly. The value is pushed onto | 415 | match the front of that history list exactly. The value is pushed onto |
| 416 | the list as the string that was read. | 416 | the list as the string that was read. |
| 417 | 417 | ||
| 418 | DEFALT specifies te default value for the sake of history commands. | 418 | DEFALT specifies the default value for the sake of history commands. |
| 419 | 419 | ||
| 420 | If ALLOW_PROPS is nonzero, we do not throw away text properties. | 420 | If ALLOW_PROPS is nonzero, we do not throw away text properties. |
| 421 | 421 | ||
| @@ -441,6 +441,10 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 441 | Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; | 441 | Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; |
| 442 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 442 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 443 | Lisp_Object enable_multibyte; | 443 | Lisp_Object enable_multibyte; |
| 444 | |||
| 445 | /* String to add to the history. */ | ||
| 446 | Lisp_Object histstring; | ||
| 447 | |||
| 444 | extern Lisp_Object Qfront_sticky; | 448 | extern Lisp_Object Qfront_sticky; |
| 445 | extern Lisp_Object Qrear_nonsticky; | 449 | extern Lisp_Object Qrear_nonsticky; |
| 446 | 450 | ||
| @@ -675,9 +679,17 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 675 | 679 | ||
| 676 | last_minibuf_string = val; | 680 | last_minibuf_string = val; |
| 677 | 681 | ||
| 678 | /* Add the value to the appropriate history list unless it is empty. */ | 682 | /* Choose the string to add to the history. */ |
| 679 | if (SCHARS (val) != 0 | 683 | if (SCHARS (val) != 0) |
| 680 | && SYMBOLP (Vminibuffer_history_variable)) | 684 | histstring = val; |
| 685 | else if (STRINGP (defalt)) | ||
| 686 | histstring = defalt; | ||
| 687 | else | ||
| 688 | histstring = Qnil; | ||
| 689 | |||
| 690 | /* Add the value to the appropriate history list, if any. */ | ||
| 691 | if (SYMBOLP (Vminibuffer_history_variable) | ||
| 692 | && !NILP (histstring)) | ||
| 681 | { | 693 | { |
| 682 | /* If the caller wanted to save the value read on a history list, | 694 | /* If the caller wanted to save the value read on a history list, |
| 683 | then do so if the value is not already the front of the list. */ | 695 | then do so if the value is not already the front of the list. */ |
| @@ -691,13 +703,15 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 691 | 703 | ||
| 692 | /* The value of the history variable must be a cons or nil. Other | 704 | /* The value of the history variable must be a cons or nil. Other |
| 693 | values are unacceptable. We silently ignore these values. */ | 705 | values are unacceptable. We silently ignore these values. */ |
| 706 | |||
| 694 | if (NILP (histval) | 707 | if (NILP (histval) |
| 695 | || (CONSP (histval) | 708 | || (CONSP (histval) |
| 696 | && NILP (Fequal (last_minibuf_string, Fcar (histval))))) | 709 | /* Don't duplicate the most recent entry in the history. */ |
| 710 | && NILP (Fequal (histstring, Fcar (histval))))) | ||
| 697 | { | 711 | { |
| 698 | Lisp_Object length; | 712 | Lisp_Object length; |
| 699 | 713 | ||
| 700 | histval = Fcons (last_minibuf_string, histval); | 714 | histval = Fcons (histstring, histval); |
| 701 | Fset (Vminibuffer_history_variable, histval); | 715 | Fset (Vminibuffer_history_variable, histval); |
| 702 | 716 | ||
| 703 | /* Truncate if requested. */ | 717 | /* Truncate if requested. */ |
| @@ -2058,7 +2072,7 @@ Return nil if there is no valid completion, else t. */) | |||
| 2058 | i++; | 2072 | i++; |
| 2059 | buffer_nchars--; | 2073 | buffer_nchars--; |
| 2060 | } | 2074 | } |
| 2061 | del_range (1, i + 1); | 2075 | del_range (start_pos, start_pos + buffer_nchars); |
| 2062 | } | 2076 | } |
| 2063 | UNGCPRO; | 2077 | UNGCPRO; |
| 2064 | } | 2078 | } |