From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: Some question about display-buffer action functions Date: Mon, 30 Jan 2012 13:48:19 +0100 Message-ID: References: <4F25829F.8000104@gmx.at> <4F266F3D.6030105@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1327927762 23469 80.91.229.3 (30 Jan 2012 12:49:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2012 12:49:22 +0000 (UTC) Cc: Emacs developers To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 30 13:49:20 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rrqff-00043O-CP for ged-emacs-devel@m.gmane.org; Mon, 30 Jan 2012 13:49:19 +0100 Original-Received: from localhost ([::1]:49574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rrqfa-0005VA-Eu for ged-emacs-devel@m.gmane.org; Mon, 30 Jan 2012 07:49:14 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:42912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrqfS-0005V4-Q1 for emacs-devel@gnu.org; Mon, 30 Jan 2012 07:49:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrqfM-0001xv-PS for emacs-devel@gnu.org; Mon, 30 Jan 2012 07:49:06 -0500 Original-Received: from mail-pz0-f41.google.com ([209.85.210.41]:63852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrqfM-0001xp-DJ for emacs-devel@gnu.org; Mon, 30 Jan 2012 07:49:00 -0500 Original-Received: by dake40 with SMTP id e40so3820462dak.0 for ; Mon, 30 Jan 2012 04:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=3gp9Pif2xpYbcp0gXWqJM3wEYpjdMg4aA3OJL9KETi8=; b=oiuirE0M21THXNXqvZevAGf0NJmNKdRBN6sUWQ13/g8q3ELt6r4xKDdJZKkSrCImgO fTCMgmX4xiCpQggQNgpPens6iMKSfAwTfXMilS+OBR9ra95J+nJeOXBFfUjXb49+66Ej XZku1/XpzNuNu1hzcflujZ/qs9W23ZnqHLQ2E= Original-Received: by 10.68.75.199 with SMTP id e7mr41820473pbw.128.1327927739243; Mon, 30 Jan 2012 04:48:59 -0800 (PST) Original-Received: by 10.143.37.9 with HTTP; Mon, 30 Jan 2012 04:48:19 -0800 (PST) In-Reply-To: <4F266F3D.6030105@gmx.at> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:148036 Archived-At: On Mon, Jan 30, 2012 at 11:21, martin rudalics wrote: > Actually `bs-cycle-next' should use `pop-to-buffer-same-window'. Perhaps. But we've already gone through a few iterations of what bs-cycle-next should call ;-) > OTOH I don't understand: You invoke bs from the INF window and get > surprised that it wants to switch to another buffer there? In that particular case, I'm not complaining about what bs-cycle-next does. If I invoke bs-cycle-next in INF, it's only by mistake (but a frequent one, because I use b-c-n all the time). As it is a mistake that annoys me, I make INF strongly dedicated to avoid it. I would prefer to make it softly dedicated, but that does not work currently. > That's what side windows try to tackle (unless the user explicitly > overrides it by interactively calling `switch-to-buffer' in such a > window). Aha, I see. > Alternatively, one could make `set-window-dedicated-p' accept > a list of names of buffers that may replace the one currently shown in > the corresponding window. Well, that would help me, though I don't know if it is a very common need. Dedicated windows do not seem to get much use yet in user code. > I still don't understand why `jb-inferior' should not call `jb-setup'. > After all there could be some setup specific to INF windows. Because I did a poor job of explaining myself. I should not have used my own case as an example. In my .emacs, jb-inferior calls jb-setup. They are strongly coupled. That has forced me to *write* jb-inferior, which is an AF for creating and setting up INF. I would have preferred to write display-buffer-choose-window-with-parameter (an AF to choose a window according to some window parameter, passed through the action list), and then use that to implement my SUP/INF setup. Then, after 24.1, I would surely suggest that d-b-c-w-w-p could be a worthy addition to window.el. jb-inferior isn't ;-) > And I'm still not sure whether this should be done in a hook. =C2=A0The f= act > that we have to resort to a hook means the alist concept sucks. I'm not enamoured of the hook idea. I just happen to think that being forced to advise list-buffers is even worse. But you're the expert, I trust you to find a better mechanism ;-) >=C2=A0In > particular, because the hook function would have to discriminate, > probably based on the name of the window's buffer, how to proceed. Yes. That's why I talked about "hook actions". > I think that it should be possible to set up most properties of the > window used (like minimum or ideal size, fixed-sizeness, dedicatedness > to name a few) via `display-buffer-alist'. That would be very nice. > And the buffer must be still the same too. =C2=A0Maybe `quit-window' shou= ld > always delete the window when it's dedicated. That would work for me, but I'm not sure is the best answer. > =C2=A0But maybe you should > rather use C-x 0 to get rid of a window for sure ;-) Well, yes. I don't do that, because I use a single keybinding () that subsumes all this: If I'm in SUP and there's no INF, create INF. If I'm in SUP and there's an INF, switch to INF; and if I'm in INF, kill it, bury the buffer and get back to SUP. Of course the function bound to does use delete-window (or, in fact, window--delete). My comment was about a case where quit-window does not do what I expect. However: > That would be a bug. =C2=A0If I do > > (progn > =C2=A0(display-buffer-record-window 'window nil (window-buffer)) > =C2=A0(set-window-prev-buffers nil nil)) > > in an arbitrary window, `quit-window' deletes it if there are other > windows around. ...perhaps I was sleeping the last time I tried it, because now it works. > What is a "hook action"? =C2=A0Do you mean that the function called shoul= d be > specified via `display-buffer-alist'? Yes. >> 1) I'd prefer not to couple jb-inferior to >> `display-buffer-pop-up-window'. As a principle, I don't think AFs >> should call other AFs if possible. That's something for >> display-buffer-alist and the other user-configurable options to >> decide. > > I wouldn't be too strict about this. Not too strict, but it's preferable IMO. > Why would calling `jb-setup' mean that `jb-inferior' _depends_ on it? Just that it makes harder to use jb-inferior for things other than SUP/INF. > Would this mean that when I call `jb-setup' from `display-buffer-hook' > displaying a buffer depends on `jb-setup'? No, but it sets the window height and its dedicatedness. It's un-useful, and even harmful, if I ever want to use it for anything else. Generality is lost. >> So, as currently implemented, either AFs are generic, and any window > > What does "generic" stand for in this context? Useful to other people. Not tied to one user's specific details of implementation. Like d-b-(pop-up|reuse|same|use-some)-window and friends. > Do you mean that we should avoid here to invoke `jb-setup' twice - once > directly in an AF like `jb-inferior' and once via a hook? =C2=A0But this > should be addressed by the coder of `jb-inferior'. That's what I'm trying to do in this discussion: find a way to run it once, *after* the window is chosen and set-window-buffer called. In my original message, I listed the ways I know to make that happen (hooks, advices, a wrapper function, etc.). (Note that I already have implemented a strongly coupled jb-inferior/jb-setup, so this is not about how to fix my .emacs; it's about how to make AFs, and action lists, more useful and flexible.) =C2=A0 =C2=A0 Juanma