Commit graph

73 commits

Author SHA1 Message Date
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
b76a09539c Fix helm TAB completion from org-insert-link #897 #829
This is a tricky issue and a tricky fix. See the comments in the commit
for an explanation.
2018-09-18 21:44:59 -04:00
Henrik Lissner
a1440f8d66
Fix meta keybinds in popup in tty Emacs #869
Meta keys map to ESC in tty Emacs.
2018-09-13 19:15:16 -04: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
82376f324b
Merge pull request #824 from hackeryarn/popup-readme-updates
ui/popup: updated readme to use set-popup-rules!
2018-09-01 13:20:09 +02:00
Henrik Lissner
fd8f8c5108
feature/lookup: rewrite dash docset integration
+ Uses alist variable to store config, rather than hooks
+ Added check for installed docsets in +lookup/documentation
+ Set docsets for various language modules (c-mode, c++-mode, css-mode,
  scss-mode, sass-mode, web-mode, go-mode, racket-mode, emacs-lisp-mode,
  js2-mode, rjsx-mode, typescript-mode, rust-mode, and php-mode)
+ Made *eww* popups for dash docsets larger
+ Renamed set-docset! => set-docsets! (set-docset! is aliased to
  set-docsets!)
+ New +lookup/install-docset alias
2018-08-31 02:49:48 +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
469aa81570
Forward-require dependencies in tests
Easier to see at a glance what the test's dependencies are.
2018-08-26 00:20:16 +02:00
Henrik Lissner
cc47798846
Revert 6b910392 #829
Causes other errors. Will need a better solution.
2018-08-25 12:00:27 +02:00
Henrik Lissner
6b91039283
Fix helm persistent action with *Org Links* window
Fixes #829. Helm's persistent action would try to operate on the *Org
Links* window, which is dedicated, causing a "Cannot split side window
or parent of side window" error.

This fix gets rid of this unhelpful popup altogether when helm is
enabled.
2018-08-24 01:09:53 +02:00
Henrik Lissner
bfa6fce15f
+popup/buffer: hide buffer being popped up #825 2018-08-23 17:12:49 +02:00
hackeryarn
2c6ae455f9 updated readme to use set-popup-rules! 2018-08-21 07:21:25 -05:00
Henrik Lissner
c69543fecc
Fix helm not cooperating with other popups
Like the compilation window
2018-08-15 23:32:53 +02:00
Henrik Lissner
b349dd3473
ui/popup: respect org-src-window-setup 2018-08-07 14:44:10 +02:00
Henrik Lissner
c1e2919294
completion/helm: set default window height = 22%
A little smaller than the default
2018-08-04 18:42:29 +02:00
Henrik Lissner
4489ce6b81
ui/popup: refactor hacks 2018-08-04 00:00:16 +02:00
Henrik Lissner
4db89a2fb4
Remove treemacs popup hack
Now that it is supported upstream.

Relevant to #766
2018-08-03 19:15:46 +02:00
Henrik Lissner
d2ecd87739
Fix ivy completion when treemacs is open
Caused by incorrectly initialized treemacs popup hack.
2018-08-02 03:31:20 +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
28e21352ec
Have popup manager handle treemacs windows
Other windows would be resized slightly incorrectly because treemacs
opens as a fixed split, rather than a side window. This change forces it
to be a side window, which resolves the problem _and_ restores the
functionality of balance-windows, which is disabled when a fixed split
is present.
2018-07-21 01:20:59 +02:00
Henrik Lissner
7f284e98b6
Fix helm-M-x help popup not properly closing
On successive TAB presses on a command
2018-07-21 01:20:05 +02:00
Henrik Lissner
10daa435f7
Document :ignore property in set-popup-rule! 2018-07-07 11:44:47 +02:00
Henrik Lissner
0b7faa468c
Fix which-key sharing windows with other popups
Which-key is now lazy-loaded, so the modified which-key-popup-type gets
overwritten.
2018-07-06 14:57:40 +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
4eda07e576
Don't replace scratch buffer with other popups 2018-06-28 00:31:36 +02:00
Henrik Lissner
0dc0ccc63e
Refactor +popup*org-pop-to-buffer
Simplify pop-to-buffer call.
2018-06-25 20:19: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
Henrik Lissner
618358413b
Major refactor of ui/popup
+ Make it pass tests
+ Changes the behavior and arguments of functions passed to :autosave,
  :ttl, and :modeline.
+ Updated the documentation of set-popup-rule! to reflect these changes
+ Phase out map.el usage as per f6dc6ac7
2018-06-23 22:18:44 +02:00
Henrik Lissner
f11bd617cd
Add ui/popup tests (wip) 2018-06-23 22:17:56 +02:00
Henrik Lissner
f6dc6ac74e
Refactor out map.el usage
After some profiling, it turns out map-put and map-delete are 5-7x
slower (more on Emacs 25) than delq, setf/alist-get and add-to-list for
small lists (under 250 items), which is exactly how I've been using
them.

The only caveat is alist-get's signature is different on Emacs 25, thus
a polyfill is necessary in core-lib.
2018-06-23 19:53:54 +02:00
Henrik Lissner
0bea00c183
Fix with-popup-rules! macro
Mistreating its RULES argument, causing void-function errors.
2018-06-22 19:17:15 +02:00
Henrik Lissner
16975d0dc3
Slightly smaller backtrace popups 2018-06-22 01:49:21 +02:00
Henrik Lissner
27ab47cd11
Improve *Backtrace* popup rule
+ High vslot = unlikely to be replaced by other popups.
+ Make it large; backtraces are important!
+ Don't allow ESC to close it. It must be done manually, with q or zx
2018-06-20 02:12:37 +02:00
Henrik Lissner
ca2c8b5a45
Minor refactor, across the board
Do you see the board? Now look at the other side. That's how far this
refactor extends.

Yes.
2018-06-18 15:02:24 +02:00
Henrik Lissner
6808c46b58
💥 Change set-popup-rule! usage
Now accepts a flat plist of all its former parameters, including new
:parameters and :actions properties to increase your control over the
fate of your windows.

The old usage of set-popup-rule! is deprecated and may not work right!

The :ui popup module has also seen a major refactor to improve
efficiency and load times.

Sorry! This is the last "big" change before 2.1!
2018-06-18 02:34:16 +02:00
Henrik Lissner
6490c4b922
Prevent unsafe file variable prompts on help links 2018-06-17 17:26:15 +02:00
Henrik Lissner
0fd8e1dd6b
Restore +popup-ttl
Accidentally removed in a recent commit.

Fixes #692
2018-06-17 11:34:55 +02:00
Henrik Lissner
d31052d9db
Reformat popup library: move polyfills down 2018-06-17 02:21:46 +02:00
Henrik Lissner
1eae57a0b4
Rename +popup-display-buffer
To +popup-display-buffer-stacked-side-window, to make it more obvious
what it actually does.
2018-06-17 02:21:46 +02:00
Henrik Lissner
c3988a8298
Give popups a small margin
To make up for lack of fringe.
2018-06-17 02:21:46 +02:00
Henrik Lissner
9b5a219373
Improve robustness of popup predicates & checks 2018-06-17 02:21:46 +02:00
Henrik Lissner
635fbb4a97
Fix "selecting deleted buffer" errors in helm #665
By properly handling helm popups.
2018-06-16 14:42:47 +02:00
Henrik Lissner
44363cae40
General, minor refactor & revision
Across the board. All the boards.
2018-06-16 12:26:58 +02:00