/[emacs]/emacs/lisp/ielm.el
ViewVC logotype

Diff of /emacs/lisp/ielm.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27 by miles, Mon Aug 19 05:03:38 2002 UTC revision 1.28 by rms, Wed Sep 18 16:01:43 2002 UTC
# Line 110  such as `edebug-defun' to work with such Line 110  such as `edebug-defun' to work with such
110  (defvar ielm-match-data nil  (defvar ielm-match-data nil
111    "Match data saved at the end of last command.")    "Match data saved at the end of last command.")
112    
113    (defvar ielm-*1 nil
114      "During IELM evaluation, most recent value evaluated in IELM.
115    Normally identical to `*'.  However, if the working buffer is an IELM
116    buffer, distinct from the process buffer, then `*' gives the value in
117    the working buffer, `*1' the value in the process buffer.  
118    The intended value is only accessible during IELM evaluation.")
119    
120    (defvar *2 nil
121      "During IELM evaluation, second-most-recent value evaluated in IELM.
122    Normally identical to `**'.  However, if the working buffer is an IELM
123    buffer, distinct from the process buffer, then `**' gives the value in
124    the working buffer, `*2' the value in the process buffer.
125    The intended value is only accessible during IELM evaluation.")
126    
127    (defvar *3 nil
128      "During IELM evaluation, third-most-recent value evaluated in IELM.
129    Normally identical to `***'.  However, if the working buffer is an IELM
130    buffer, distinct from the process buffer, then `***' gives the value in
131    the working buffer, `*3' the value in the process buffer.
132    The intended value is only accessible during IELM evaluation.")
133    
134  ;;; System variables  ;;; System variables
135    
136  (defvar ielm-working-buffer nil  (defvar ielm-working-buffer nil
# Line 299  simply inserts a newline." Line 320  simply inserts a newline."
320                        ielm-error-type "IELM Error"                        ielm-error-type "IELM Error"
321                        ielm-wbuf (current-buffer))                        ielm-wbuf (current-buffer))
322                (if (ielm-is-whitespace (substring ielm-string ielm-pos))                (if (ielm-is-whitespace (substring ielm-string ielm-pos))
323                    ;; need this awful let convolution to work around                    ;; To correctly handle the ielm-local variables *,
324                    ;; an Emacs bug involving local vbls and let binding                    ;; ** and ***, we need a temporary buffer to be
325                    (let ((*save *)                    ;; current at entry to the inner of the next two let
326                          (**save **)                    ;; forms.  We need another temporary buffer to exit
327                          (***save ***))                    ;; that same let.  To avoid problems, neither of
328                      ;; these buffers should be alive during the
329                      ;; evaluation of ielm-form.
330                      (let ((*1 *)
331                            (*2 **)
332                            (*3 ***)
333                            ielm-temp-buffer)
334                      (set-match-data ielm-match-data)                      (set-match-data ielm-match-data)
335                      (save-excursion                      (save-excursion
336                        (set-buffer ielm-working-buffer)                        (with-temp-buffer
337                        (condition-case err                          (condition-case err
338                            (let ((* *save)                              (unwind-protect
339                                  (** **save)                                  ;; The next let form creates default
340                                  (*** ***save)                                  ;; bindings for *, ** and ***.  But
341                                  (ielm-obuf (current-buffer)))                                  ;; these default bindings are
342                              (setq ielm-result (eval ielm-form))                                  ;; identical to the ielm-local
343                              (setq ielm-wbuf (current-buffer))                                  ;; bindings.  Hence, during the
344                              ;; The eval may have changed current-buffer;                                  ;; evaluation of ielm-form, the
345                              ;; need to set it back here to avoid a bug                                  ;; ielm-local values are going to be
346                              ;; in let.  Don't want to use save-excursion                                  ;; used in all buffers except for
347                              ;; because we want to allow changes in point.                                  ;; other ielm buffers, which override
348                              (set-buffer ielm-obuf))                                  ;; them.  Normally, the variables *1,
349                          (error (setq ielm-result (error-message-string err))                                  ;; *2 and *3 also have default
350                                 (setq ielm-error-type "Eval error"))                                  ;; bindings, which are not overridden.
351                          (quit (setq ielm-result "Quit during evaluation")                                  (let ((* *1)
352                                (setq ielm-error-type "Eval error"))))                                        (** *2)
353                                          (*** *3))
354                                      (kill-buffer (current-buffer))
355                                      (set-buffer ielm-wbuf)
356                                      (setq ielm-result (eval ielm-form))
357                                      (setq ielm-wbuf (current-buffer))
358                                      (setq
359                                       ielm-temp-buffer
360                                       (generate-new-buffer " *ielm-temp*"))
361                                      (set-buffer ielm-temp-buffer))
362                                  (when ielm-temp-buffer
363                                    (kill-buffer ielm-temp-buffer)))
364                              (error (setq ielm-result (ielm-format-error err))
365                                     (setq ielm-error-type "Eval error"))
366                              (quit (setq ielm-result "Quit during evaluation")
367                                    (setq ielm-error-type "Eval error")))))
368                      (setq ielm-match-data (match-data)))                      (setq ielm-match-data (match-data)))
369                  (setq ielm-error-type "IELM error")                  (setq ielm-error-type "IELM error")
370                  (setq ielm-result "More than one sexp in input"))))                  (setq ielm-result "More than one sexp in input"))))
# Line 388  Uses the interface provided by `comint-m Line 430  Uses the interface provided by `comint-m
430  * \\[comint-dynamic-complete] completes Lisp symbols (or filenames, within strings),  * \\[comint-dynamic-complete] completes Lisp symbols (or filenames, within strings),
431    or indents the line if there is nothing to complete.    or indents the line if there is nothing to complete.
432    
 During evaluations, the values of the variables `*', `**', and `***'  
 are the results of the previous, second previous and third previous  
 evaluations respectively.  
   
433  The current working buffer may be changed (with a call to  The current working buffer may be changed (with a call to
434  `set-buffer', or with \\[ielm-change-working-buffer]), and its value  `set-buffer', or with \\[ielm-change-working-buffer]), and its value
435  is preserved between successive evaluations.  In this way, expressions  is preserved between successive evaluations.  In this way, expressions
# Line 399  may be evaluated in a different buffer t Line 437  may be evaluated in a different buffer t
437  Display the name of the working buffer with \\[ielm-print-working-buffer],  Display the name of the working buffer with \\[ielm-print-working-buffer],
438  or the buffer itself with \\[ielm-display-working-buffer].  or the buffer itself with \\[ielm-display-working-buffer].
439    
440    During evaluations, the values of the variables `*', `**', and `***'
441    are the results of the previous, second previous and third previous
442    evaluations respectively.  If the working buffer is another IELM
443    buffer, then the values in the working buffer are used.  The variables
444    `*1', `*2' and `*3', yield the process buffer values.
445    
446  Expressions evaluated by IELM are not subject to `debug-on-quit' or  Expressions evaluated by IELM are not subject to `debug-on-quit' or
447  `debug-on-error'.  `debug-on-error'.
448    
# Line 438  Customised bindings may be defined in `i Line 482  Customised bindings may be defined in `i
482    (setq fill-paragraph-function 'lisp-fill-paragraph)    (setq fill-paragraph-function 'lisp-fill-paragraph)
483    
484    ;; Value holders    ;; Value holders
   (setq * nil)  
485    (make-local-variable '*)    (make-local-variable '*)
486    (setq ** nil)    (setq * nil)
487    (make-local-variable '**)    (make-local-variable '**)
488    (setq *** nil)    (setq ** nil)
489    (make-local-variable '***)    (make-local-variable '***)
490      (setq *** nil)
491    (set (make-local-variable 'ielm-match-data) nil)    (set (make-local-variable 'ielm-match-data) nil)
492    
493    ;; font-lock support    ;; font-lock support

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26