From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 36894@debbugs.gnu.org
Subject: bug#36894: Stability issues in frameset sorting
Date: Fri, 09 Aug 2019 21:09:17 +0300 [thread overview]
Message-ID: <87h86q8b3m.fsf@mail.linkov.net> (raw)
In-Reply-To: <83y305btde.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 07 Aug 2019 05:29:33 +0300")
>> Currently the desktop doesn't restore focus to the previously selected frame.
>
> Is this new in Emacs 27? Because I see no such problem in Emacs 26,
> where I use desktop all the time with multi-frame arrangements.
I tried to load in Emacs 26 the desktop created in Emacs 27,
but it crashed with this backtrace:
emacs_backtrace at emacs/src/sysdep.c:2413
terminate_due_to_signal at emacs/src/emacs.c:383
handle_fatal_signal at emacs/src/sysdep.c:1769
deliver_thread_signal at emacs/src/sysdep.c:1733
stack_overflow at emacs/src/sysdep.c:1819
(inlined by) handle_sigsegv at emacs/src/sysdep.c:1862
?? ??:0
?? ??:0
xftfont_encode_char at emacs/src/xftfont.c:557
get_char_glyph_code at emacs/src/xdisp.c:25797
(inlined by) x_produce_glyphs at emacs/src/xdisp.c:28169
produce_special_glyphs at emacs/src/xdisp.c:27805 (discriminator 9)
init_iterator at emacs/src/xdisp.c:2945
resize_mini_window at emacs/src/xdisp.c:11278
display_echo_area_1 at emacs/src/xdisp.c:11175
with_echo_area_buffer at emacs/src/xdisp.c:10955
display_echo_area at emacs/src/xdisp.c:11142
(inlined by) echo_area_display at emacs/src/xdisp.c:11647
message3_nolog at emacs/src/xdisp.c:10653
message3 at emacs/src/xdisp.c:10582
Fmessage at emacs/src/editfns.c:4029
Ffuncall at emacs/src/eval.c:2773
exec_byte_code at emacs/src/bytecode.c:630
Ffuncall at emacs/src/eval.c:2798
Fapply at emacs/src/eval.c:2395
apply1 at emacs/src/eval.c:2610
call_debugger at emacs/src/eval.c:345
signal_or_quit at emacs/src/eval.c:1617
Fsignal at emacs/src/eval.c:1518
xsignal1 at emacs/src/lisp.h:3854
verror at emacs/src/eval.c:1840
error at emacs/src/eval.c:1852
x_set_font at emacs/src/frame.c:4262
x_set_font_backend at emacs/src/frame.c:4396
x_set_frame_parameters at emacs/src/frame.c:3913
Fmodify_frame_parameters at emacs/src/frame.c:3177
funcall_subr at emacs/src/eval.c:2850
Ffuncall at emacs/src/eval.c:2773
exec_byte_code at emacs/src/bytecode.c:630
Ffuncall at emacs/src/eval.c:2798
exec_byte_code at emacs/src/bytecode.c:630
Ffuncall at emacs/src/eval.c:2798
exec_byte_code at emacs/src/bytecode.c:630
Ffuncall at emacs/src/eval.c:2798
Then replaced (font-backend xfthb x) with (font-backend xft x)
in the desktop file, after that it didn't crash, but raised
the error: (wrong-number-of-arguments #<subr set-window-fringes> 5)
Then replaced (fringes 8 8 nil nil) with (fringes 8 8 nil)
but it messed the monitors - restored frames in opposite monitors.
Then created a completely new desktop in Emacs 26,
but it didn't restore focus in the frame where it previously was.
And I don't see how Emacs 26 could restore focus,
because there is no 'last-focus-update' frame parameter in Emacs 26.
'last-focus-update' was added recently in Emacs 27.
So this is a new feature that we could use now in the desktop
to restore focus in the same frame where it was before.
> I'm wary of changing the order of restoring frames from what Emacs
> does now, because this could have adverse effects on some settings
> that are related to restoring frame dimensions.
I agree, looking at frameset--minibufferless-last-p it's difficult
to understand its logic, so I added comments to it.
Before my previous fix, despite the bug, the sorting order
was almost like intended in most cases: it still sorted
all minibuffer-owning frames before minibufferless.
Now I added more comments to explain the logic:
(pcase-let ((`(,hasmini1 . ,id-def1) (cdr (assq 'frameset--mini (car state1))))
(`(,hasmini2 . ,id-def2) (cdr (assq 'frameset--mini (car state2)))))
;; hasmini1 is t when 1st frame has its own minibuffer
;; hasmini2 is t when 2nd frame has its own minibuffer
;; id-def1 is t when 1st minibuffer-owning frame is the default-minibuffer-frame
;; or frame-id of 1st frame if it's minibufferless
;; id-def2 is t when 2nd minibuffer-owning frame is the default-minibuffer-frame
;; or frame-id of 2nd frame if it's minibufferless
(cond ;; Sort the minibuffer-owning default-minibuffer-frame first
((eq id-def1 t) t)
((eq id-def2 t) nil)
;; Sort non-default minibuffer-owning frames before minibufferless
((not (eq hasmini1 hasmini2)) (eq hasmini1 t)) ;; boolean xor
;; Sort minibufferless frames with frame-id before some remaining
((eq hasmini1 nil) (or id-def1 id-def2))
(t t)))
This shows that the intention was to restore minibuffer-owning frames before
minibufferless, and I agree that better not to change the sorting order,
because the last-selected frame might be the default-minibuffer-frame
(used by minibufferless frames) that should be created first.
So as a better solution we could restore the focus explicitly
after all frames are created.
next prev parent reply other threads:[~2019-08-09 18:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 21:34 bug#36894: Stability issues in frameset sorting Juri Linkov
2019-08-05 21:17 ` Juri Linkov
2019-08-06 15:14 ` Eli Zaretskii
2019-08-06 22:09 ` Juri Linkov
2019-08-07 2:29 ` Eli Zaretskii
2019-08-09 18:09 ` Juri Linkov [this message]
2019-08-09 19:04 ` Eli Zaretskii
2019-08-11 20:51 ` bug#36894: Restore frameset focus and selectedness Juri Linkov
2019-08-12 15:00 ` Eli Zaretskii
2019-08-13 21:29 ` Juri Linkov
2019-08-14 8:58 ` martin rudalics
2019-08-14 14:25 ` Eli Zaretskii
2019-08-14 20:50 ` Juri Linkov
2019-08-15 8:12 ` martin rudalics
2019-08-15 18:36 ` Juri Linkov
2019-08-15 19:37 ` Eli Zaretskii
2019-08-16 7:29 ` martin rudalics
2019-08-17 7:19 ` Eli Zaretskii
2019-08-17 8:24 ` martin rudalics
2019-08-17 10:12 ` Eli Zaretskii
2019-08-17 22:40 ` Juri Linkov
2019-08-19 7:38 ` martin rudalics
2019-08-14 20:49 ` Juri Linkov
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=87h86q8b3m.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=36894@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.