diff options
| author | Karl Heuer | 1994-10-18 03:05:34 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-10-18 03:05:34 +0000 |
| commit | 3ab141767aff434763d7ea0b0d69d231fb6321ec (patch) | |
| tree | 3b274f6d0458991e03f96e171a3d943b2016d271 /src | |
| parent | 332ad7ce48d611a232ddd085331b1069637d85a1 (diff) | |
| download | emacs-3ab141767aff434763d7ea0b0d69d231fb6321ec.tar.gz emacs-3ab141767aff434763d7ea0b0d69d231fb6321ec.zip | |
(read_minibuf): Store the object, not the string, into the history variable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 7d1721fa4bf..d63ed473161 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -111,11 +111,11 @@ Lisp_Object read_minibuf (); | |||
| 111 | with initial position HISTPOS. (BACKUP_N should be <= 0.) | 111 | with initial position HISTPOS. (BACKUP_N should be <= 0.) |
| 112 | 112 | ||
| 113 | Normally return the result as a string (the text that was read), | 113 | Normally return the result as a string (the text that was read), |
| 114 | but if EXPFLAG is non-nil, read it and return the object read. | 114 | but if EXPFLAG is nonzero, read it and return the object read. |
| 115 | If HISTVAR is given, save the value read on that history only if it doesn't | 115 | If HISTVAR is given, save the value read on that history only if it doesn't |
| 116 | match the front of that history list exactly. The value is pushed onto | 116 | match the front of that history list exactly. The value is pushed onto |
| 117 | the list as the string that was read, or as the object that resulted iff | 117 | the list as the string that was read, or as the object that resulted iff |
| 118 | EXPFLAG is non-nil. */ | 118 | EXPFLAG is nonzero. */ |
| 119 | 119 | ||
| 120 | Lisp_Object | 120 | Lisp_Object |
| 121 | read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) | 121 | read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) |
| @@ -269,25 +269,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) | |||
| 269 | /* VAL is the string of minibuffer text. */ | 269 | /* VAL is the string of minibuffer text. */ |
| 270 | last_minibuf_string = val; | 270 | last_minibuf_string = val; |
| 271 | 271 | ||
| 272 | /* Add the value to the appropriate history list unless it is empty. */ | ||
| 273 | if (XSTRING (val)->size != 0 | ||
| 274 | && SYMBOLP (Vminibuffer_history_variable) | ||
| 275 | && ! EQ (XSYMBOL (Vminibuffer_history_variable)->value, Qunbound)) | ||
| 276 | { | ||
| 277 | /* If the caller wanted to save the value read on a history list, | ||
| 278 | then do so if the value is not already the front of the list. */ | ||
| 279 | Lisp_Object histval; | ||
| 280 | histval = Fsymbol_value (Vminibuffer_history_variable); | ||
| 281 | |||
| 282 | /* The value of the history variable must be a cons or nil. Other | ||
| 283 | values are unacceptable. We silently ignore these values. */ | ||
| 284 | if (NILP (histval) | ||
| 285 | || (CONSP (histval) | ||
| 286 | && NILP (Fequal (last_minibuf_string, Fcar (histval))))) | ||
| 287 | Fset (Vminibuffer_history_variable, | ||
| 288 | Fcons (last_minibuf_string, histval)); | ||
| 289 | } | ||
| 290 | |||
| 291 | /* If Lisp form desired instead of string, parse it. */ | 272 | /* If Lisp form desired instead of string, parse it. */ |
| 292 | if (expflag) | 273 | if (expflag) |
| 293 | { | 274 | { |
| @@ -302,6 +283,23 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) | |||
| 302 | val = Fcar (expr_and_pos); | 283 | val = Fcar (expr_and_pos); |
| 303 | } | 284 | } |
| 304 | 285 | ||
| 286 | /* Add the value to the appropriate history list unless it is empty. */ | ||
| 287 | if (XSTRING (last_minibuf_string)->size != 0 | ||
| 288 | && SYMBOLP (Vminibuffer_history_variable) | ||
| 289 | && ! EQ (XSYMBOL (Vminibuffer_history_variable)->value, Qunbound)) | ||
| 290 | { | ||
| 291 | /* If the caller wanted to save the value read on a history list, | ||
| 292 | then do so if the value is not already the front of the list. */ | ||
| 293 | Lisp_Object histval; | ||
| 294 | histval = Fsymbol_value (Vminibuffer_history_variable); | ||
| 295 | |||
| 296 | /* The value of the history variable must be a cons or nil. Other | ||
| 297 | values are unacceptable. We silently ignore these values. */ | ||
| 298 | if (NILP (histval) | ||
| 299 | || (CONSP (histval) && NILP (Fequal (val, XCONS (histval)->car)))) | ||
| 300 | Fset (Vminibuffer_history_variable, Fcons (val, histval)); | ||
| 301 | } | ||
| 302 | |||
| 305 | return unbind_to (count, val); /* The appropriate frame will get selected | 303 | return unbind_to (count, val); /* The appropriate frame will get selected |
| 306 | in set-window-configuration. */ | 304 | in set-window-configuration. */ |
| 307 | } | 305 | } |