all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Gramiak <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 35272@debbugs.gnu.org
Subject: bug#35272: [PATCH] * lisp/frame.el (frame--size-history): Fix infloop.
Date: Sun, 14 Apr 2019 10:25:42 -0600	[thread overview]
Message-ID: <8736mkv9ix.fsf@gmail.com> (raw)
In-Reply-To: <83zhosine1.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 14 Apr 2019 19:04:38 +0300")

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Gramiak <agrambot@gmail.com>
>> Date: Sun, 14 Apr 2019 09:37:10 -0600
>> 
>> frame-size-history can be nil, which resulted in an infloop.
>> 
>> >From 5695525ed1477e908536d159da670f0f1ab4a369 Mon Sep 17 00:00:00 2001
>> From: Alexander Gramiak <agrambot@gmail.com>
>> Date: Sun, 14 Apr 2019 09:27:50 -0600
>> Subject: [PATCH] * lisp/frame.el (frame--size-history): Fix infloop.
>> 
>> ---
>>  lisp/frame.el | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/lisp/frame.el b/lisp/frame.el
>> index b5c936a51e..6f9e769e16 100644
>> --- a/lisp/frame.el
>> +++ b/lisp/frame.el
>> @@ -1610,7 +1610,7 @@ frame--size-history
>>      (with-current-buffer (get-buffer-create "*frame-size-history*")
>>        (erase-buffer)
>>        (insert (format "Frame size history of %s\n" frame))
>> -      (while (listp (setq entry (pop history)))
>> +      (while (consp (setq entry (pop history)))
>>  	(when (eq (car entry) frame)
>>            (pop entry)
>>            (insert (format "%s" (pop entry)))
>
> Thanks.
>
> But wouldn't it be better to special-case the nil value, and display
> something to that effect, instead of just nothing after the header?

I suppose so. Here's a version which does that:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: infloop --]
[-- Type: text/x-patch, Size: 1241 bytes --]

From 2231442f515514480a2cfcedc96972dbbe3e93e7 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sun, 14 Apr 2019 09:27:50 -0600
Subject: [PATCH] * lisp/frame.el (frame--size-history): Fix infloop.
 (Bug#35272)

---
 lisp/frame.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index b5c936a51e..a4a597af02 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1610,14 +1610,16 @@ frame--size-history
     (with-current-buffer (get-buffer-create "*frame-size-history*")
       (erase-buffer)
       (insert (format "Frame size history of %s\n" frame))
-      (while (listp (setq entry (pop history)))
+      (while (consp (setq entry (pop history)))
 	(when (eq (car entry) frame)
           (pop entry)
           (insert (format "%s" (pop entry)))
           (move-to-column 24 t)
           (while entry
             (insert (format " %s" (pop entry))))
-          (insert "\n"))))))
+          (insert "\n")))
+      (when (null frame-size-history)
+        (insert "No frame size history available.\n")))))
 
 (declare-function x-frame-edges "xfns.c" (&optional frame type))
 (declare-function w32-frame-edges "w32fns.c" (&optional frame type))
-- 
2.21.0


  reply	other threads:[~2019-04-14 16:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14 15:37 bug#35272: [PATCH] * lisp/frame.el (frame--size-history): Fix infloop Alex Gramiak
2019-04-14 16:04 ` Eli Zaretskii
2019-04-14 16:25   ` Alex Gramiak [this message]
2019-04-14 16:33     ` Basil L. Contovounesios
2019-04-14 17:43       ` Alex Gramiak
2019-04-14 18:21         ` Eli Zaretskii
2019-04-14 16:35     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=8736mkv9ix.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=35272@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.