💥 Drop Emacs 25.x support

Emacs 26.1 is Doom's new minimum supported version

Closes #2026
This commit is contained in:
Henrik Lissner 2019-11-07 12:49:30 -05:00
parent 9cb535043c
commit 99cd52e70f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
33 changed files with 48 additions and 426 deletions

View file

@ -16,8 +16,8 @@ jobs:
strategy:
matrix:
emacs_version:
- 25.3
- 26.1
- 26.3
- snapshot
include:
- emacs_version: 26.3

View file

@ -2,7 +2,7 @@
<img src="https://img.shields.io/github/tag/hlissner/doom-emacs.svg?label=release&color=orange" alt="Made with Doom Emacs">
</a>
<a href="https://emacs.org">
<img src="https://img.shields.io/badge/Made_for-Emacs_25.3+-blueviolet.svg" alt="Made for Emacs 25.3+">
<img src="https://img.shields.io/badge/Made_for-Emacs_26.1+-blueviolet.svg" alt="Made for Emacs 26.1+">
</a>
<a href="https://github.com/hlissner/doom-emacs/actions">
<img src="https://github.com/hlissner/doom-emacs/workflows/CI/badge.svg" alt="Build status: develop">

View file

@ -1,92 +0,0 @@
;;; core/autoload/line-numbers.el -*- lexical-binding: t; -*-
;;;###if (version< emacs-version "26.1")
;; DEPRECATED This was lifted out of the display-line-numbers library in Emacs
;; 26.1 and modified to use nlinum for Emacs 25.x users. It should be removed
;; should Emacs 25 support be removed.
;;;###autoload
(defvar display-line-numbers t
"Non-nil means display line numbers.
If the value is t, display the absolute number of each line of a buffer
shown in a window. Absolute line numbers count from the beginning of
the current narrowing, or from buffer beginning. If the value is
relative, display for each line not containing the window's point its
relative number instead, i.e. the number of the line relative to the
line showing the window's point.
In either case, line numbers are displayed at the beginning of each
non-continuation line that displays buffer text, i.e. after each newline
character that comes from the buffer. The value visual is like
relative but counts screen lines instead of buffer lines. In practice
this means that continuation lines count as well when calculating the
relative number of a line.
Lisp programs can disable display of a line number of a particular
buffer line by putting the display-line-numbers-disable text property
or overlay property on the first visible character of that line.")
(defgroup display-line-numbers nil "Display line number preferences"
:group 'emacs)
;;;###autoload
(defcustom display-line-numbers-type t
"The default type of line numbers to use in `display-line-numbers-mode'.
See `display-line-numbers' for value options."
:type '(choice (const :tag "Relative line numbers" relative)
(const :tag "Relative visual line numbers" visual)
(other :tag "Absolute line numbers" t)))
;;;###autoload
(defcustom display-line-numbers-grow-only nil
"If non-nil, do not shrink line number width."
:type 'boolean)
;;;###autoload
(defcustom display-line-numbers-width-start nil
"If non-nil, count number of lines to use for line number width.
When `display-line-numbers-mode' is turned on,
`display-line-numbers-width' is set to the minimum width necessary
to display all line numbers in the buffer."
:type 'boolean)
;;;###autoload
(defun line-number-display-width (&optional _)
"Return the width used for displaying line numbers in the
selected window."
(length (save-excursion (goto-char (point-max))
(format-mode-line "%l"))))
(defun display-line-numbers-update-width ()
"Prevent the line number width from shrinking."
(let ((width (line-number-display-width)))
(when (> width (or display-line-numbers-width 1))
(setq display-line-numbers-width width))))
;;;###autoload
(define-minor-mode display-line-numbers-mode
"Toggle display of line numbers in the buffer.
This uses `display-line-numbers' internally.
To change the type of line numbers displayed by default,
customize `display-line-numbers-type'. To change the type while
the mode is on, set `display-line-numbers' directly."
:lighter nil
(cond ((null display-line-numbers-type))
((eq display-line-numbers-type 'relative)
(if display-line-numbers-mode
(nlinum-relative-off)
(nlinum-relative-on)))
((nlinum-mode (if display-line-numbers-mode +1 -1)))))
(defun display-line-numbers--turn-on ()
"Turn on `display-line-numbers-mode'."
(unless (or (minibufferp)
;; taken from linum.el
(and (daemonp) (null (frame-parameter nil 'client))))
(display-line-numbers-mode)))
;;;###autoload
(define-globalized-minor-mode global-display-line-numbers-mode
display-line-numbers-mode display-line-numbers--turn-on)

View file

@ -117,8 +117,7 @@ If DIR is not a project, it will be indexed (but not cached)."
#'projectile-find-file)))
((fboundp 'counsel-file-jump) ; ivy only
(call-interactively #'counsel-file-jump))
((and (fboundp 'project-find-file-in) ; emacs 26.1+ only
(project-current))
((project-current)
(project-find-file-in nil (list default-directory) nil))
((fboundp 'helm-find-files)
(call-interactively #'helm-find-files))

View file

@ -72,21 +72,14 @@ visual-line-mode is on, this skips relative and uses visual instead.
See `display-line-numbers' for what these values mean."
(interactive)
(defvar doom--line-number-style display-line-numbers-type)
;; DEPRECATED
(let* ((styles `(t ,(if (and EMACS26+ visual-line-mode) 'visual 'relative) nil))
(let* ((styles `(t ,(if visual-line-mode 'visual 'relative) nil))
(order (cons display-line-numbers-type (remq display-line-numbers-type styles)))
(queue (memq doom--line-number-style order))
(next (if (= (length queue) 1)
(car order)
(car (cdr queue)))))
(setq doom--line-number-style next)
;; DEPRECATED
(if EMACS26+
(setq display-line-numbers next)
(pcase next
(`t (nlinum-relative-off) (nlinum-mode +1))
(`relative (nlinum-relative-on))
(`nil (nlinum-mode -1))))
(setq display-line-numbers next)
(message "Switched to %s line numbers"
(pcase next
(`t "normal")

View file

@ -3,41 +3,6 @@
(require 'cl-lib)
(require 'subr-x)
;; DEPRECATED Polyfills
(unless EMACS26+
(with-no-warnings
;; `kill-current-buffer' was introduced in Emacs 26
(defalias 'kill-current-buffer #'kill-this-buffer)
;; if-let and when-let were moved to (if|when)-let* in Emacs 26+ so we alias
;; them for 25 users.
(defalias 'if-let* #'if-let)
(defalias 'when-let* #'when-let)
;; `mapcan' was introduced in 26.1. `cl-mapcan' isn't a perfect replacement,
;; but it's close enough.
(defalias 'mapcan #'cl-mapcan)
(defun alist-get (key alist &optional default remove testfn)
"Return the value associated with KEY in ALIST.
If KEY is not found in ALIST, return DEFAULT.
Use TESTFN to lookup in the alist if non-nil. Otherwise, use `assq'.
This is a generalized variable suitable for use with `setf'.
When using it to set a value, optional argument REMOVE non-nil
means to remove KEY from ALIST if the new value is `eql' to DEFAULT."
(ignore remove) ;;Silence byte-compiler.
(let ((x (if (not testfn)
(assq key alist)
;; In Emacs<26, `assoc' has no testfn arg, so we have to
;; implement it ourselves
(if testfn
(cl-loop for entry in alist
if (funcall testfn key entry)
return entry)
(assoc key alist)))))
(if x (cdr x) default)))))
;;
;;; Helpers

View file

@ -512,79 +512,6 @@ treat Emacs as a non-application window."
(defun doom-enable-line-numbers-h () (display-line-numbers-mode +1))
(defun doom-disable-line-numbers-h () (display-line-numbers-mode -1))
;; DEPRECATED `nlinum' is used for Emacs 25 users; 26+ has native line numbers.
(use-package! nlinum
;; Line number column. A faster (or equivalent, in the worst case) line number
;; plugin than `linum-mode'.
:unless EMACS26+
:defer t
:init
(defvar doom-line-number-lpad 4
"How much padding to place before line numbers.")
(defvar doom-line-number-rpad 1
"How much padding to place after line numbers.")
(defvar doom-line-number-pad-char 32
"Character to use for padding line numbers.
By default, this is a space character. If you use `whitespace-mode' with
`space-mark', the whitespace in line numbers will be affected (this can look
ugly). In this case, you can change this to ?\u2002, which is a unicode
character that looks like a space that `whitespace-mode' won't affect.")
:config
(setq nlinum-highlight-current-line t)
;; Fix lingering hl-line overlays (caused by nlinum)
(add-hook! 'hl-line-mode-hook
(remove-overlays (point-min) (point-max) 'face 'hl-line))
(defun doom-nlinum-format-fn (line _width)
"A more customizable `nlinum-format-function'. See `doom-line-number-lpad',
`doom-line-number-rpad' and `doom-line-number-pad-char'. Allows a fix for
`whitespace-mode' space-marks appearing inside the line number."
(let ((str (number-to-string line)))
(setq str (concat (make-string (max 0 (- doom-line-number-lpad (length str)))
doom-line-number-pad-char)
str
(make-string doom-line-number-rpad doom-line-number-pad-char)))
(put-text-property 0 (length str) 'face
(if (and nlinum-highlight-current-line
(= line nlinum--current-line))
'nlinum-current-line
'linum)
str)
str))
(setq nlinum-format-function #'doom-nlinum-format-fn)
(add-hook! 'nlinum-mode-hook
(defun doom-init-nlinum-width-h ()
"Calculate line number column width beforehand (optimization)."
(setq nlinum--width
(length (save-excursion (goto-char (point-max))
(format-mode-line "%l")))))))
(use-package! nlinum-hl
;; Fixes disappearing line numbers in nlinum and other quirks
:unless EMACS26+
:after nlinum
:config
;; With `markdown-fontify-code-blocks-natively' enabled in `markdown-mode',
;; line numbers tend to vanish next to code blocks.
(advice-add #'markdown-fontify-code-block-natively
:after #'nlinum-hl-do-markdown-fontify-region)
;; When using `web-mode's code-folding an entire range of line numbers will
;; vanish in the affected area.
(advice-add #'web-mode-fold-or-unfold :after #'nlinum-hl-do-generic-flush)
;; Changing fonts can leave nlinum line numbers in their original size; this
;; forces them to resize.
(add-hook 'after-setting-font-hook #'nlinum-hl-flush-all-windows))
(use-package! nlinum-relative
:unless EMACS26+
:defer t
:config
(setq nlinum-format " %d ")
(add-hook 'evil-mode-hook #'nlinum-relative-setup-evil))
;;
;;; Theme & font

View file

@ -1,13 +1,12 @@
;;; core.el --- the heart of the beast -*- lexical-binding: t; -*-
(when (version< emacs-version "25.3")
(error "Detected Emacs %s. Doom only supports Emacs 25.3 and higher"
(when (version< emacs-version "26.1")
(error "Detected Emacs %s. Doom only supports Emacs 26.1 and higher"
emacs-version))
(defconst doom-version "2.0.9"
"Current version of Doom Emacs.")
(defconst EMACS26+ (> emacs-major-version 25))
(defconst EMACS27+ (> emacs-major-version 26))
(defconst IS-MAC (eq system-type 'darwin))
(defconst IS-LINUX (eq system-type 'gnu/linux))

View file

@ -9,12 +9,6 @@
(package! all-the-icons)
(package! hide-mode-line)
(package! highlight-numbers)
;; Some early 26.x builds of Emacs do not have `display-line-numbers' yet, so
;; check for it instead of Emacs' version.
(unless (locate-library "display-line-numbers")
(package! nlinum)
(package! nlinum-hl)
(package! nlinum-relative))
(package! rainbow-delimiters)
(package! restart-emacs)

View file

@ -62,7 +62,7 @@
(use-package! company-box
:when (and EMACS26+ (featurep! +childframe))
:when (featurep! +childframe)
:hook (company-mode . company-box-mode)
:config
(setq company-box-show-single-candidate t

View file

@ -4,5 +4,5 @@
(package! company)
(package! company-dict)
(package! company-prescient)
(when (and EMACS26+ (featurep! +childframe))
(when (featurep! +childframe)
(package! company-box))

View file

@ -82,7 +82,7 @@ be negative.")
(setq helm-default-prompt-display-function #'+helm--set-prompt-display))
:init
(when (and EMACS26+ (featurep! +childframe))
(when (featurep! +childframe)
(setq helm-display-function #'+helm-posframe-display-fn))
(let ((fuzzy (featurep! +fuzzy)))

View file

@ -10,7 +10,7 @@
(package! swiper-helm)
(when (featurep! +fuzzy)
(package! helm-flx))
(when (and EMACS26+ (featurep! +childframe))
(when (featurep! +childframe)
(package! posframe))
(when (featurep! :lang org)
(package! helm-org))

View file

@ -324,7 +324,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(use-package! ivy-posframe
:when (and EMACS26+ (featurep! +childframe))
:when (featurep! +childframe)
:hook (ivy-mode . ivy-posframe-mode)
:config
(setq ivy-fixed-height-minibuffer nil

View file

@ -1,5 +1,3 @@
;; -*- lexical-binding: t; no-byte-compile: t; -*-
;;; completion/ivy/doctor.el
(when (and (not EMACS26+) (featurep! +childframe))
(error! "The +childframe feature requires Emacs 26+"))

View file

@ -15,7 +15,7 @@
(when (featurep! +fuzzy)
(package! flx)))
(when (and EMACS26+ (featurep! +childframe))
(when (featurep! +childframe)
(package! ivy-posframe))
(when (featurep! +icons)

View file

@ -220,7 +220,7 @@ and complains if a module is loaded too early (during startup)."
(add-transient-hook! 'emacs-lisp-mode
(+evil-collection-init 'elisp-mode))
(add-transient-hook! 'occur-mode
(+evil-collection-init (if EMACS26+ 'replace "replace")))
(+evil-collection-init 'replace))
(evil-define-key* 'normal process-menu-mode-map
"q" #'kill-current-buffer

View file

@ -6,7 +6,7 @@
(setq ibuffer-show-empty-filter-groups nil
ibuffer-filter-group-name-face '(:inherit (success bold))
ibuffer-formats
`((mark modified read-only ,(if EMACS26+ 'locked "")
`((mark modified read-only locked
,@(if (featurep! +icons)
`(;; Here you may adjust by replacing :right with :center
;; or :left According to taste, if you want the icon

View file

@ -66,14 +66,3 @@ otherwise in default state."
(when (and (bound-and-true-p evil-mode)
(bobp) (eolp))
(evil-insert-state)))))
(after! smerge-mode
(unless EMACS26+
(with-no-warnings
(defalias #'smerge-keep-upper #'smerge-keep-mine)
(defalias #'smerge-keep-lower #'smerge-keep-other)
(defalias #'smerge-diff-base-upper #'smerge-diff-base-mine)
(defalias #'smerge-diff-upper-lower #'smerge-diff-mine-other)
(defalias #'smerge-diff-base-lower #'smerge-diff-base-other))))

View file

@ -7,8 +7,5 @@
(package! yaml-mode)
(package! csv-mode)
(package! dhall-mode)
(package! protobuf-mode :recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*")))
;; DEPRECATED `conf-toml-mode' exists in Emacs 26+
(unless (fboundp 'conf-toml-mode)
(package! toml-mode))
(package! protobuf-mode
:recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*")))

View file

@ -7,43 +7,13 @@
;;
;;; Packages
(use-package! rust-mode
:defer t
:config
(setq rust-indent-method-chain t)
(add-hook 'rust-mode-hook #'rainbow-delimiters-mode)
;; This is necessary because both plugins are fighting for supremacy in
;; `auto-mode-alist', so rustic-mode *must* load second. It only needs to
;; happen once.
;;
;; rust-mode is still required for `racer'.
(add-hook! 'rust-mode-hook
(defun +rust-init-h ()
"Switch to `rustic-mode', if it's available."
(when (require 'rustic nil t)
(rustic-mode))))
(set-docsets! '(rust-mode rustic-mode) "Rust")
(when (featurep! +lsp)
(add-hook 'rust-mode-local-vars-hook #'lsp!)))
(use-package! racer
:unless (featurep! +lsp)
:hook ((rust-mode rustic-mode) . racer-mode)
:config
(set-lookup-handlers! 'rust-mode
:definition '(racer-find-definition :async t)
:documentation '+rust-racer-lookup-documentation))
(use-package! rustic
:when EMACS26+
:after rust-mode
:mode ("\\.rs$" . rustic-mode)
:preface
(setq rustic-rls-pkg (if (featurep! +lsp) 'lsp-mode))
:config
(set-docsets! 'rustic-mode "Rust")
(setq rustic-indent-method-chain t
rustic-flycheck-setup-mode-line-p nil
;; use :editor format instead
@ -52,38 +22,35 @@
;; buffers, so we disable it, but only for evil users, because it
;; affects `forward-sexp' and its ilk. See
;; https://github.com/rust-lang/rust-mode/issues/288.
rustic-match-angle-brackets (not (featurep! :editor evil)))
rustic-match-angle-brackets (not (featurep! :editor evil))
;; `rustic-setup-rls' uses `package-installed-p' to determine if
;; lsp-mode/elgot are available. This breaks because Doom doesn't use
;; package.el to begin with (and lazy loads it). This is already handled
;; by the :tools lsp module, so...
rustic-lsp-setup-p nil)
(add-hook 'rustic-mode-hook #'rainbow-delimiters-mode)
(defadvice! +rust--dont-install-packages-p (orig-fn &rest args)
:around #'rustic-setup-rls
(cl-letf (;; `rustic-setup-rls' uses `package-installed-p' to determine if
;; lsp-mode/elgot are available. This breaks because Doom doesn't
;; use package.el to begin with (and lazy loads it).
((symbol-function #'package-installed-p)
(lambda (pkg)
(require pkg nil t)))
;; If lsp/elgot isn't available, it attempts to install lsp-mode
;; via package.el. Doom manages its own dependencies so we disable
;; that behavior.
((symbol-function #'rustic-install-rls-client-p)
(lambda (&rest _)
(message "No RLS server running"))))
(apply orig-fn args))))
(when (featurep! +lsp)
(add-hook 'rustic-mode-local-vars-hook #'lsp!)))
(use-package! racer
:unless (featurep! +lsp)
:hook (rustic-mode . racer-mode)
:config
(set-lookup-handlers! 'rustic-mode
:definition '(racer-find-definition :async t)
:documentation '+rust-racer-lookup-documentation))
;;
;;; Tools
(use-package! cargo
:after rust-mode
:after rustic-mode
:config
(defvar +rust-keymap
(if (boundp 'rustic-mode-map)
rustic-mode-map
rust-mode-map))
(map! :map +rust-keymap
(map! :map rustic-mode-map
:localleader
(:prefix ("b" . "build")
:desc "cargo add" "a" #'cargo-process-add

View file

@ -1,9 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; lang/rust/packages.el
(when EMACS26+
(package! rustic))
(package! rust-mode)
(package! rustic)
(unless (featurep! +lsp)
(package! racer))

View file

@ -28,12 +28,6 @@
(after! css-mode
;; css-mode hooks apply to scss and less-css modes
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
(set-company-backend! '(css-mode scss-mode)
(if EMACS26+
;; DEPRECATED css-mode's built in completion is superior in 26+
'company-capf
'company-css))
(map! :localleader
:map scss-mode-map
"b" #'+css/scss-build

View file

@ -41,12 +41,7 @@
(setcdr alist
(cl-loop for pair in (cdr alist)
unless (string-match-p "^[a-z-]" (cdr pair))
collect (cons (car pair)
;; TODO Replace with `string-trim-right' (Emacs 26+)
(let ((string (cdr pair)))
(if (string-match "\\(?:>\\|]\\|}\\)+\\'" string)
(replace-match "" t t string)
string))))))
collect (cons (car pair) (string-trim-right (cdr pair))))))
(delq! nil web-mode-engines-auto-pairs))
(map! :map web-mode-map

View file

@ -12,7 +12,7 @@
;; +css.el
(package! css-mode :built-in t)
(package! less-css-mode :built-in (not (version< emacs-version "26.1")))
(package! less-css-mode :built-in t)
(package! sass-mode)
(package! stylus-mode)

View file

@ -63,7 +63,6 @@ errors.")
(use-package! flycheck-posframe
:when EMACS26+
:when (featurep! +childframe)
:defer t
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)

View file

@ -3,5 +3,5 @@
(package! flycheck)
(package! flycheck-popup-tip)
(when (and EMACS26+ (featurep! +childframe))
(when (featurep! +childframe)
(package! flycheck-posframe))

View file

@ -106,8 +106,7 @@ Also logs the resolved project root, if found."
(defun +lsp-init-ui-flycheck-or-flymake-h ()
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
(cond ((eq :none lsp-prefer-flymake))
((and (not (version< emacs-version "26.1"))
lsp-prefer-flymake)
(lsp-prefer-flymake
(lsp--flymake-setup))
((require 'flycheck nil t)
(require 'lsp-ui-flycheck)

View file

@ -36,5 +36,5 @@
;; Is built into Emacs 26+
(when (and EMACS26+ (featurep! +auth))
(when (featurep! +auth)
(auth-source-pass-enable))

View file

@ -61,8 +61,8 @@
;; On Emacs 26+, when point is on the last line and solaire-mode is remapping
;; the hl-line face, hl-line's highlight bleeds into the rest of the window
;; after eob.
(when EMACS26+
;; after eob. On Emacs 27 this no longer happens.
(unless EMACS27+
(defun +doom--line-range-fn ()
(cons (line-beginning-position)
(cond ((let ((eol (line-end-position)))

View file

@ -28,9 +28,7 @@ Meant for `doom-change-font-size-hook'."
xlfd-regexp-pixelsize-subnum)))
(scale (frame-parameter nil 'font-scale)))
(setq doom-modeline-height (+ default-height (* scale doom-font-increment))))
(setq doom-modeline-height default-height))
;; already has a variable watcher in Emacs 26+
(unless EMACS26+ (doom-modeline-refresh-bars))))
(setq doom-modeline-height default-height))))
;;;###autoload
(defun +modeline-update-env-in-all-windows-h (&rest _)

View file

@ -139,11 +139,6 @@ default window parameters for popup windows, clears leftover transient timers
and enables `+popup-buffer-mode'."
(with-selected-window window
(setq alist (delq (assq 'actions alist) alist))
(when (and alist +popup--populate-wparams)
;; Emacs 26+ will automatically map the window-parameters alist entry to
;; the popup window, so we need this for Emacs 25.x users
(dolist (param (cdr (assq 'window-parameters alist)))
(set-window-parameter window (car param) (cdr param))))
(set-window-parameter window 'popup t)
(set-window-parameter window 'split-window #'+popup--split-window)
(set-window-parameter window 'delete-window #'+popup--delete-window)
@ -617,94 +612,3 @@ This advice ensures backwards compatibility for Emacs <= 26 users."
(when (and (windowp window) display-buffer-mark-dedicated)
(set-window-dedicated-p window display-buffer-mark-dedicated))
window))
;; DEPRECATED
(unless EMACS26+
(defvar window-sides-reversed nil)
(defun window--sides-reverse-on-frame-p (frame)
"Return non-nil when side windows should appear reversed on FRAME.
This uses some heuristics to guess the user's intentions when the
selected window of FRAME is a side window ."
(cond
;; Reverse when `window-sides-reversed' is t. Do not reverse when
;; `window-sides-reversed' is nil.
((memq window-sides-reversed '(nil t))
window-sides-reversed)
;; Reverse when FRAME's selected window shows a right-to-left buffer.
((let ((window (frame-selected-window frame)))
(when (and (not (window-parameter window 'window-side))
(or (not (window-minibuffer-p window))
(setq window (minibuffer-selected-window))))
(with-current-buffer (window-buffer window)
(eq bidi-paragraph-direction 'right-to-left)))))
;; Reverse when FRAME's `window-sides-main-selected-window' parameter
;; specifies a live window showing a right-to-left buffer.
((let ((window (frame-parameter
frame 'window-sides-main-selected-window)))
(when (window-live-p window)
(with-current-buffer (window-buffer window)
(eq bidi-paragraph-direction 'right-to-left)))))
;; Reverse when all windows in FRAME's main window show right-to-left
;; buffers.
(t
(catch 'found
(walk-window-subtree
(lambda (window)
(with-current-buffer (window-buffer window)
(when (eq bidi-paragraph-direction 'left-to-right)
(throw 'found nil))))
(window-main-window frame))
t))))
(defun window--make-major-side-window (buffer side slot &optional alist)
"Display BUFFER in a new major side window on the selected frame.
SIDE must be one of `left', `top', `right' or `bottom'. SLOT
specifies the slot to use. ALIST is an association list of
symbols and values as passed to `display-buffer-in-side-window'.
Return the new window, nil if its creation failed.
This is an auxiliary function of `display-buffer-in-side-window'
and may be called only if no window on SIDE exists yet."
(let* ((left-or-right (memq side '(left right)))
(next-to (window--make-major-side-window-next-to side))
(on-side (cond
((eq side 'top) 'above)
((eq side 'bottom) 'below)
(t side)))
(window--sides-inhibit-check t)
;; The following two bindings will tell `split-window' to take
;; the space for the new window from the selected frame's main
;; window and not make a new parent window unless needed.
(window-combination-resize 'side)
(window-combination-limit nil)
(window (ignore-errors (split-window next-to nil on-side))))
(when window
;; Initialize `window-side' parameter of new window to SIDE and
;; make that parameter persistent.
(set-window-parameter window 'window-side side)
(add-to-list 'window-persistent-parameters '(window-side . writable))
;; Install `window-slot' parameter of new window and make that
;; parameter persistent.
(set-window-parameter window 'window-slot slot)
(add-to-list 'window-persistent-parameters '(window-slot . writable))
;; Auto-adjust height/width of new window unless a size has been
;; explicitly requested.
(unless (if left-or-right
(cdr (assq 'window-width alist))
(cdr (assq 'window-height alist)))
(setq alist
(cons
(cons
(if left-or-right 'window-width 'window-height)
(/ (window-total-size (frame-root-window) left-or-right)
;; By default use a fourth of the size of the frame's
;; root window.
4))
alist)))
(with-current-buffer buffer
(setq window--sides-shown t))
;; Install BUFFER in new window and return WINDOW.
(window--display-buffer buffer window 'window alist 'side))))
(advice-add #'window--sides-check :override #'ignore))

View file

@ -24,7 +24,6 @@ Modifying this has no effect, unless done before ui/popup loads.")
"Size of the margins to give popup windows. Set this to nil to disable margin
adjustment.")
(defvar +popup--populate-wparams (not EMACS26+))
(defvar +popup--inhibit-transient nil)
(defvar +popup--inhibit-select nil)
(defvar +popup--old-display-buffer-alist nil)