[Bug: 21.5-b28] [eshell-*grep] symbol's function definition is void: resize-tem-buffer-window

Jerry James james at xemacs.org
Thu Mar 6 15:18:05 EST 2008


On Wed, Feb 20, 2008 at 12:34 AM, FKtPp <m_pupil at yahoo.com.cn> wrote:
> ================================================================
>  Dear Bug Team!
>
>  While runing grep/fgrep in eshell mode, XEmacs warning me:
>
>  Symbol's function definition is void: resize-temp-buffer-window

Yes, we don't have this function.  Here's a patch to address this
problem, but I'm not happy with it for the following reasons:
- The missing function should not be defined in the eshell package,
but elsewhere.
- Where?
- This patch duplicates functionality that is already available via
temp-buffer-shrink-to-fit.
- My version calls resize-minibuffer-count-window-lines, which does
the right thing, but has a misleading name.  That function actually
counts the lines in *any* buffer (not window!).  It ought to be called
buffer-count-lines.  It also, in all of my tests so far, returns a
number exactly 1 smaller than it ought to be.  Gotta love off-by-one
errors....

Has anybody noticed that, although we define temp-buffer-max-height,
we don't actually *use* it anywhere?

packages source patch:
Diff command:   cvs -q diff -uN
Files affected: xemacs-packages/eshell/esh-maint.el
===================================================================
RCS xemacs-packages/eshell/Makefile
===================================================================
RCS

Index: xemacs-packages/eshell/Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/Makefile,v
retrieving revision 1.20
diff -u -u -r1.20 Makefile
--- xemacs-packages/eshell/Makefile	4 Sep 2007 11:19:06 -0000	1.20
+++ xemacs-packages/eshell/Makefile	6 Mar 2008 18:59:52 -0000
@@ -35,7 +35,7 @@

 DATA_FILES =
 DATA_DEST =
-EXTRA_SOURCES = esh-groups.el
+GENERATED_LISP = esh-groups.el

 STANDARD_DOCS = t

Index: xemacs-packages/eshell/esh-maint.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-maint.el,v
retrieving revision 1.1
diff -u -u -r1.1 esh-maint.el
--- xemacs-packages/eshell/esh-maint.el	10 Jan 2001 02:52:55 -0000	1.1
+++ xemacs-packages/eshell/esh-maint.el	6 Mar 2008 18:59:52 -0000
@@ -46,6 +46,27 @@
   (require 'cl)
   (setq cl-optimize-speed 9))

+(defun-when-void resize-temp-buffer-window ()
+  "Resize the selected window to fit its contents.
+Will not make it higher than `temp-buffer-max-height' nor smaller than
+`window-min-height'.  Do nothing if it is the only window on its frame, if it
+is not as wide as the frame or if some of the window's contents are scrolled
+out of view."
+  (let ((w (selected-window)))
+    ;; First try to make it smaller
+    (shrink-window-if-larger-than-buffer w)
+
+    ;; Next try to make it bigger
+    (when (and (not (one-window-p 'nomini))
+	       (pos-visible-in-window-p (point-min) w)
+	       (window-leftmost-p w)
+	       (window-rightmost-p w))
+      (let ((max-height (min (round (* (frame-height) temp-buffer-max-height))
+			     (resize-minibuffer-count-window-lines)))
+	    (cur-height (window-height w)))
+	(if (< cur-height max-height)
+	    (enlarge-window (- max-height cur-height) nil w))))))
+
 (defun eshell-generate-autoloads ()
   (interactive)
   (require 'autoload)

-- 
Jerry James
http://loganjerry.googlepages.com/



More information about the XEmacs-Beta mailing list