emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: dal-blazej@onenetbeyond.org
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org,  jan.seeger@thenybble.de
Subject: Re: Bug: org-no-popups disregards display-buffer-fallback-action [9.4.6 (9.4.6-13-g4be129-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20210920/)]
Date: Mon, 15 Nov 2021 00:03:29 +0100	[thread overview]
Message-ID: <877ddaqr0e.fsf@onenetbeyond.org> (raw)
In-Reply-To: <87pmr3mfq3.fsf@localhost> (Ihor Radchenko's message of "Sun, 14 Nov 2021 14:08:36 +0800")


Ihor Radchenko <yantar92@gmail.com> writes:

>> As others I am currently advising a lot of org display functions to make
>> them obey to my 'display-buffer-alist'. I hope for a better cooperation
>> from org to window.el.
>
> Can you elaborate? We are looking forward for ideas how to improve Org
> in this area. More concrete suggestions are welcome.
>

The last time I looked into org-todo I seen that somewhere a call to
split-window was make, so wathever I was trying to configure with
display-buffer-alist would not conclude.

Then I translated that from Doom's Emacs.

#+begin_src emacs-lisp
;; Ensure todo, agenda, and other minor popups are delegated to the popup system.
;; needed for at least org-noter / org-insert-structure-template
(with-eval-after-load 'org
  (advice-add #'org-switch-to-buffer-other-window :override
              (defun +popup--org-pop-to-buffer-a (buf &optional norecord)
                "Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
                (pop-to-buffer buf nil norecord)))

  (defun +popup--suppress-delete-other-windows-a (fn &rest args)
    (cl-letf (((symbol-function #'delete-other-windows) #'ignore)
              ((symbol-function #'delete-window) #'ignore))
      (apply fn args)))
  (dolist (fn '(org-add-log-note
                org-capture-place-template
                org-export--dispatch-ui
                org-agenda-get-restriction-and-command
                org-goto-location
                org-fast-tag-selection
                org-fast-todo-selection))
    (advice-add fn :around #'+popup--suppress-delete-other-windows-a))

  (advice-add #'org-fit-window-to-buffer :override #'fit-window-to-buffer))
#+end_src

You can see that it is not only the org-no-popup macro that is in
question but more generally the liberal usage of _split/switch/delete
windows_.

So if we want to make org cooperate with window.el we must ban theses
functions and instead delegate the window management with calls to
proper display functions.

Concretly if you look at org-fast-todo-selection you can see :

	(if expert
	    (set-buffer (get-buffer-create " *Org todo*"))
	  (delete-other-windows)
	  (set-window-buffer (split-window-vertically) (get-buffer-create " *Org todo*"))
	  (org-switch-to-buffer-other-window " *Org todo*"))

Now consider in place :

	(set-buffer (get-buffer-create " *Org todo*"))
        (unless expert
            (display-buffer " *Org todo*"
                            '((display-buffer-below-selected)
                              (window-height . fit-window-to-buffer))))
        

It will display this buffer below the currently selected window and fit
him.

Let's imagine the user wants in place to use :

(add-to-list 'display-buffer-alist
             '(" *Org todo*"
               (display-buffer-in-side-window)
               (side . top)))

Now the buffer display in a side window at top.


  parent reply	other threads:[~2021-11-14 23:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10  7:50 Bug: org-no-popups disregards display-buffer-fallback-action [9.4.6 (9.4.6-13-g4be129-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20210920/)] Jan Seeger via General discussions about Org-mode.
2021-11-10 10:20 ` Ihor Radchenko
2021-11-13 17:34   ` dal-blazej
2021-11-14  6:08     ` Ihor Radchenko
2021-11-14 12:13       ` Eric S Fraga
2021-11-14 12:40         ` Ihor Radchenko
2021-11-14 19:37           ` Eric S Fraga
2021-11-14 23:03       ` dal-blazej [this message]
2021-11-15  9:57         ` Eric S Fraga
2021-11-15 16:54           ` org-capture windows Max Nikulin
2021-11-15 18:29             ` Eric S Fraga
2021-11-15 19:40           ` Bug: org-no-popups disregards display-buffer-fallback-action [9.4.6 (9.4.6-13-g4be129-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20210920/)] Daniel Kraus
2024-04-12 17:59             ` Ihor Radchenko
2024-01-24 14:01       ` Ihor Radchenko
2024-01-25  3:10         ` Christopher M. Miles
2021-11-15  7:41   ` Jan Seeger via General discussions about Org-mode.
2021-11-13 13:15 ` Bug: org-no-popups disregards display-buffer-fallback-action 9.4.6 Max Nikulin
2021-11-15  7:42   ` Jan Seeger via General discussions about Org-mode.
2021-11-15  7:49   ` Jan Seeger via General discussions about Org-mode.
2021-11-17 14:49     ` Max Nikulin
  -- strict thread matches above, loose matches on Subject: below --
2021-11-10  7:50 Bug: org-no-popups disregards display-buffer-fallback-action [9.4.6 (9.4.6-13-g4be129-elpaplus @ /home/jeeger/.emacs.d/elpa/org-plus-contrib-20210920/)] Jan Seeger via General discussions about Org-mode.

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.orgmode.org/

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

  git send-email \
    --in-reply-to=877ddaqr0e.fsf@onenetbeyond.org \
    --to=dal-blazej@onenetbeyond.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jan.seeger@thenybble.de \
    --cc=yantar92@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/org-mode.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).