unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Freezing frameset-restore
Date: Mon, 10 Mar 2014 10:19:04 -0400	[thread overview]
Message-ID: <jwvpplub17s.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAAeL0SSuhj+REAMwmf+w503AGTWO5to7wYOvVr0PP4463qrcYQ@mail.gmail.com> (Juanma Barranquero's message of "Mon, 10 Mar 2014 06:26:43 +0100")

>> - I prefer it when keywords are used only for the argument names and not
>> for their values, so you don't need to count them to know which
>> is which.  So I'd favor using `all', `none', and `match'.  Tho that
>> slightly clashes with the PRED case.  So I'd then suggest to rename
>> `all' to t, `none' to nil, and to get rid of `match' (i.e. use the
>> PRED case for it, probably providing a handy function for it).
> I'd like to avoid this, if possible. I happen to really like keywords
> as argument values, instead of normal symbols,

I'm not opposed to keywords as arguments in general:  I'm opposed to
them when the argument is itself specified via a keyword.

I.e. for a given function call, the keywords should either all be actual
arguments passed positionally or they should all be "argument names".

> deletion / frame creation), but your change makes none (nil) the
> default.

This choice is not based on an estimate of which case will be more
common, but rather I think that given the argument name ":reuse-frames"
a nil value which says "don't reuse any frames" is more intuitive than
one that says "reuse all frames".  Hence the change.

>> Maybe a hash-table would be better than an alist.  This would save us
>> from the hideous cl-acons/assq-delete-all.
> Funnily enough, my previous patch *used* a hash table.  I changed it
> to an alist to avoid having to build the action-map list at the end.
> But I certainly prefer the hash table, so I'll revert that part of
> the change.

Don't convert to an alist at the end: just return the hashtable.

>> Allowing a list of actions is over-engineering it.
> Except that the presumably common case of deleting all non-restored is
> '(((:ignored :rejected) delete-frame)), which seems nicer than
> '((:ignored . delete-frame) (:rejected . delete-frame)).  But I can
> change it if you feel strongly against it.

Again, we're talking about very few callers.  You want the code to be as
simple as possible, since the rare callers can pay the extra price, if needed.

> I'm no fan of frameset-restore-cleanup (I much preferred having a
> CLEANUP argument, because separating this from frameset-restore seems
> to me to make an artificial distinction between two phases of the same
> process, which is, to restore a frameset),

It's only artificial in your mind: the code already did it in two phases
(just within the same function).

> but I'm still less fan of the code you propose, which even uses an
> undocumented macro (pcase-dolist ;-).

Once you change the code to return a hashtable, pcase-dolist will be
replaced with maphash anyway ;-)

> Doing it your way means repeating some logic, like the error checking,
> at each point of call of frameset-restore (yes, there's currently only
> two uses, but I'm designing this thinking that some other uses will be
> found).

That's pretty close to the definition of over-engineering.
Personally, I'd just ditch frameset-restore-cleanup.

> the cleanup is called before checking whether there's still at least
> one visible frame, while with your proposal, it is possible for the
> cleanup code to do something to all visible frames and leave only
> non-visible ones.

Aha!  Can you expand on this?  What do you mean exactly by
"non-visible"?


        Stefan



  parent reply	other threads:[~2014-03-10 14:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06  0:03 Freezing frameset-restore Juanma Barranquero
2014-03-06 17:27 ` martin rudalics
2014-03-06 17:33   ` Juanma Barranquero
2014-03-06 18:16     ` martin rudalics
2014-03-06 18:35       ` Juanma Barranquero
2014-03-06 18:41       ` Juanma Barranquero
2014-03-07  7:38         ` martin rudalics
2014-03-07 11:28           ` Juanma Barranquero
2014-03-07 15:16             ` martin rudalics
2014-03-07 20:32 ` Stefan Monnier
2014-03-07 21:34   ` Juanma Barranquero
2014-03-07 21:40     ` Juanma Barranquero
2014-03-08  0:34     ` Stefan Monnier
2014-03-08  1:42       ` Juanma Barranquero
2014-03-08  2:25         ` Juanma Barranquero
2014-03-08  4:31         ` Stefan Monnier
2014-03-08  6:00           ` Juanma Barranquero
2014-03-08 14:27             ` Stefan Monnier
2014-03-08 16:34               ` Juanma Barranquero
2014-03-08 23:45                 ` Juanma Barranquero
2014-03-10  4:29                   ` Stefan Monnier
2014-03-10  5:26                     ` Juanma Barranquero
2014-03-10 13:04                       ` Juanma Barranquero
2014-03-10 14:19                       ` Stefan Monnier [this message]
2014-03-10 15:06                         ` Juanma Barranquero
2014-03-10 18:33                           ` Juanma Barranquero
2014-03-10 23:10                             ` Stefan Monnier
2014-03-11  0:47                               ` Juanma Barranquero
2014-03-10 20:32                           ` Stefan Monnier
2014-03-10 21:07                             ` Juanma Barranquero
2014-03-09 12:29                 ` Stefan Monnier

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=jwvpplub17s.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.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).