unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Chong Yidong" <cyd@stupidchicken.com>
Subject: Re: Electric-pop-up-window [PATCH]
Date: Sun, 2 Jan 2005 05:04:04 -0500 (EST)	[thread overview]
Message-ID: <2223.220.255.95.147.1104660244.squirrel@220.255.95.147> (raw)
In-Reply-To: <2201.220.255.95.147.1104659902.squirrel@220.255.95.147>

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

Oops, patch is attached.

> AFAICT, the fix suggested by SAITO Takuya in FOR-RELEASE is correct. It is
> quite a simple patch.
>
> ** line-spacing and Electric-pop-up-window
>
> From: SAITO Takuya <tabmore@rivo.mediatti.net>
> Date: Mon, 31 May 2004 02:08:10 +0900 (JST)
>
> Electric-pop-up-window does not work well
> if truncate long lines disabled and/or
> `line-spacing' is set to positive integer.
>
> For example, start emacs -Q --line-spacing 1, and type M-` .
> Then, the last line of *Completions* buffer is not visible.
>
> fit-window-to-buffer works well for me, so I guess
> Electric-pop-up-window can use it.

[-- Attachment #2: electric.patch --]
[-- Type: application/octet-stream, Size: 1408 bytes --]

--- electric.el~	2005-01-02 01:38:22.000000000 -0800
+++ electric.el	2005-01-02 01:43:23.000000000 -0800
@@ -142,35 +142,21 @@
 (defun Electric-pop-up-window (buffer &optional max-height)
   (let* ((win (or (get-buffer-window buffer) (selected-window)))
 	 (buf (get-buffer buffer))
 	 (one-window (one-window-p t))
 	 (pop-up-windows t)
-	 (pop-up-frames nil)
-	 (target-height)
-	 (lines))
+	 (pop-up-frames nil))
     (if (not buf)
 	(error "Buffer %s does not exist" buffer)
-      (with-current-buffer buf
-	(setq lines (count-lines (point-min) (point-max)))
-	(setq target-height
-	      (min (max (if max-height (min max-height (1+ lines)) (1+ lines))
-			window-min-height)
-		   (save-window-excursion
-		     (delete-other-windows)
-		     (1- (window-height (selected-window)))))))
       (cond ((and (eq (window-buffer win) buf))
 	     (select-window win))
 	    (one-window
 	     (pop-to-buffer buffer)
-	     (setq win (selected-window))
-	     (enlarge-window (- target-height (window-height win))))
+	     (setq win (selected-window)))
 	    (t
 	     (switch-to-buffer buf)))
-      (if (and (not max-height)
-	       (> target-height (window-height (selected-window))))
-	  (progn (goto-char (window-start win))
-		 (enlarge-window (- target-height (window-height win)))))
+      (fit-window-to-buffer win max-height)
       (goto-char (point-min))
       win)))
 
 (provide 'electric)
 

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2005-01-02 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-02  9:58 Electric-pop-up-window [PATCH] Chong Yidong
2005-01-02 10:04 ` Chong Yidong [this message]
2005-01-03  0:59   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2223.220.255.95.147.1104660244.squirrel@220.255.95.147 \
    --to=cyd@stupidchicken.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).