Commit graph

61 commits

Author SHA1 Message Date
Mingwei Zhang
9af8786e25
minor documentation spelling fix
`more tha one` -> `more than one`
2020-02-29 12:14:17 -08:00
Henrik Lissner
4fe24df90f
Fix #1970: don't count treemacs as a "popup"
And remove its popup rule.

It isn't being caught by the popup system in the first place, so this is
all a charade.
2020-01-06 03:50:48 -05:00
Henrik Lissner
adc8cba14b
Revise docstrings & minor reformatting 2019-12-26 01:41:44 -05:00
Henrik Lissner
6ac04e5a6d
ui/popup: prevent infinite loop when killing popup buffers 2019-12-22 16:02:56 -05:00
Ralf Beckmann
7f06644490 Make +pop/raise return the current window 2019-12-17 21:14:35 +01:00
Henrik Lissner
bcdb9f583a
Require origin argument
If it doesn't satisfy windowp, it'll cause errors.
2019-12-03 20:00:38 -05:00
Henrik Lissner
79faa02d6b
Record origin window earlier
The selected window could change in between +popup--maybe-select-window calls.
2019-12-03 19:59:27 -05:00
Yiming Chen
359ae77250 ui/popup: extract +popup--maybe-select-window helper function 2019-12-04 08:32:27 +08:00
Yiming Chen
ca63b0bbfc ui/popup: respect :select nil when reusing a window
- before this change: when reusing a window, select option would get ignored
- after this change: when reusing a window, select option would be used
  just as a new popup
2019-12-04 08:20:17 +08:00
Henrik Lissner
fb13b902b0
Minor comment/doc revision & refactors 2019-11-21 14:46:45 -05:00
Henrik Lissner
99cd52e70f
💥 Drop Emacs 25.x support
Emacs 26.1 is Doom's new minimum supported version

Closes #2026
2019-11-08 16:02:06 -05:00
Henrik Lissner
74cad2632b
ui/popup: use old alist use-case for set-popup-rule!
This paradigm has been long since abandoned.
2019-10-21 06:26:57 -04:00
Henrik Lissner
b3a0fb9fc7
ui/popup: correct docstring of set-popup-rule!
Predicate functions take two arguments.
2019-10-21 06:26:57 -04:00
Henrik Lissner
e7f492c400
ui/popup: fix "back to top level" issue
The popup manager (by default) auto-kills most popup buffers after
~5s (controlled by the :ttl property). However, when backtrace buffers
are killed, it calls `top-level`. When the popup manager kills the
buffer, this causes janky cursor movement and the message "Back to top
level" to be displayed in the minibuffer.
2019-10-20 19:57:27 -04:00
Henrik Lissner
7a1c8bd582
ui/popup: fix buffer cleanup ignoring kill-buffer-hook 2019-09-22 14:25:10 -04:00
Henrik Lissner
2de198e749
Fix +popup/raise not raising some windows
The command now raises the popup into the previously selected window,
unless the prefix argument is used.
2019-09-20 23:54:17 -04:00
Henrik Lissner
82ae3a73f3
def-advice!->defadvice! & conform to new advice conventions
This commit does two things:

- Renames def-advice! to defadvice!, in the spirit of naming convenience
  macros after the function/macro they enhance or replace.
- Correct the names of advice functions to indicate visibility and
  intent. A public advice function like doom-set-jump-a is meant to be
  used elsewhere. A private one like +dired--cleanup-header-line-a
  shouldn't -- it likely won't work anywhere but the function(s) it was
  made to advise.
2019-07-23 17:24:56 +02:00
Henrik Lissner
1c4215c187
Fix 'command not found' errors for hidden commands 2019-07-22 04:46:14 +02:00
Henrik Lissner
53d1bf6b58
Refactor +popup/other 2019-06-30 18:12:16 +02:00
Henrik Lissner
9a02bd8ac8
Minor refactors across the board
- when-let* -> when-let
- Fix projectile-locate-dominating-file for connected remote files
2019-06-26 14:31:06 +02:00
Henrik Lissner
a22c035815
ui/popup: ensure existing buffers are reused
This resolves an issue where the popup manager would open another popup
if a previous one had been raised. The popup manager now delegates to
the existing buffer if it already exists (without resizing it).
2019-05-15 15:22:09 -04:00
Henrik Lissner
b7c02d5c0a
Half-revert ba23b63 #1349 2019-04-21 13:25:33 -04:00
Henrik Lissner
ba23b63f5c
Fix +popup/raise for consecutive popups 2019-04-09 21:20:08 -04:00
Henrik Lissner
a8532faf08
Improve set-popup-rule!'s signature 2019-03-16 23:59:51 -04:00
Henrik Lissner
adfc06f3dd
Add no-other-window in popup criteria
This allows +popup-window-p to recognize popup windows created by
plugins (like treemacs).
2019-02-19 01:29:03 -05:00
Henrik Lissner
93132e43c1
Fix window--display-buffer advice #1173
Forgot to have the :filter-return advice return the window (whoops!)
2019-02-16 01:16:09 -05:00
Henrik Lissner
c5cd97d3cc
Fix breaking change in window--display-buffer
This change is present in later builds of Emacs 27, where
window--display-buffer no longer has a 5th argument.
2019-02-15 19:53:15 -05:00
Henrik Lissner
4b2dbe42a5
Fix popup :slot property
It was broken by the new split-window parameter set on popup windows.
2019-01-08 21:49:43 -05:00
Henrik Lissner
30eaf8fd03
Fix "cannot split parent or side window" errors
Hopefully addresses a common issue where helm actions will operate on
the wrong window (a popup, typically, which is a dedicated side window;
Emacs doesn't let you split side windows).

This comes with a side effect: trying to split a popup will cause a
non-popup window nearby to be split instead.

Popups really aren't supposed to be split (interactively) in any case.
2019-01-08 20:38:17 -05:00
Henrik Lissner
b56639e31b
Remove deprecated set! & def-setting! macros 2019-01-05 17:48:46 -05:00
Henrik Lissner
5c14fb42e0
Add +popup/diagnose for debugging popup rules 2018-12-06 17:51:40 -05:00
Henrik Lissner
745bd3238c
Fix delete-other-windows from inside popups
Occasionally, a window will lose its popup status, but not its special
window parameters, forcing non-popups to be treated like popups when
delete-other-windows is called.
2018-12-06 17:45:53 -05:00
Henrik Lissner
35170cb2e0
Merge pull request #1029 from amosbird/patch-8
Don't scan frames other than current in popup
2018-12-03 22:18:03 -05:00
Elijah Malaby
d063fff8a1 Fixed +popup--kill-buffer visibility check
Now it checks all frames instead of only the current one.
2018-12-02 13:24:02 -05:00
Amos Bird
3b67338b4a
Don't scan frames other than current in popup
This accidentally reuses windows in other frames, especially when there are multiple compliation buffers.
2018-11-27 22:08:35 +08:00
Edwin Török
27e17ace67 Fix race condition in popup load
When compiling everything I got this on Emacs startup:
```
Debugger entered--Lisp error: (void-variable +popup--display-buffer-alist)
  (setq +popup--old-display-buffer-alist display-buffer-alist display-buffer-alist +popup--display-buffer-alist window--sides-inhibit-check t)
  (cond (+popup-mode (add-hook 'doom-escape-hook (function +popup|close-on-escape) t) (add-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq +popup--old-display-buffer-alist display-buffer-alist display-buffer-alist +popup--display-buffer-alist window--sides-inhibit-check t) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (setq window-persistent-parameters (cons (cons prop 'writable) window-persistent-parameters)) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (t (remove-hook 'doom-escape-hook (function +popup|close-on-escape)) (remove-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq display-buffer-alist +popup--old-display-buffer-alist window--sides-inhibit-check nil) (+popup|cleanup-rules) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (delq (assq prop window-persistent-parameters) window-persistent-parameters) (setq --dolist-tail-- (cdr --dolist-tail--)))))))
  (let ((last-message (current-message))) (setq-default +popup-mode (if (eq arg 'toggle) (not (default-value '+popup-mode)) (> (prefix-numeric-value arg) 0))) (cond (+popup-mode (add-hook 'doom-escape-hook (function +popup|close-on-escape) t) (add-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq +popup--old-display-buffer-alist display-buffer-alist display-buffer-alist +popup--display-buffer-alist window--sides-inhibit-check t) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (setq window-persistent-parameters (cons (cons prop 'writable) window-persistent-parameters)) (setq --dolist-tail-- (cdr --dolist-tail--)))))) (t (remove-hook 'doom-escape-hook (function +popup|close-on-escape)) (remove-hook 'doom-cleanup-hook (function +popup|cleanup-rules)) (setq display-buffer-alist +popup--old-display-buffer-alist window--sides-inhibit-check nil) (+popup|cleanup-rules) (let ((--dolist-tail-- +popup-window-parameters)) (while --dolist-tail-- (let ((prop (car --dolist-tail--))) (delq (assq prop window-persistent-parameters) window-persistent-parameters) (setq --dolist-tail-- (cdr --dolist-tail--))))))) (run-hooks '+popup-mode-hook (if (default-value '+popup-mode) '+popup-mode-on-hook '+popup-mode-off-hook)) (if (called-interactively-p 'any) (progn (customize-mark-as-set '+popup-mode) (if (and (current-message) (not (equal last-message (current-message)))) nil (let ((local "")) (message "+Popup mode %sabled%s" (if (default-value '+popup-mode) "en" "dis") local))))))
  +popup-mode()
  doom-try-run-hook(+popup-mode)
  run-hook-wrapped(doom-try-run-hook +popup-mode)
  doom|init-ui()
  run-hooks(emacs-startup-hook term-setup-hook)
  #f(compiled-function () #<bytecode 0x46c615>)()
  normal-top-level()
```

Signed-off-by: Edwin Török <edwin@etorok.net>
2018-09-19 21:43:56 +01:00
Henrik Lissner
0b350f6ea4
ui/popup: refactor +popup/raise
Improves its error tolerance and gives it a window argument.
2018-09-09 09:58:22 -04:00
Henrik Lissner
7d3ffdff06
Remove third line in section headers
This is truly important stuff. We've saved many lives with this update.
2018-09-09 09:58:19 -04:00
Henrik Lissner
5e25cfd6a7
Fix delete-other-windows in popups #858
Originally, calling delete-other-windows from a popup window would kill
only popup windows. This has been corrected to raise the popup, *then*
delete other windows.

As if you'd done `M-x +popup/raise` then `M-x delete-other-windows`
2018-09-02 20:38:36 +02:00
Henrik Lissner
be8eedc296
Fix lost window state when toggling popups
Replaces af045213 with a method for preserving popup state.
2018-08-29 02:16:06 +02:00
Henrik Lissner
af045213e3
Preserve window state when toggling popups
e.g. size
2018-08-26 17:24:27 +02:00
Henrik Lissner
bfa6fce15f
+popup/buffer: hide buffer being popped up #825 2018-08-23 17:12:49 +02:00
Henrik Lissner
cbc59f9333
Appease the byte-compiler 2018-07-30 12:10:11 +02:00
Henrik Lissner
1205db0f73
Decouple :modeline popup rule from modeline API
The :modeline property still takes:

  t => default modeline
  nil => no modeline (the default)

But now also accepts:

  function => uses its return value as the mode-line-format
  anything non-nil => used directly as the mode-line-format

This is to decouple the popup API from the modeline API. You can still
use them compositionally:

  (set-popup-rule "abc" :modeline (lambda () (set-modeline! :project)))
2018-07-30 02:57:50 +02:00
Henrik Lissner
399194e868
Autoload +popup--init
Fixes #766
2018-07-21 14:00:02 +02:00
Henrik Lissner
10daa435f7
Document :ignore property in set-popup-rule! 2018-07-07 11:44:47 +02:00
Henrik Lissner
a406b2d0c8
Ignore errors if display-buffer ALIST is malformed
The gud.el library uses display-buffer incorrectly, by passing a list of
functions as its second argument, instead of as a nested list.

CORRECT:
  (display-buffer buffer
    '((display-buffer-reuse-window
       display-buffer-in-previous-window
       display-buffer-same-window display-buffer-pop-up-window)))

INCORRECT (how gud does it):
  (display-buffer buffer
    '(display-buffer-reuse-window
      display-buffer-in-previous-window
      display-buffer-same-window display-buffer-pop-up-window))

This causes "wrong-type-argument: listp
display-buffer-in-previous-window" error. However, it appears Emacs
handles malformed alists by just ignoring them, so Doom will do the
same.

Reported by @maskray
2018-07-04 21:42:33 +02:00
Henrik Lissner
cddde09b79
Fix popup system not cleaning up buffers with ttl
Because of extra parentheses causing essential logic from running. I am
a silly goose.
2018-07-01 00:57:27 +02:00
Henrik Lissner
04ee1c23fd
Don't set margins in left/right popups 2018-06-29 02:35:33 +02:00
Henrik Lissner
8fcc12ed08
Add +popup-display-buffer-fullframe
Adds support for the saved-wconf window parameter. If a popup possesses
a window configuration in this parameter, it will be restored when the
popup (or its popup buffer) is killed.
2018-06-25 19:28:09 +02:00