emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103868: Remove internal_with_output_


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103868: Remove internal_with_output_to_temp_buffer, replacing sole user with Lisp.
Date: Fri, 08 Apr 2011 11:37:15 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103868
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Fri 2011-04-08 11:37:15 -0400
message:
  Remove internal_with_output_to_temp_buffer, replacing sole user with Lisp.
  
  * lisp/help.el (help-form-show): New function, to be called from C.
  Put help-form output in a buffer named differently than *Help*.
  
  * src/keyboard.c (read_char): Call Lisp function help-form-show,
  instead of using internal_with_output_to_temp_buffer.
  (Qhelp_form_show): New var.
  
  * src/lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
  
  * src/print.c (internal_with_output_to_temp_buffer): Function deleted.
modified:
  lisp/ChangeLog
  lisp/help.el
  src/ChangeLog
  src/keyboard.c
  src/lisp.h
  src/print.c
  src/window.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-08 15:31:33 +0000
+++ b/lisp/ChangeLog    2011-04-08 15:37:15 +0000
@@ -1,3 +1,8 @@
+2011-04-08  Chong Yidong  <address@hidden>
+
+       * help.el (help-form-show): New function, to be called from C.
+       Put help-form output in a buffer named differently than *Help*.
+
 2011-04-08  Eli Zaretskii  <address@hidden>
 
        * files.el (file-size-human-readable): New function.

=== modified file 'lisp/help.el'
--- a/lisp/help.el      2011-03-13 01:57:40 +0000
+++ b/lisp/help.el      2011-04-08 15:37:15 +0000
@@ -1256,6 +1256,15 @@
        ;; Reset `help-window' to nil to avoid confusing future calls of
        ;; `help-mode-finish' with plain `with-output-to-temp-buffer'.
        (setq help-window nil))))
+
+;; Called from C, on encountering `help-char' when reading a char.
+;; Don't print to *Help*; that would clobber Help history.
+(defun help-form-show ()
+  "Display the output of a non-nil `help-form'."
+  (let ((msg (eval help-form)))
+    (if (stringp msg)
+       (with-output-to-temp-buffer " *Char Help*"
+         (princ msg)))))
 
 (provide 'help)
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-04-06 21:55:08 +0000
+++ b/src/ChangeLog     2011-04-08 15:37:15 +0000
@@ -1,3 +1,13 @@
+2011-04-08  Chong Yidong  <address@hidden>
+
+       * keyboard.c (read_char): Call Lisp function help-form-show,
+       instead of using internal_with_output_to_temp_buffer.
+       (Qhelp_form_show): New var.
+
+       * print.c (internal_with_output_to_temp_buffer): Function deleted.
+
+       * lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
+
 2011-04-06  Chong Yidong  <address@hidden>
 
        * process.c (Flist_processes): Removed to Lisp.

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2011-04-05 06:45:27 +0000
+++ b/src/keyboard.c    2011-04-08 15:37:15 +0000
@@ -260,6 +260,8 @@
 Lisp_Object Qinput_method_exit_on_first_char;
 Lisp_Object Qinput_method_use_echo_area;
 
+Lisp_Object Qhelp_form_show;
+
 /* File in which we write all commands we read.  */
 FILE *dribble;
 
@@ -3095,10 +3097,7 @@
        = Fcons (Fcurrent_window_configuration (Qnil),
                 help_form_saved_window_configs);
       record_unwind_protect (read_char_help_form_unwind, Qnil);
-
-      tem0 = Feval (Vhelp_form, Qnil);
-      if (STRINGP (tem0))
-       internal_with_output_to_temp_buffer ("*Help*", print_help, tem0);
+      call0 (Qhelp_form_show);
 
       cancel_echoing ();
       do
@@ -11602,6 +11601,9 @@
   Qinput_method_use_echo_area = intern_c_string ("input-method-use-echo-area");
   staticpro (&Qinput_method_use_echo_area);
 
+  Qhelp_form_show = intern_c_string ("help-form-show");
+  staticpro (&Qhelp_form_show);
+
   Fset (Qinput_method_exit_on_first_char, Qnil);
   Fset (Qinput_method_use_echo_area, Qnil);
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2011-04-06 04:58:58 +0000
+++ b/src/lisp.h        2011-04-08 15:37:15 +0000
@@ -2775,8 +2775,6 @@
 extern void write_string (const char *, int);
 extern void print_error_message (Lisp_Object, Lisp_Object, const char *,
                                 Lisp_Object);
-extern Lisp_Object internal_with_output_to_temp_buffer
-        (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
 #define FLOAT_TO_STRING_BUFSIZE 350
 extern void float_to_string (char *, double);
 extern void syms_of_print (void);

=== modified file 'src/print.c'
--- a/src/print.c       2011-04-04 06:52:29 +0000
+++ b/src/print.c       2011-04-08 15:37:15 +0000
@@ -520,29 +520,6 @@
 
   specbind (Qstandard_output, buf);
 }
-
-/* FIXME: Use Lisp's with-output-to-temp-buffer instead!  */
-Lisp_Object
-internal_with_output_to_temp_buffer (const char *bufname, Lisp_Object 
(*function) (Lisp_Object), Lisp_Object args)
-{
-  int count = SPECPDL_INDEX ();
-  Lisp_Object buf, val;
-  struct gcpro gcpro1;
-
-  GCPRO1 (args);
-  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
-  temp_output_buffer_setup (bufname);
-  buf = Vstandard_output;
-  UNGCPRO;
-
-  val = (*function) (args);
-
-  GCPRO1 (val);
-  temp_output_buffer_show (buf);
-  UNGCPRO;
-
-  return unbind_to (count, val);
-}
 
 static void print (Lisp_Object obj, register Lisp_Object printcharfun, int 
escapeflag);
 static void print_preprocess (Lisp_Object obj);

=== modified file 'src/window.c'
--- a/src/window.c      2011-04-01 17:19:52 +0000
+++ b/src/window.c      2011-04-08 15:37:15 +0000
@@ -3664,9 +3664,6 @@
   BEGV = BEG;
   ZV = Z;
   SET_PT (BEG);
-#if 0  /* rms: there should be no reason for this.  */
-  XBUFFER (buf)->prevent_redisplay_optimizations_p = 1;
-#endif
   set_buffer_internal (old);
 
   if (!NILP (Vtemp_buffer_show_function))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]