doomemacs / doomemacs

An Emacs framework for the stubborn martian hacker
MIT License
19.2k stars 3.03k forks source link

Window param `+popup--split-window` does not survive (1) `visual-fill-column-mode` (2) workspace switching | breaks: `org-todo` selector in popup #4228

Closed adrech closed 3 years ago

adrech commented 3 years ago

(1) visual-fill-column (writeroom-mode / zen module)

  1. SPC X t (open an org capture popup)
  2. M-x visual-fill-column-mode
  3. M-x org-todo Error: "split-window: Cannot split side window or parent of side window"

Reason: +popup--split-window gets overwritten in visual-fill-column--adjust-window with visual-fill-column-split-window:

(defun visual-fill-column--adjust-window ()
  ...
  (when (buffer-local-value 'visual-fill-column-mode (window-buffer (selected-window)))
    ...
    (if (>= emacs-major-version 25)
        (set-window-parameter (get-buffer-window (current-buffer)) 'split-window #'visual-fill-column-split-window))
    ...))

This happens through

(defun visual-fill-column--adjust-frame (frame)
  "Adjust the windows of FRAME."
  (mapc (lambda (w)
          (with-selected-window w
            (visual-fill-column--adjust-window)))
        (window-list frame :never)))

A quickfix attempt with

;;;###package visual-fill-column
(defadvice! +popup--restore-split-window-parameter-a (&rest _)
  :after #'visual-fill-column--adjust-window
  (let ((win (selected-window)))
    (when (window-parameter win 'popup)
      (set-window-parameter win 'split-window #'+popup--split-window))))

works for me so far.

(2) workspace switching

  1. SPC X t(open an org-capture popup)
  2. M-x +workspace/new
  3. M-x +workspace:switch-previous
  4. M-x org-todo Error:"split-window: Cannot split side window or parent of side window"

Reason: the split-window parameter does not persist the underlying window-state-get / window-state-put (which are used by persp-mode).

Putting this in an empty config.el

(add-to-list '+popup-window-parameters 'split-window)

or directly setting

(add-to-list 'window-persistent-parameters '(split-window . writable))

makes org-todo after workspace-switching possible again. BUT... now the selector window appears twice:

Screenshot_20201106_153321

Strangely this duplication does NOT happen when the popup is at the top:

(after! org
  (set-popup-rule! "CAPTURE-*"
    :side 'top :select t :quit nil :autosave t))

Screenshot_20201106_164000

Note: These also don't persist

(delete-other-windows . +popup--delete-other-windows)
(delete-window . +popup--delete-window)

I did not notice a problem with that so far though.

System information

```
SYSTEM  type       gnu/linux
        config     x86_64-suse-linux-gnu
        shell      /bin/bash
        uname      Linux 5.9.1-1-default #1 SMP Mon Oct 26 07:02:23 UTC 2020 (435e92d) x86_64
        path       (~/.emacs.d/bin ~/.emacs.d/bin ~/bin /usr/local/bin /usr/bin /bin ~/.fzf/bin /usr/lib/emacs/27.1/x86_64-suse-linux/)
EMACS   dir        ~/.emacs.d/
        version    27.1
        build      Nov 06, 2020
        buildopts  --disable-build-details --without-pop --with-mailutils --without-hesiod --with-gameuser=:games --with-kerberos --with-kerberos5 --with-file-notification=inotify --with-modules --enable-autodepend --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --localstatedir=/var --sharedstatedir=/var/lib --libexecdir=/usr/lib --enable-locallisppath=/usr/share/emacs/27.1/site-lisp:/usr/share/emacs/site-lisp --with-x --with-xim --with-sound --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-rsvg --with-dbus --with-xft --without-gpm --with-x-toolkit=gtk3 --with-toolkit-scroll-bars --x-includes=/usr/include --x-libraries=/usr/lib64 --with-libotf --with-m17n-flt --with-cairo --with-xwidgets --build=x86_64-suse-linux --with-dumping=pdumper 'CFLAGS=-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -D_GNU_SOURCE -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS -pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label -fno-optimize-sibling-calls -fno-PIE -DSYSTEM_PURESIZE_EXTRA=55000      -DSITELOAD_PURESIZE_EXTRA=10000  -DPDMP_BASE='\''"emacs-gtk"'\''' LDFLAGS=-Wl,-O2
        features   XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP
        traits     (server-running envvar-file)
DOOM    dir        ~/.doom.d/
        version    2.0.9
        build      HEAD -> develop ee6c27c2a 2020-11-06 02:33:53 -0500
        elc-files  0
        modules    (:completion (company +childframe) (ivy +childframe +prescient +icon) :ui doom doom-dashboard doom-quit hl-todo (ligatures +extra) modeline nav-flash ophints (popup +defaults) treemacs vc-gutter (window-select +numbers) workspaces zen :editor (evil +everywhere) file-templates fold (format +onsave) multiple-cursors rotate-text snippets :emacs dired electric ibuffer undo vc :term eshell vterm :checkers syntax :tools debugger direnv editorconfig (eval +overlay) (lookup +dictionary) (lsp +eglot) (magit +forge) pdf rgb :os tty :lang clojure emacs-lisp (latex +latexmk +fold) markdown (org +dragndrop +pandoc +pomodoro +pretty +jupyter +roam) python (sh +lsp) :config (default +bindings +smartparens) :private (&user lispy))
        packages   ((visual-fill-column :recipe (:local-repo ~/visual-fill-column)) (doom-themes :recipe (:local-repo ~/emacs-doom-themes)))
        unpin      (n/a)
        elpa       (n/a)
```
github-actions[bot] commented 3 years ago

This issue has been automatically marked stale because of a lack of recent activity. If this issue is still valid, reply to it or remove the label or it will be closed in 7 days.