2018-05-14 01:20:53 +02:00
|
|
|
;;; ui/popup/+hacks.el -*- lexical-binding: t; -*-
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
;; What follows are all the hacks needed to get various parts of Emacs and other
|
|
|
|
;; plugins to cooperate with the popup management system. Essentially, it comes
|
|
|
|
;; down to:
|
|
|
|
;;
|
|
|
|
;; 1. Making plugins that control their own window environment less greedy (e.g.
|
2019-07-10 12:35:00 +02:00
|
|
|
;; org agenda, which tries to reconfigure the entire frame by deleting all
|
|
|
|
;; other windows just to pop up one tiny window).
|
2018-01-07 15:04:33 -05:00
|
|
|
;; 2. Forcing plugins to use `display-buffer' and `pop-to-buffer' instead of
|
|
|
|
;; `switch-to-buffer' (which is unaffected by `display-buffer-alist', which
|
|
|
|
;; this module heavily relies on).
|
|
|
|
;; 3. Closing popups (temporarily) before functions that are highly destructive
|
|
|
|
;; to the illusion of popup control get run (with the use of the
|
2018-03-24 04:52:50 -04:00
|
|
|
;; `save-popups!' macro).
|
2018-01-07 15:04:33 -05:00
|
|
|
;;
|
|
|
|
;; Keep in mind, all this black magic may break in future updates, and will need
|
2019-07-10 12:35:00 +02:00
|
|
|
;; to be watched carefully for corner cases. Also, once this file is loaded,
|
|
|
|
;; many of its changes are irreversible without restarting Emacs! I don't like
|
|
|
|
;; it either, but I will address this over time.
|
2018-01-07 15:04:33 -05:00
|
|
|
;;
|
|
|
|
;; Hacks should be kept in alphabetical order, named after the feature they
|
2019-07-10 12:35:00 +02:00
|
|
|
;; modify, and should follow a ;;;## package-name header line (if not using
|
|
|
|
;; `after!' or `def-package!').
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
;;
|
2019-05-08 00:58:40 -04:00
|
|
|
;;; Core functions
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
;; Don't try to resize popup windows
|
2019-07-22 04:46:14 +02:00
|
|
|
(advice-add #'balance-windows :around #'+popup-save-a)
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
2019-05-08 00:58:40 -04:00
|
|
|
;;; External functions
|
2018-01-07 15:04:33 -05:00
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package buff-menu
|
2018-12-06 17:50:32 -05:00
|
|
|
(define-key Buffer-menu-mode-map (kbd "RET") #'Buffer-menu-other-window)
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package company
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--dont-select-me-a (orig-fn &rest args)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'company-show-doc-buffer
|
|
|
|
(let ((+popup--inhibit-select t))
|
|
|
|
(apply orig-fn args)))
|
2018-04-23 01:21:07 -04:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package eshell
|
2018-08-03 23:56:28 +02:00
|
|
|
(progn
|
2018-01-07 20:21:43 -05:00
|
|
|
(setq eshell-destroy-buffer-when-process-dies t)
|
|
|
|
|
|
|
|
;; When eshell runs a visual command (see `eshell-visual-commands'), it spawns
|
|
|
|
;; a term buffer to run it in, but where it spawns it is the problem...
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--eshell-undedicate-popup (&rest _)
|
2018-01-07 20:21:43 -05:00
|
|
|
"Force spawned term buffer to share with the eshell popup (if necessary)."
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:before #'eshell-exec-visual
|
2018-01-07 21:52:54 -05:00
|
|
|
(when (+popup-window-p)
|
2018-01-07 20:21:43 -05:00
|
|
|
(set-window-dedicated-p nil nil)
|
|
|
|
(add-transient-hook! #'eshell-query-kill-processes :after
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
(set-window-dedicated-p nil t)))))
|
2018-01-07 20:21:43 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package evil
|
2018-08-03 23:56:28 +02:00
|
|
|
(progn
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
;; Make evil-mode cooperate with popups
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--evil-command-window-a (hist cmd-key execute-fn)
|
2019-01-05 15:20:49 -05:00
|
|
|
"Monkey patch the evil command window to use `pop-to-buffer' instead of
|
|
|
|
`switch-to-buffer', allowing the popup manager to handle it."
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:override #'evil-command-window
|
2018-01-07 20:21:43 -05:00
|
|
|
(when (eq major-mode 'evil-command-window-mode)
|
|
|
|
(user-error "Cannot recursively open command line window"))
|
|
|
|
(dolist (win (window-list))
|
|
|
|
(when (equal (buffer-name (window-buffer win))
|
|
|
|
"*Command Line*")
|
|
|
|
(kill-buffer (window-buffer win))
|
|
|
|
(delete-window win)))
|
|
|
|
(setq evil-command-window-current-buffer (current-buffer))
|
|
|
|
(ignore-errors (kill-buffer "*Command Line*"))
|
|
|
|
(with-current-buffer (pop-to-buffer "*Command Line*")
|
|
|
|
(setq-local evil-command-window-execute-fn execute-fn)
|
|
|
|
(setq-local evil-command-window-cmd-key cmd-key)
|
|
|
|
(evil-command-window-mode)
|
|
|
|
(evil-command-window-insert-commands hist)))
|
|
|
|
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--evil-command-window-execute-a ()
|
2018-01-07 20:21:43 -05:00
|
|
|
"Execute the command under the cursor in the appropriate buffer, rather than
|
|
|
|
the command buffer."
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:override #'evil-command-window-execute
|
2018-01-07 20:21:43 -05:00
|
|
|
(interactive)
|
|
|
|
(let ((result (buffer-substring (line-beginning-position)
|
|
|
|
(line-end-position)))
|
|
|
|
(execute-fn evil-command-window-execute-fn)
|
2018-01-10 10:09:03 +08:00
|
|
|
(execute-window (get-buffer-window evil-command-window-current-buffer))
|
2018-01-07 20:21:43 -05:00
|
|
|
(popup (selected-window)))
|
2018-01-10 10:09:03 +08:00
|
|
|
(if execute-window
|
|
|
|
(select-window execute-window)
|
2018-01-07 20:21:43 -05:00
|
|
|
(user-error "Originating buffer is no longer active"))
|
|
|
|
;; (kill-buffer "*Command Line*")
|
2018-01-10 17:39:12 +08:00
|
|
|
(delete-window popup)
|
2018-01-07 20:21:43 -05:00
|
|
|
(funcall execute-fn result)
|
|
|
|
(setq evil-command-window-current-buffer nil)))
|
|
|
|
|
|
|
|
;; Don't mess with popups
|
2019-07-22 04:46:14 +02:00
|
|
|
(advice-add #'+evil--window-swap :around #'+popup-save-a)
|
|
|
|
(advice-add #'evil-window-move-very-bottom :around #'+popup-save-a)
|
|
|
|
(advice-add #'evil-window-move-very-top :around #'+popup-save-a)
|
|
|
|
(advice-add #'evil-window-move-far-left :around #'+popup-save-a)
|
|
|
|
(advice-add #'evil-window-move-far-right :around #'+popup-save-a))
|
2018-01-07 20:21:43 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package help-mode
|
2018-01-07 15:04:33 -05:00
|
|
|
(after! help-mode
|
|
|
|
(defun doom--switch-from-popup (location)
|
2018-06-17 17:26:15 +02:00
|
|
|
(let (origin enable-local-variables)
|
2018-01-07 15:04:33 -05:00
|
|
|
(save-popups!
|
|
|
|
(switch-to-buffer (car location) nil t)
|
|
|
|
(if (not (cdr location))
|
|
|
|
(message "Unable to find location in file")
|
|
|
|
(goto-char (cdr location))
|
|
|
|
(recenter)
|
|
|
|
(setq origin (selected-window))))
|
|
|
|
(select-window origin)))
|
|
|
|
|
|
|
|
;; Help buffers use `pop-to-window' to decide where to open followed links,
|
|
|
|
;; which can be unpredictable. It should *only* replace the original buffer we
|
|
|
|
;; opened the popup from. To fix this these three button types need to be
|
|
|
|
;; redefined to set aside the popup before following a link.
|
|
|
|
(define-button-type 'help-function-def
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function
|
|
|
|
(lambda (fun file)
|
|
|
|
(require 'find-func)
|
|
|
|
(when (eq file 'C-source)
|
|
|
|
(setq file (help-C-file-name (indirect-function fun) 'fun)))
|
|
|
|
(doom--switch-from-popup (find-function-search-for-symbol fun nil file))))
|
|
|
|
|
|
|
|
(define-button-type 'help-variable-def
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function
|
|
|
|
(lambda (var &optional file)
|
|
|
|
(when (eq file 'C-source)
|
|
|
|
(setq file (help-C-file-name var 'var)))
|
|
|
|
(doom--switch-from-popup (find-variable-noselect var file))))
|
|
|
|
|
|
|
|
(define-button-type 'help-face-def
|
|
|
|
:supertype 'help-xref
|
|
|
|
'help-function
|
|
|
|
(lambda (fun file)
|
|
|
|
(require 'find-func)
|
|
|
|
(doom--switch-from-popup (find-function-search-for-symbol fun 'defface file)))))
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package helpful
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--helpful-open-in-origin-window-a (button)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
"Open links in non-popup, originating window rather than helpful's window."
|
|
|
|
:override #'helpful--navigate
|
|
|
|
(let ((path (substring-no-properties (button-get button 'path)))
|
|
|
|
enable-local-variables
|
|
|
|
origin)
|
|
|
|
(save-popups!
|
|
|
|
(find-file path)
|
|
|
|
(when-let (pos (get-text-property button 'position
|
|
|
|
(marker-buffer button)))
|
|
|
|
(goto-char pos))
|
|
|
|
(setq origin (selected-window))
|
|
|
|
(recenter))
|
|
|
|
(select-window origin)))
|
2018-01-21 21:37:15 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package helm
|
|
|
|
;;;###package helm-ag
|
2018-08-24 01:09:53 +02:00
|
|
|
(when (featurep! :completion helm)
|
2019-07-22 04:46:14 +02:00
|
|
|
(setq helm-default-display-buffer-functions '(+popup-display-buffer-stacked-side-window-fn))
|
2018-07-21 01:20:05 +02:00
|
|
|
|
2018-09-18 21:38:41 -04:00
|
|
|
;; Fix #897: "cannot open side window" error when TAB-completing file links
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--helm-hide-org-links-popup-a (orig-fn &rest args)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'org-insert-link
|
2018-09-18 21:38:41 -04:00
|
|
|
(cl-letf* ((old-org-completing-read (symbol-function 'org-completing-read))
|
|
|
|
((symbol-function 'org-completing-read)
|
|
|
|
(lambda (&rest args)
|
2019-06-25 21:38:16 +02:00
|
|
|
(when-let (win (get-buffer-window "*Org Links*"))
|
2019-01-05 15:20:49 -05:00
|
|
|
;; While helm is opened as a popup, it will mistaken the
|
|
|
|
;; *Org Links* popup for the "originated window", and will
|
|
|
|
;; target it for actions invoked by the user. However, since
|
|
|
|
;; *Org Links* is a popup too (they're dedicated side
|
|
|
|
;; windows), Emacs complains about being unable to split a
|
|
|
|
;; side window. The simple fix: get rid of *Org Links*!
|
2018-09-18 21:38:41 -04:00
|
|
|
(delete-window win)
|
2019-01-05 15:20:49 -05:00
|
|
|
;; But it must exist for org to clean up later.
|
2018-09-18 21:38:41 -04:00
|
|
|
(get-buffer-create "*Org Links*"))
|
|
|
|
(apply old-org-completing-read args))))
|
|
|
|
(apply orig-fn args)))
|
|
|
|
|
2018-07-21 01:20:05 +02:00
|
|
|
;; Fix left-over popup window when closing persistent help for `helm-M-x'
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--helm-elisp--persistent-help-a (candidate _fun &optional _name)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:before #'helm-elisp--persistent-help
|
2018-07-21 01:20:05 +02:00
|
|
|
(let (win)
|
|
|
|
(when (and (helm-attr 'help-running-p)
|
|
|
|
(string= candidate (helm-attr 'help-current-symbol))
|
|
|
|
(setq win (get-buffer-window (get-buffer (help-buffer)))))
|
|
|
|
(delete-window win))))
|
2018-08-24 01:09:53 +02:00
|
|
|
|
|
|
|
;; `helm-ag'
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--helm-pop-to-buffer-a (orig-fn &rest args)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'helm-ag--edit
|
2018-06-02 20:32:52 +02:00
|
|
|
(pop-to-buffer
|
|
|
|
(save-window-excursion (apply orig-fn args)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
(current-buffer)))))
|
2018-06-02 20:32:52 +02:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package ibuffer
|
2018-06-16 10:22:59 +02:00
|
|
|
(setq ibuffer-use-other-window t)
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package Info
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--switch-to-info-window-a (&rest _)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:after #'info-lookup-symbol
|
2019-06-25 21:38:16 +02:00
|
|
|
(when-let (win (get-buffer-window "*info*"))
|
2018-03-26 03:07:01 -04:00
|
|
|
(when (+popup-window-p win)
|
|
|
|
(select-window win))))
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package multi-term
|
2018-06-14 19:55:36 +02:00
|
|
|
(setq multi-term-buffer-name "doom terminal")
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package neotree
|
2018-01-07 15:04:33 -05:00
|
|
|
(after! neotree
|
2018-01-11 22:17:35 -05:00
|
|
|
(advice-add #'neo-util--set-window-width :override #'ignore)
|
2018-01-07 15:04:33 -05:00
|
|
|
(advice-remove #'balance-windows #'ad-Advice-balance-windows))
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package org
|
2018-01-07 15:04:33 -05:00
|
|
|
(after! org
|
2019-07-10 12:35:00 +02:00
|
|
|
;; Org has a scorched-earth window management policy I'm not fond of. i.e. it
|
|
|
|
;; kills all other windows just so it can monopolize the frame. No thanks. We
|
|
|
|
;; can do better ourselves.
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--suppress-delete-other-windows-a (orig-fn &rest args)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around '(org-add-log-note
|
|
|
|
org-capture-place-template
|
|
|
|
org-export--dispatch-ui
|
|
|
|
org-agenda-get-restriction-and-command
|
2019-09-09 14:25:23 -04:00
|
|
|
org-fast-tag-selection
|
|
|
|
org-fast-todo-selection)
|
2018-01-07 15:04:33 -05:00
|
|
|
(if +popup-mode
|
2019-09-10 14:54:13 -04:00
|
|
|
(cl-letf (((symbol-function #'delete-other-windows)
|
|
|
|
(symbol-function #'ignore)))
|
2018-01-07 15:04:33 -05:00
|
|
|
(apply orig-fn args))
|
|
|
|
(apply orig-fn args)))
|
2019-07-10 12:35:00 +02:00
|
|
|
|
2019-09-09 14:25:23 -04:00
|
|
|
(defadvice! +popup--org-fix-popup-window-shrinking-a (orig-fn &rest args)
|
2019-07-10 12:35:00 +02:00
|
|
|
"Hides the mode-line in *Org tags* buffer so you can actually see its
|
|
|
|
content and displays it in a side window without deleting all other windows.
|
|
|
|
Ugh, such an ugly hack."
|
2019-09-09 14:25:23 -04:00
|
|
|
:around '(org-fast-tag-selection
|
|
|
|
org-fast-todo-selection)
|
2019-07-10 12:35:00 +02:00
|
|
|
(if +popup-mode
|
2019-09-10 14:54:13 -04:00
|
|
|
(cl-letf* ((old-fit-buffer-fn (symbol-function #'org-fit-window-to-buffer))
|
|
|
|
((symbol-function #'org-fit-window-to-buffer)
|
2019-07-10 12:35:00 +02:00
|
|
|
(lambda (&optional window max-height min-height shrink-only)
|
|
|
|
(when-let (buf (window-buffer window))
|
|
|
|
(delete-window window)
|
2019-09-10 14:54:13 -04:00
|
|
|
(select-window
|
|
|
|
(setq window (display-buffer-at-bottom buf nil)))
|
2019-07-10 12:35:00 +02:00
|
|
|
(with-current-buffer buf
|
|
|
|
(setq mode-line-format nil)))
|
|
|
|
(funcall old-fit-buffer-fn window max-height min-height shrink-only))))
|
|
|
|
(apply orig-fn args))
|
|
|
|
(apply orig-fn args)))
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
;; Ensure todo, agenda, and other minor popups are delegated to the popup system.
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--org-pop-to-buffer-a (orig-fn buf &optional norecord)
|
2018-01-07 15:04:33 -05:00
|
|
|
"Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'org-switch-to-buffer-other-window
|
2018-01-07 15:04:33 -05:00
|
|
|
(if +popup-mode
|
2018-06-25 19:35:59 +02:00
|
|
|
(pop-to-buffer buf nil norecord)
|
2019-09-10 14:54:13 -04:00
|
|
|
(funcall orig-fn buf norecord))))
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package persp-mode
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--persp-mode-restore-popups-a (&rest _)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
"Restore popup windows when loading a perspective from file."
|
|
|
|
:after #'persp-load-state-from-file
|
|
|
|
(dolist (window (window-list))
|
|
|
|
(when (+popup-parameter 'popup window)
|
|
|
|
(+popup--init window nil))))
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package pdf-tools
|
2018-06-14 19:55:36 +02:00
|
|
|
(after! pdf-tools
|
|
|
|
(setq tablist-context-window-display-action
|
2019-07-22 04:46:14 +02:00
|
|
|
'((+popup-display-buffer-stacked-side-window-fn)
|
2018-06-14 19:55:36 +02:00
|
|
|
(side . left)
|
|
|
|
(slot . 2)
|
|
|
|
(window-height . 0.3)
|
|
|
|
(inhibit-same-window . t))
|
|
|
|
pdf-annot-list-display-buffer-action
|
2019-07-22 04:46:14 +02:00
|
|
|
'((+popup-display-buffer-stacked-side-window-fn)
|
2018-06-14 19:55:36 +02:00
|
|
|
(side . left)
|
|
|
|
(slot . 3)
|
|
|
|
(inhibit-same-window . t)))
|
|
|
|
|
|
|
|
(add-hook 'pdf-annot-list-mode-hook #'hide-mode-line-mode)
|
2018-06-15 02:58:12 +02:00
|
|
|
(set-popup-rule! "\\(^\\*Contents\\|'s annots\\*$\\)" :ignore t))
|
2018-01-07 20:21:43 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package profiler
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--profiler-report-find-entry-in-other-window-a (orig-fn function)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'profiler-report-find-entry
|
2019-03-13 19:20:37 -04:00
|
|
|
(cl-letf (((symbol-function 'find-function)
|
|
|
|
(symbol-function 'find-function-other-window)))
|
|
|
|
(funcall orig-fn function)))
|
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package wgrep
|
2018-01-07 15:04:33 -05:00
|
|
|
(progn
|
|
|
|
;; close the popup after you're done with a wgrep buffer
|
2019-07-22 04:46:14 +02:00
|
|
|
(advice-add #'wgrep-abort-changes :after #'+popup-close-a)
|
|
|
|
(advice-add #'wgrep-finish-edit :after #'+popup-close-a))
|
2018-01-07 15:04:33 -05:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package which-key
|
2018-10-03 00:50:06 -04:00
|
|
|
(after! which-key
|
2018-10-03 02:32:22 -04:00
|
|
|
(when (eq which-key-popup-type 'side-window)
|
2018-10-03 00:50:06 -04:00
|
|
|
(setq which-key-popup-type 'custom
|
|
|
|
which-key-custom-popup-max-dimensions-function (lambda (_) (which-key--side-window-max-dimensions))
|
|
|
|
which-key-custom-hide-popup-function #'which-key--hide-buffer-side-window
|
|
|
|
which-key-custom-show-popup-function
|
|
|
|
(lambda (act-popup-dim)
|
|
|
|
(cl-letf (((symbol-function 'display-buffer-in-side-window)
|
|
|
|
(lambda (buffer alist)
|
2019-07-22 04:46:14 +02:00
|
|
|
(+popup-display-buffer-stacked-side-window-fn
|
2018-10-03 00:50:06 -04:00
|
|
|
buffer (append '((vslot . -9999)) alist)))))
|
|
|
|
(which-key--show-buffer-side-window act-popup-dim))))))
|
2018-03-21 16:37:08 -04:00
|
|
|
|
|
|
|
|
2019-05-08 00:58:40 -04:00
|
|
|
;;;###package windmove
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
;; Users should be able to hop into popups easily, but Elisp shouldn't.
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +popup--ignore-window-parameters-a (orig-fn &rest args)
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
"Allow *interactive* window moving commands to traverse popups."
|
|
|
|
:around '(windmove-up windmove-down windmove-left windmove-right)
|
|
|
|
(cl-letf (((symbol-function #'windmove-find-other-window)
|
|
|
|
(lambda (dir &optional arg window)
|
|
|
|
(window-in-direction
|
|
|
|
(pcase dir (`up 'above) (`down 'below) (_ dir))
|
|
|
|
window (bound-and-true-p +popup-mode) arg windmove-wrap-around t))))
|
|
|
|
(apply orig-fn args)))
|