Merge branch 'develop' of https://github.com/hlissner/doom-emacs into download-iosevka

This commit is contained in:
James Ravn 2019-11-20 09:47:52 +00:00
commit 825557895c
No known key found for this signature in database
GPG key ID: 52C372C72159D6EE
117 changed files with 1954 additions and 2926 deletions

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

@ -1,46 +1,17 @@
;;; completion/helm/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)
;;
;; Project searching
;;;###autoload (autoload '+helm:grep "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:grep (all-files-p query)
;;;###autoload (autoload '+helm:project-search "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:project-search (all-files-p query)
"Ex interface for `+helm/grep'"
(interactive "<!><a>")
(+helm/grep all-files-p query))
(+helm/project-search all-files-p query))
;;;###autoload (autoload '+helm:ag "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:ag (all-files-p query)
"Ex interface for `+helm/ag'"
(interactive "<!><a>")
(+helm/ag all-files-p query))
;;;###autoload (autoload '+helm:rg "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:rg (all-files-p query)
"Ex interface for `+helm/rg'"
(interactive "<!><a>")
(+helm/rg all-files-p query))
;;;###autoload (autoload '+helm:grep-from-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:grep-from-cwd (query &optional recurse-p)
;;;###autoload (autoload '+helm:project-search-from-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:project-search-from-cwd (query &optional recurse-p)
"Ex interface for `+helm/grep-from-cwd'."
(interactive "<a><!>")
(+helm/grep-from-cwd (not recurse-p) query))
;;;###autoload (autoload '+helm:ag-from-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:ag-from-cwd (query &optional recurse-p)
"Ex interface for `+helm/ag-from-cwd'."
(interactive "<a><!>")
(+helm/ag-from-cwd (not recurse-p) query))
;;;###autoload (autoload '+helm:rg-from-cwd "completion/helm/autoload/evil" nil t)
(evil-define-command +helm:rg-from-cwd (query &optional recurse-p)
"Ex interface for `+helm/rg-from-cwd'."
(interactive "<a><!>")
(+helm/rg-from-cwd (not recurse-p) query))
(+helm/project-search-from-cwd (not recurse-p) query))
;;;###autoload
(defun +helm--set-prompt-display (pos)

View file

@ -1,11 +1,5 @@
;;; completion/helm/autoload/helm.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +helm/tasks (&optional _arg)
(interactive "P")
;; TODO Implement `+helm/tasks'
(error "Not implemented yet"))
;;;###autoload
(defun +helm/projectile-find-file ()
"Call `helm-find-files' if called from HOME, otherwise
@ -41,70 +35,11 @@ workspace."
;;
;; Project search
(defun +helm-ag-search-args (all-files-p recursive-p)
(list (concat "ag " (if IS-WINDOWS "--vimgrep" "--nocolor --nogroup"))
"-S"
(if all-files-p "-z -a")
(unless recursive-p "--depth 1")))
(defun +helm-rg-search-args (all-files-p recursive-p)
(list "rg --no-heading --line-number --color never"
"-S"
(when all-files-p "-z -uu")
(unless recursive-p "--maxdepth 1")))
;;
(defun +helm--grep-source ()
(require 'helm-projectile)
(helm-build-async-source (capitalize (helm-grep-command t))
:header-name (lambda (_name) "Helm Projectile Grep (C-c ? Help)")
:candidates-process #'helm-grep-collect-candidates
:filter-one-by-one #'helm-grep-filter-one-by-one
:candidate-number-limit 9999
:nohighlight t
:keymap helm-grep-map
:history 'helm-grep-history
:action (apply #'helm-make-actions helm-projectile-grep-or-ack-actions)
:persistent-action 'helm-grep-persistent-action
:persistent-help "Jump to line (`C-u' Record in mark ring)"
:requires-pattern 2))
(defun +helm--grep-search (directory query prompt &optional all-files-p recursive-p)
(let* ((default-directory directory)
(helm-ff-default-directory directory)
(helm-grep-in-recurse recursive-p)
(helm-grep-ignored-files
(unless all-files-p
(cl-union (projectile-ignored-files-rel) grep-find-ignored-files)))
(helm-grep-ignored-directories
(unless all-files-p
(cl-union (mapcar 'directory-file-name (projectile-ignored-directories-rel))
grep-find-ignored-directories)))
(helm-grep-default-command
(if (and nil (eq (projectile-project-vcs) 'git))
(format "git --no-pager grep --no-color -n%%c -e %%p %s -- %%f"
(if recursive-p "" "--max-depth 1 "))
(format "grep -si -a%s %%e -n%%cH -e %%p %%f %s"
(if recursive-p " -R" "")
(if recursive-p "." "./*"))))
(helm-grep-default-recurse-command helm-grep-default-command))
(setq helm-source-grep (+helm--grep-source))
(helm :sources 'helm-source-grep
:input query
:prompt prompt
:buffer "*helm grep*"
:default-directory directory
:keymap helm-grep-map
:history 'helm-grep-history
:truncate-lines helm-grep-truncate-lines)))
;;; Project search
;;;###autoload
(cl-defun +helm-file-search (engine &key query in all-files (recursive t))
"Conduct a file search using ENGINE, which can be any of: rg, ag, pt, and
grep. If omitted, ENGINE will default to the first one it detects, in that
order.
(cl-defun +helm-file-search (&key query in all-files (recursive t))
"Conduct a file search using ripgrep.
:query STRING
Determines the initial input to search for.
@ -114,6 +49,8 @@ order.
:recursive BOOL
Whether or not to search files recursively from the base directory."
(declare (indent defun))
(unless (executable-find "rg")
(user-error "Couldn't find ripgrep in your PATH"))
(require 'helm-ag)
(helm-ag--init-state)
(let* ((project-root (or (doom-project-root) default-directory))
@ -121,13 +58,6 @@ order.
(default-directory directory)
(helm-ag--default-directory directory)
(helm-ag--default-target (list directory))
(engine (or engine
(cl-find-if #'executable-find +helm-project-search-engines
:key #'symbol-name)
(and (or (executable-find "grep")
(executable-find "git"))
'grep)
(user-error "No search engine specified (is ag, rg, or git installed?)")))
(query (or query
(when (use-region-p)
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
@ -135,23 +65,20 @@ order.
(when (> (abs (- end beg)) 1)
(rxt-quote-pcre (buffer-substring-no-properties beg end)))))
""))
(prompt (format "[%s %s] "
(symbol-name engine)
(prompt (format "[rg %s] "
(cond ((file-equal-p directory project-root)
(projectile-project-name))
((file-equal-p directory default-directory)
"./")
((file-relative-name directory project-root)))))
(command
(pcase engine
(`ag (+helm-ag-search-args all-files recursive))
(`rg (+helm-rg-search-args all-files recursive))
('grep (+helm--grep-search directory query prompt all-files recursive)
(cl-return t))))
(helm-ag-base-command (string-join command " ")))
(list "rg --no-heading --line-number --color never"
"-S"
(when all-files "-z -uu")
(unless recursive "--maxdepth 1")))
(helm-ag-base-command (string-join (delq nil command) " ")))
;; TODO Define our own sources instead
(helm-attrset 'name (format "[%s %s] Searching %s"
engine
(helm-attrset 'name (format "[rg %s] Searching %s"
(string-join (delq nil (cdr command)) " ")
(abbreviate-file-name directory))
helm-source-do-ag)
@ -159,82 +86,39 @@ order.
(cl-letf (((symbol-function 'helm-do-ag--helm)
(lambda () (helm :sources '(helm-source-do-ag)
:prompt prompt
:buffer "*helm-ag*"
:buffer "*helm-rg*"
:keymap helm-do-ag-map
:input query
:history 'helm-ag--helm-history))))
(helm-do-ag directory))))
(defun +helm--get-command (format)
(cl-loop for tool in (cl-remove-duplicates +helm-project-search-engines :from-end t)
if (executable-find (symbol-name tool))
return (intern (format format tool))))
;;;###autoload
(defun +helm/project-search (&optional arg initial-query directory)
"Performs a project search from the project root.
"Performs a project search from the project root with ripgrep.
Uses the first available search backend from `+helm-project-search-engines'. If
ARG (universal argument), include all files, even hidden or compressed ones, in
the search."
(interactive "P")
(funcall (or (+helm--get-command "+helm/%s")
#'+helm/grep)
arg
initial-query
directory))
(+helm-file-search
:query initial-query
:in directory
:all-files (and (not (null arg))
(listp arg))))
;;;###autoload
(defun +helm/project-search-from-cwd (&optional arg initial-query)
"Performs a project search recursively from the current directory.
Uses the first available search backend from `+helm-project-search-engines'. If
ARG (universal argument), include all files, even hidden or compressed ones."
If ARG (universal argument), include all files, even hidden or compressed ones."
(interactive "P")
(funcall (or (+helm--get-command "+helm/%s-from-cwd")
#'+helm/grep-from-cwd)
arg
initial-query))
(+helm-file-search
:query initial-query
:in default-directory
:all-files (and (not (null arg))
(listp arg))))
;;;###autoload (autoload '+helm/rg "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/rg-from-cwd "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/ag "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/ag-from-cwd "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/grep "completion/helm/autoload/helm" nil t)
;;;###autoload (autoload '+helm/grep-from-cwd "completion/helm/autoload/helm" nil t)
(dolist (engine `(,@(cl-remove-duplicates +helm-project-search-engines :from-end t) grep))
(defalias (intern (format "+helm/%s" engine))
(lambda (arg &optional query directory)
(interactive "P")
(+helm-file-search engine
:query query
:in directory
:all-files (and (not (null arg))
(listp arg))))
(format "Perform a project file search using %s.
QUERY is a regexp. If omitted, the current selection is used. If no selection is
active, the last known search is used.
ARG is the universal argument. If a number is passed through it, e.g. C-u 3, then
If ALL-FILES-P, search compressed and hidden files as well."
engine))
(defalias (intern (format "+helm/%s-from-cwd" engine))
(lambda (arg &optional query)
(interactive "P")
(+helm-file-search engine
:query query
:in default-directory
:all-files (and (not (null arg))
(listp arg))))
(format "Perform a project file search from the current directory using %s.
QUERY is a regexp. If omitted, the current selection is used. If no selection is
active, the last known search is used.
If ALL-FILES-P, search compressed and hidden files as well."
engine)))
;;;###autoload
(defun +helm/jump-list ()
"TODO"
(interactive)
(error "not implemented yet"))

View file

@ -1,15 +1,5 @@
;;; completion/helm/config.el -*- lexical-binding: t; -*-
(defvar +helm-project-search-engines '(rg ag)
"What search tools for `+helm/project-search' (and `+helm-file-search' when no
ENGINE is specified) to try, and in what order.
To disable a particular tool, remove it from this list. To prioritize a tool
over others, move it to the front of the list. Later duplicates in this list are
silently ignored.
This falls back to git-grep (then grep) if none of these available.")
;; Posframe (requires +childframe)
(defvar +helm-posframe-handler #'+helm-poshandler-frame-center-near-bottom-fn
"The function that determines the location of the childframe. It should return
@ -82,7 +72,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)))
@ -135,7 +125,6 @@ be negative.")
:config (helm-flx-mode +1))
;;;###package helm-ag
(after! helm-ag
(map! :map helm-ag-edit-map :n "RET" #'compile-goto-error)
(define-key helm-ag-edit-map [remap quit-window] #'helm-ag--edit-abort)
@ -150,14 +139,12 @@ be negative.")
(setq helm-bookmark-show-location t)
;;;###package helm-files
(after! helm-files
(setq helm-boring-file-regexp-list
(append (list "\\.projects$" "\\.DS_Store$")
helm-boring-file-regexp-list)))
;;;###package helm-locate
(defvar helm-generic-files-map (make-sparse-keymap))
(after! helm-locate
(when (and IS-MAC
@ -167,7 +154,6 @@ be negative.")
(set-keymap-parent helm-generic-files-map helm-map))
;;;###package helm-org
(use-package! helm-org
:when (featurep! :lang org)
:defer t
@ -178,7 +164,6 @@ be negative.")
'(org-set-tags . helm-org-completing-read-tags))))
;;;###package helm-projectile
(use-package! helm-projectile
:commands (helm-projectile-find-file
helm-projectile-recentf
@ -191,7 +176,6 @@ be negative.")
(set-keymap-parent helm-projectile-find-file-map helm-map))
;;;###package swiper-helm
(after! swiper-helm
(setq swiper-helm-display-function
(lambda (buf &optional _resume) (pop-to-buffer buf)))

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

@ -17,7 +17,6 @@
- [[#jump-to-file-project-navigation][Jump-to-file project navigation]]
- [[#project-search--replace][Project search & replace]]
- [[#in-buffer-searching][In-buffer searching]]
- [[#task-lookup][Task lookup]]
- [[#ivy-integration-for-various-completing-commands][Ivy integration for various completing commands]]
- [[#general][General]]
- [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects)]]
@ -29,8 +28,7 @@
* Description
This module provides Ivy integration for a variety of Emacs commands, as well as
a unified interface for project search and replace, powered by ag, rg,
git-grep & grep (whichever is available).
a unified interface for project search and replace, powered by ripgrep.
#+begin_quote
I prefer ivy over ido for its flexibility. I prefer ivy over helm because it's
@ -41,7 +39,6 @@ lighter, simpler and faster in many cases.
+ =+fuzzy= Enables fuzzy completion for Ivy searches.
+ =+prescient= Enables prescient filtering and sorting for Ivy searches.
+ =+childframe= Causes Ivy to display in a floating child frame, above Emacs.
*This requires GUI Emacs 26.1+*
+ =+icons= Enables file icons for switch-{buffer,project}/find-file counsel
commands.
@ -67,32 +64,24 @@ lighter, simpler and faster in many cases.
command)
* Prerequisites
This module optionally depends on one of:
This module depends on:
+ [[https://github.com/BurntSushi/ripgrep][ripgrep]] (rg)
+ [[https://github.com/ggreer/the_silver_searcher][the_silver_searcher]] (ag)
Ripgrep is recommended, but the order of its results aren't deterministic and it
doesn't support full PCRE (at the time of writing). The_silver_searcher is a
good alternative if either of these bother you.
If none of these are installed, file search commands will use git-grep (falling
back to grep, otherwise).
** Install
*** MacOS
#+BEGIN_SRC sh
brew install ripgrep the_silver_searcher
brew install ripgrep
#+END_SRC
*** Arch Linux
#+BEGIN_SRC sh :dir /sudo::
sudo pacman --needed --noconfirm -S ripgrep the_silver_searcher
sudo pacman --needed --noconfirm -S ripgrep
#+END_SRC
*** openSUSE
#+BEGIN_SRC sh :dir /sudo::
sudo zypper install ripgrep the_silver_searcher
sudo zypper install ripgrep
#+END_SRC
* Features
@ -108,57 +97,38 @@ https://assets.doomemacs.org/completion/ivy/projectile.png
| Keybind | Description |
|----------------------+-------------------------------------|
| =SPC f /=, =SPC SPC= | Jump to file in project |
| =SPC f .=, =SPC .= | Jump to file from current directory |
| =SPC p f=, =SPC SPC= | Jump to file in project |
| =SPC f f=, =SPC .= | Jump to file from current directory |
** Project search & replace
This module provides interactive text search and replace using the first search
program available on your system (rg, ag, git-grep or grep).
This module provides interactive text search and replace using ripgrep.
| Keybind | Description |
|-----------+---------------------------------|
| =SPC / b= | Search the current buffer |
| =SPC / p= | Search project |
| =SPC / d= | Search this directory |
| =SPC s b= | Search the current buffer |
| =SPC s p= | Search project |
| =SPC s d= | Search this directory |
| =SPC p t= | List all TODO/FIXMEs in project |
https://assets.doomemacs.org/completion/ivy/search.png
The ~+ivy-project-search-engines~ variable is consulted to determine which
underlying program to check for (and in what order). It's default value is ~'(rg
ag pt)~. If none of these are available, it will resort to =git-grep= (falling
back to =grep= after that).
To use a specific program, the following engine-specific commands are available
(but not bound to any key by default) for searching from the project root or the
current directory (recursively), respectively:
+ ~+ivy/ag~ / ~+ivy/ag-from-cwd~
+ ~+ivy/rg~ / ~+ivy/rg-from-cwd~
+ ~+ivy/grep~ / ~+ivy/grep-from-cwd~
The universal argument (=SPC u= for evil users; =C-u= otherwise) changes the
behavior of these commands, instructing the underlying search engine to include
ignored files.
This module also provides Ex Commands for evil users:
| Ex command | Description |
|-----------------------+------------------------------------------------|
| ~:ag[!] [QUERY]~ | Search project w/ ag[fn:1] |
| ~:rg[!] [QUERY]~ | Search project w/ rg[fn:1] |
| ~:grep[!] [QUERY]~ | Search project w/ git-grep/grep[fn:1] |
| ~:agcwd[!] [QUERY]~ | Search this directory w/ the_silver_searcher |
| ~:rgcwd[!] [QUERY]~ | Search this directory w/ ripgrep |
| ~:grepcwd[!] [QUERY]~ | Search this directory w/ git-grep/grep |
| Ex command | Description |
|------------------------+------------------------------------------------------------------|
| ~:pg[rep][!] [QUERY]~ | Search project (if ~!~, include hidden files) |
| ~:pg[rep]d[!] [QUERY]~ | Search from current directory (if ~!~, don't search recursively) |
The optional BANG functions is equivalent to the universal argument for the
previous commands.
-----
While in a search (e.g. invoked from ~+ivy:ag~ or ~:rg~), these extra
keybindings are available to you:
While in a search these extra keybindings are available to you:
| Keybind | Description |
|-----------+-----------------------------------------------|
@ -176,22 +146,14 @@ https://assets.doomemacs.org/completion/ivy/search-replace.png
The =swiper= package provides an interactive buffer search powered by ivy. It
can be invoked with:
+ =SPC / b=
+ =SPC s s=
+ =SPC s S= (uses thing at point as initial input)
+ ~:sw[iper] [QUERY]~
https://assets.doomemacs.org/completion/ivy/swiper.png
A wgrep buffer can be opened from swiper with =C-c C-e=.
** Task lookup
Some projects have TODO's and FIXME's littered across them. The ~+ivy/tasks~
command allows you to search and jump to them. It can be invoked with:
+ =SPC p t= (C-u = restrict search to current file)
+ ~:todo[!]~ (BANG = restrict search to current file)
https://assets.doomemacs.org/completion/ivy/todo.png
** Ivy integration for various completing commands
*** General
| Keybind | Description |
@ -200,25 +162,27 @@ https://assets.doomemacs.org/completion/ivy/todo.png
| =SPC '= | Resume last ivy session |
*** Jump to files, buffers or projects)
| Keybind | Description |
|---------------------------------+---------------------------------------|
| =SPC RET= | Find bookmark |
| =SPC f .=, =SPC .= | Browse from current directory |
| =SPC f /=, =SPC p /=, =SPC SPC= | Find file in project |
| =SPC f r= | Find recently opened file |
| =SPC p p= | Open another project |
| =SPC b b=, =SPC ,= | Switch to buffer in current workspace |
| =SPC b B=, =SPC <= | Switch to buffer |
| Keybind | Description |
|----------------------+---------------------------------------|
| =SPC RET= | Find bookmark |
| =SPC f f=, =SPC .= | Browse from current directory |
| =SPC p f=, =SPC SPC= | Find file in project |
| =SPC f r= | Find recently opened file |
| =SPC p p= | Open another project |
| =SPC b b=, =SPC ,= | Switch to buffer in current workspace |
| =SPC b B=, =SPC <= | Switch to buffer |
*** Search
| Keybind | Description |
|-----------+------------------------------------------|
| =SPC / i= | Search for symbol in current buffer |
| =SPC / I= | Search for symbol in all similar buffers |
| =SPC / b= | Search the current buffer |
| =SPC / p= | Search project |
| =SPC / d= | Search this directory |
| =SPC p t= | List all TODO/FIXMEs in project |
| Keybind | Description |
|-----------+-------------------------------------------|
| =SPC p t= | List all TODO/FIXMEs in project |
| =SPC s b= | Search the current buffer |
| =SPC s d= | Search this directory |
| =SPC s D= | Search another directory |
| =SPC s i= | Search for symbol in current buffer |
| =SPC s p= | Search project |
| =SPC s P= | Search another project |
| =SPC s s= | Search the current buffer (incrementally) |
* Configuration
** TODO Enable fuzzy/non-fuzzy search for specific commands

View file

@ -1,55 +1,14 @@
;; completion/ivy/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :editor evil)
;;;###autoload (autoload '+ivy:swiper "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:swiper (&optional search)
"Invoke `swiper' with SEARCH, otherwise with the symbol at point."
(interactive "<a>")
(swiper search))
;;;###autoload (autoload '+ivy:todo "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:todo (&optional bang)
"An ex wrapper around `+ivy/tasks'."
(interactive "<!>")
(+ivy/tasks bang))
;;
;; Project searching
;;;###autoload (autoload '+ivy:grep "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:grep (all-files-p query)
"Ex interface for `+ivy/grep'"
(interactive "<!><a>")
(+ivy/grep all-files-p query))
;;;###autoload (autoload '+ivy:ag "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:ag (all-files-p query)
"Ex interface for `+ivy/ag'"
(interactive "<!><a>")
(+ivy/ag all-files-p query))
;;;###autoload (autoload '+ivy:rg "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:rg (all-files-p query)
"Ex interface for `+ivy/rg'"
(interactive "<!><a>")
(+ivy/rg all-files-p query))
;;;###autoload (autoload '+ivy:grep-from-cwd "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:grep-from-cwd (query &optional recurse-p)
"Ex interface for `+ivy/grep-from-cwd'."
;;;###autoload (autoload '+ivy:project-search "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:project-search (query &optional all-files-p)
"Ex interface for `+ivy/project-search'."
(interactive "<a><!>")
(+ivy/grep-from-cwd (not recurse-p) query))
(+ivy/project-search all-files-p query))
;;;###autoload (autoload '+ivy:ag-from-cwd "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:ag-from-cwd (query &optional recurse-p)
"Ex interface for `+ivy/ag-from-cwd'."
;;;###autoload (autoload '+ivy:project-search-from-cwd "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:project-search-from-cwd (query &optional recurse-p)
"Ex interface for `+ivy/project-search-from-cwd'."
(interactive "<a><!>")
(+ivy/ag-from-cwd (not recurse-p) query))
;;;###autoload (autoload '+ivy:rg-from-cwd "completion/ivy/autoload/evil" nil t)
(evil-define-command +ivy:rg-from-cwd (query &optional recurse-p)
"Ex interface for `+ivy/rg-from-cwd'."
(interactive "<a><!>")
(+ivy/rg-from-cwd (not recurse-p) query))
(+ivy/project-search-from-cwd (not recurse-p) query))

View file

@ -157,88 +157,6 @@ If ARG (universal argument), open selection in other-window."
(interactive)
(+ivy--switch-buffer nil t))
(defun +ivy--tasks-candidates (tasks)
"Generate a list of task tags (specified by `+ivy-task-tags') for
`+ivy/tasks'."
(let* ((max-type-width
(cl-loop for task in +ivy-task-tags maximize (length (car task))))
(max-desc-width
(cl-loop for task in tasks maximize (length (cl-cdadr task))))
(max-width (max (+ max-desc-width 3)
25)))
(cl-loop
with fmt = (format "%%-%ds %%-%ds%%s:%%s" max-type-width max-width)
for alist in tasks
collect
(let-alist alist
(list (format fmt
(propertize .type 'face (cdr (assoc .type +ivy-task-tags)))
(substring .desc 0 (min max-desc-width (length .desc)))
(propertize (abbreviate-file-name .file) 'face 'font-lock-keyword-face)
(propertize .line 'face 'font-lock-constant-face))
.type .file .line)))))
(defun +ivy--tasks (target)
(let* (case-fold-search
(task-tags (mapcar #'car +ivy-task-tags))
(cmd
(format "%s -H -S --no-heading -- %s %s"
(or (when-let (bin (executable-find "rg"))
(concat bin " --line-number"))
(when-let (bin (executable-find "ag"))
(concat bin " --numbers"))
(error "ripgrep & the_silver_searcher are unavailable"))
(shell-quote-argument
(concat "\\s("
(string-join task-tags "|")
")([\\s:]|\\([^)]+\\):?)"))
target)))
(save-match-data
(cl-loop with out = (shell-command-to-string cmd)
for x in (and out (split-string out "\n" t))
when (condition-case-unless-debug ex
(string-match
(concat "^\\([^:]+\\):\\([0-9]+\\):.+\\("
(string-join task-tags "\\|")
"\\):?\\s-*\\(.+\\)")
x)
(error
(print! (red "Error matching task in file: (%s) %s")
(error-message-string ex)
(car (split-string x ":")))
nil))
collect `((type . ,(match-string 3 x))
(desc . ,(match-string 4 x))
(file . ,(match-string 1 x))
(line . ,(match-string 2 x)))))))
(defun +ivy--tasks-open-action (x)
"Jump to the file and line of the current task."
(cl-destructuring-bind (_label type file line) x
(with-ivy-window
(find-file (expand-file-name file (doom-project-root)))
(goto-char (point-min))
(forward-line (1- (string-to-number line)))
(when (search-forward type (line-end-position) t)
(backward-char (length type)))
(recenter))))
;;;###autoload
(defun +ivy/tasks (&optional arg)
"Search through all TODO/FIXME tags in the current project. If ARG, only
search current file. See `+ivy-task-tags' to customize what this searches for."
(interactive "P")
(ivy-read (format "Tasks (%s): "
(if arg
(concat "in: " (file-relative-name buffer-file-name))
"project"))
(let ((tasks (+ivy--tasks (if arg buffer-file-name (doom-project-root)))))
(unless tasks
(user-error "No tasks in your project! Good job!"))
(+ivy--tasks-candidates tasks))
:action #'+ivy--tasks-open-action
:caller '+ivy/tasks))
;;;###autoload
(defun +ivy/woccur ()
"Invoke a wgrep buffer on the current ivy results, if supported."
@ -293,7 +211,7 @@ search current file. See `+ivy-task-tags' to customize what this searches for."
;;
;; File searching
;;; File searching
;;;###autoload
(defun +ivy/projectile-find-file ()
@ -318,25 +236,9 @@ The point of this is to avoid Emacs locking up indexing massive file trees."
(#'counsel-file-jump))))
(defvar +ivy-file-search-shell
(or (executable-find "dash")
(executable-find "sh")
shell-file-name)
"The SHELL to invoke ag/rg/pt/git-grep/grep searchs from.
This only affects `+ivy/*' search commands (e.g. `+ivy/rg' and
`+ivy/project-search').
By default, this the most basic, uncustomized shell, to prevent interference
caused by slow shell configs at the cost of isolating these programs from
envvars that may have been set in the user's shell config to change their
behavior. If this bothers you, change this to `shell-file-name'.")
;;;###autoload
(cl-defun +ivy-file-search (engine &key query in all-files (recursive t))
"Conduct a file search using ENGINE, which can be any of: rg, ag, pt, and
grep. If omitted, ENGINE will default to the first one it detects, in that
order.
(cl-defun +ivy-file-search (&key query in all-files (recursive t))
"Conduct a file search using ripgrep.
:query STRING
Determines the initial input to search for.
@ -346,131 +248,56 @@ order.
:recursive BOOL
Whether or not to search files recursively from the base directory."
(declare (indent defun))
(let* ((project-root (or (doom-project-root) default-directory))
(unless (executable-find "rg")
(user-error "Couldn't find ripgrep in your PATH"))
(require 'counsel)
(let* ((ivy-more-chars-alist '((t . 1)))
(project-root (or (doom-project-root) default-directory))
(directory (or in project-root))
(default-directory directory)
(engine (or engine
(cl-loop for tool in +ivy-project-search-engines
if (executable-find (symbol-name tool))
return tool)
(and (or (executable-find "grep")
(executable-find "git"))
'grep)
(error "No search engine specified (is ag, rg, pt or git installed?)")))
(query
(or (if query query)
(when (use-region-p)
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
(end (or (bound-and-true-p evil-visual-end) (region-end))))
(when (> (abs (- end beg)) 1)
(let ((query (buffer-substring-no-properties beg end)))
;; Escape characters that are special to ivy searches
(replace-regexp-in-string "[! |]" (lambda (substr)
(cond ((and (string= substr " ")
(not (featurep! +fuzzy)))
" ")
((and (string= substr "|")
(eq engine 'rg))
"\\\\\\\\|")
((concat "\\\\" substr))))
(rxt-quote-pcre query))))))))
(prompt
(format "%s%%s %s"
(symbol-name engine)
(cond ((equal directory default-directory)
"./")
((equal directory project-root)
(projectile-project-name))
((file-relative-name directory project-root))))))
(require 'counsel)
(let ((ivy-more-chars-alist
(if query '((t . 1)) ivy-more-chars-alist))
(shell-file-name +ivy-file-search-shell))
(pcase engine
(`grep
(let ((counsel-projectile-grep-initial-input query))
(cl-letf (((symbol-function #'counsel-locate-git-root)
(lambda () directory)))
(if all-files
(cl-letf (((symbol-function #'projectile-ignored-directories-rel)
(symbol-function #'ignore))
((symbol-function #'projectile-ignored-files-rel)
(symbol-function #'ignore)))
(counsel-projectile-grep))
(counsel-projectile-grep)))))
(`ag
(let ((args (concat (if all-files " -a")
(unless recursive " --depth 1"))))
(counsel-ag query directory args (format prompt args))))
(`rg
(let ((args (concat (if all-files " -uu")
(unless recursive " --maxdepth 1"))))
(counsel-rg query directory args (format prompt args))))
(_ (error "No search engine specified"))))))
(defun +ivy--get-command (format)
(cl-loop for tool in (cl-remove-duplicates +ivy-project-search-engines :from-end t)
if (executable-find (symbol-name tool))
return (intern (format format tool))))
(args (concat (if all-files " -uu")
(unless recursive " --maxdepth 1"))))
(counsel-rg
(or (if query query)
(when (use-region-p)
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
(end (or (bound-and-true-p evil-visual-end) (region-end))))
(when (> (abs (- end beg)) 1)
(let ((query (buffer-substring-no-properties beg end)))
;; Escape characters that are special to ivy searches
(replace-regexp-in-string "[! |]" (lambda (substr)
(cond ((and (string= substr " ")
(not (featurep! +fuzzy)))
" ")
((string= substr "|")
"\\\\\\\\|")
((concat "\\\\" substr))))
(rxt-quote-pcre query)))))))
directory args
(format "rg%s %s"
args
(cond ((equal directory default-directory)
"./")
((equal directory project-root)
(projectile-project-name))
((file-relative-name directory project-root)))))))
;;;###autoload
(defun +ivy/project-search (&optional arg initial-query directory)
"Performs a project search from the project root.
"Performs a live project search from the project root using ripgrep.
Uses the first available search backend from `+ivy-project-search-engines'. If
ARG (universal argument), include all files, even hidden or compressed ones, in
the search."
If ARG (universal argument), include all files, even hidden or compressed ones,
in the search."
(interactive "P")
(funcall (or (+ivy--get-command "+ivy/%s")
#'+ivy/grep)
arg
initial-query
directory))
(+ivy-file-search :query initial-query :in directory :all-files arg))
;;;###autoload
(defun +ivy/project-search-from-cwd (&optional arg initial-query)
"Performs a project search recursively from the current directory.
Uses the first available search backend from `+ivy-project-search-engines'. If
ARG (universal argument), include all files, even hidden or compressed ones."
If ARG (universal argument), include all files, even hidden or compressed ones."
(interactive "P")
(funcall (or (+ivy--get-command "+ivy/%s-from-cwd")
#'+ivy/grep-from-cwd)
arg
initial-query))
;;;###autoload (autoload '+ivy/rg "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/rg-from-cwd "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/ag "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/ag-from-cwd "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/grep "completion/ivy/autoload/ivy" nil t)
;;;###autoload (autoload '+ivy/grep-from-cwd "completion/ivy/autoload/ivy" nil t)
(dolist (engine `(,@(cl-remove-duplicates +ivy-project-search-engines :from-end t) grep))
(defalias (intern (format "+ivy/%s" engine))
(lambda (all-files-p &optional query directory)
(interactive "P")
(+ivy-file-search engine :query query :in directory :all-files all-files-p))
(format "Perform a project file search using %s.
QUERY is a regexp. If omitted, the current selection is used. If no selection is
active, the last known search is used.
If ALL-FILES-P, search compressed and hidden files as well."
engine))
(defalias (intern (format "+ivy/%s-from-cwd" engine))
(lambda (all-files-p &optional query)
(interactive "P")
(+ivy-file-search engine :query query :in default-directory :all-files all-files-p))
(format "Perform a project file search from the current directory using %s.
QUERY is a regexp. If omitted, the current selection is used. If no selection is
active, the last known search is used.
If ALL-FILES-P, search compressed and hidden files as well."
engine)))
(+ivy/project-search arg initial-query default-directory))
;;
@ -513,7 +340,7 @@ If ALL-FILES-P, search compressed and hidden files as well."
(cons (format "%s:%d: %s"
(buffer-name)
(line-number-at-pos)
(string-trim-right (thing-at-point 'line)))
(string-trim-right (or (thing-at-point 'line) "")))
(point-marker)))))))
(cddr (better-jumper-jump-list-struct-ring
(better-jumper-get-jumps (better-jumper--get-current-context))))))))

View file

@ -7,16 +7,6 @@ When nil, don't preview anything.
When non-nil, preview non-virtual buffers.
When 'everything, also preview virtual buffers")
(defvar +ivy-task-tags
'(("TODO" . warning)
("FIXME" . error)
("HACK" . font-lock-constant-face)
("REVIEW" . font-lock-keyword-face)
("NOTE" . success)
("DEPRECATED" . font-lock-doc-face))
"An alist of tags for `+ivy/tasks' to include in its search, whose CDR is the
face to render it with.")
(defvar +ivy-project-search-engines '(rg ag)
"What search tools for `+ivy/project-search' (and `+ivy-file-search' when no
ENGINE is specified) to try, and in what order.
@ -69,6 +59,11 @@ results buffer.")
[remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer
[remap evil-show-jumps] #'+ivy/jump-list)
:config
;; Counsel changes a lot of ivy's state at startup; to control for that, we
;; need to load it as early as possible. Some packages (like `ivy-prescient')
;; require this.
(require 'counsel nil t)
(setq ivy-height 17
ivy-wrap t
ivy-fixed-height-minibuffer t
@ -182,7 +177,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
(use-package! counsel
:commands counsel-describe-face
:defer t
:init
(define-key!
[remap apropos] #'counsel-apropos
@ -324,7 +319,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

@ -82,7 +82,7 @@
(:prefix ("p" . "project")
:desc "Find file in other project" "F" #'doom/find-file-in-other-project
:desc "Search project" "s" #'+default/search-project
:desc "List project tasks" "t" #'+default/project-tasks
:desc "List project tasks" "t" #'magit-todos-list
:desc "Open project scratch buffer" "x" #'doom/open-project-scratch-buffer
:desc "Switch to project scratch buffer" "X" #'doom/switch-to-project-scratch-buffer
;; later expanded by projectile

View file

@ -294,24 +294,6 @@
:desc "Find file in project" "SPC" #'projectile-find-file
:desc "Jump to bookmark" "RET" #'bookmark-jump
;;; <leader> / --- search
(:prefix-map ("/" . "search")
:desc "Search buffer" "/" #'swiper
:desc "Search buffer" "b" #'swiper
:desc "Search current directory" "d" #'+default/search-cwd
:desc "Search other directory" "D" #'+default/search-other-cwd
:desc "Locate file" "f" #'locate
:desc "Jump to symbol" "i" #'imenu
:desc "Jump to link" "l" #'ace-link
:desc "Jump list" "j" #'evil-show-jumps
:desc "Jump to mark" "m" #'evil-show-marks
:desc "Look up online" "o" #'+lookup/online
:desc "Look up online (w/ prompt)" "O" #'+lookup/online-select
:desc "Look up in local docsets" "k" #'+lookup/in-docsets
:desc "Look up in all docsets" "K" #'+lookup/in-all-docsets
:desc "Search project" "p" #'+default/search-project
:desc "Search other project" "P" #'+default/search-other-project)
;;; <leader> TAB --- workspace
(:when (featurep! :ui workspaces)
(:prefix-map ("TAB" . "workspace")
@ -381,25 +363,20 @@
:desc "Send to repl" "s" #'+eval/send-region-to-repl
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
:desc "List errors" "x" #'flymake-show-diagnostics-buffer
(:when (featurep! :tools flycheck)
:desc "List errors" "x" #'flycheck-list-errors)
(:unless (featurep! :tools flycheck)
:desc "List errors" "x" #'flymake-show-diagnostics-buffer))
:desc "List errors" "x" #'flycheck-list-errors))
;;; <leader> f --- file
(:prefix-map ("f" . "file")
:desc "Find file" "." #'find-file
:desc "Find file from here" "/"
(if (featurep! :completion ivy)
#'counsel-file-jump
(λ! (doom-project-find-file default-directory)))
:desc "Open project editorconfig" "c" #'editorconfig-find-current-editorconfig
:desc "Copy this file" "C" #'doom/copy-this-file
:desc "Find directory" "d" #'dired
:desc "Delete this file" "D" #'doom/delete-this-file
:desc "Find file in emacs.d" "e" #'+default/find-in-emacsd
:desc "Browse emacs.d" "E" #'+default/browse-emacsd
:desc "Find file from here" "f" #'find-file
:desc "Find file" "f" #'find-file
:desc "Find file from here" "F" #'+default/find-file-under-here
:desc "Locate file" "l" #'locate
:desc "Move/rename file" "m" #'doom/move-this-file
:desc "Find file in private config" "p" #'doom/find-file-in-private-config
@ -468,15 +445,16 @@
;;; <leader> i --- insert
(:prefix-map ("i" . "insert")
:desc "From clipboard" "y" #'+default/yank-pop
:desc "Current file name" "f" #'+default/insert-file-path
:desc "Current file path" "F" (λ!! #'+default/insert-file-path t)
:desc "Evil ex path" "p" (λ! (evil-ex "R!echo "))
:desc "From evil register" "r" #'evil-ex-registers
:desc "Snippet" "s" #'yas-insert-snippet
:desc "Unicode" "u" #'unicode-chars-list-chars)
:desc "Unicode" "u" #'unicode-chars-list-chars
:desc "From clipboard" "y" #'+default/yank-pop)
;;; <leader> n --- notes
(:prefix-map ("n" . "notes")
:desc "Browse notes" "." #'+default/browse-notes
:desc "Search notes" "/" #'+default/org-notes-search
:desc "Search notes for symbol" "*" #'+default/search-notes-for-symbol-at-point
:desc "Org agenda" "a" #'org-agenda
:desc "Org capture" "c" #'org-capture
@ -487,6 +465,7 @@
:desc "Find file in notes" "n" #'+default/find-in-notes
:desc "Browse notes" "N" #'+default/browse-notes
:desc "Todo list" "t" #'org-todo-list
:desc "Search notes" "s" #'+default/org-notes-search
:desc "View search" "v" #'org-search-view
:desc "Org export to clipboard" "y" #'+org/export-to-clipboard
:desc "Org export to clipboard as RTF" "Y" #'+org/export-to-clipboard-as-rich-text
@ -542,8 +521,6 @@
(:prefix-map ("p" . "project")
:desc "Browse project" "." #'+default/browse-project
:desc "Browse other project" ">" #'doom/browse-in-other-project
:desc "Find file in project" "/" #'projectile-find-file
:desc "Find file in other project" "?" #'doom/find-file-in-other-project
:desc "Run cmd in project root" "!" #'projectile-run-shell-command-in-root
:desc "Add new project" "a" #'projectile-add-known-project
:desc "Switch to project buffer" "b" #'projectile-switch-to-buffer
@ -552,7 +529,7 @@
:desc "Remove known project" "d" #'projectile-remove-known-project
:desc "Edit project .dir-locals" "e" #'projectile-edit-dir-locals
:desc "Find file in project" "f" #'projectile-find-file
:desc "Browse project" "F" #'+default/browse-project
:desc "Find file in other project" "F" #'doom/find-file-in-other-project
:desc "Configure project" "g" #'projectile-configure-project
:desc "Invalidate project cache" "i" #'projectile-invalidate-cache
:desc "Kill project buffers" "k" #'projectile-kill-buffers
@ -563,7 +540,7 @@
:desc "Save project files" "s" #'projectile-save-project-buffers
:desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer
:desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer
:desc "List project tasks" "t" #'+default/project-tasks
:desc "List project tasks" "t" #'magit-todos-list
:desc "Test project" "T" #'projectile-test-project)
;;; <leader> q --- quit/session
@ -591,27 +568,31 @@
:desc "Browse remote files" "." #'ssh-deploy-browse-remote-handler
:desc "Detect remote changes" ">" #'ssh-deploy-remote-changes-handler))
;;; <leader> s --- snippets
(:when (featurep! :editor snippets)
(:prefix-map ("s" . "snippets")
:desc "View snippet for mode" "/" #'+snippets/find-for-current-mode
:desc "View snippet (global)" "?" #'+snippets/find
:desc "Edit snippet" "c" #'+snippets/edit
:desc "View private snippet" "f" #'+snippets/find-private
:desc "Insert snippet" "i" #'yas-insert-snippet
:desc "New snippet" "n" #'+snippets/new
:desc "New snippet alias" "N" #'+snippets/new-alias
:desc "Reload snippets" "r" #'yas-reload-all
:desc "Create temporary snippet" "s" #'aya-create
:desc "Expand temporary snippet" "e" #'aya-expand))
;;; <leader> s --- search
(:prefix-map ("s" . "search")
:desc "Search buffer" "b" #'swiper
:desc "Search current directory" "d" #'+default/search-cwd
:desc "Search other directory" "D" #'+default/search-other-cwd
:desc "Locate file" "f" #'locate
:desc "Jump to symbol" "i" #'imenu
:desc "Jump to link" "l" #'ace-link
:desc "Jump list" "j" #'evil-show-jumps
:desc "Jump to mark" "m" #'evil-show-marks
:desc "Look up online" "o" #'+lookup/online
:desc "Look up online (w/ prompt)" "O" #'+lookup/online-select
:desc "Look up in local docsets" "k" #'+lookup/in-docsets
:desc "Look up in all docsets" "K" #'+lookup/in-all-docsets
:desc "Search project" "p" #'+default/search-project
:desc "Search other project" "P" #'+default/search-other-project
:desc "Search buffer" "s" #'swiper-isearch
:desc "Search buffer for thing at point" "S" #'swiper-isearch-thing-at-point)
;;; <leader> t --- toggle
(:prefix-map ("t" . "toggle")
:desc "Big mode" "b" #'doom-big-font-mode
:desc "Flymake" "f" #'flymake-mode
(:when (featurep! :tools flycheck)
:desc "Flycheck" "f" #'flycheck-mode)
(:unless (featurep! :tools flycheck)
:desc "Flymake" "f" #'flymake-mode)
:desc "Frame fullscreen" "F" #'toggle-frame-fullscreen
:desc "Evil goggles" "g" #'evil-goggles-mode
(:when (featurep! :ui indent-guides)

View file

@ -73,15 +73,6 @@ If ARG (universal argument), runs `compile' from the current directory."
(with-current-buffer buffer
(funcall (default-value 'major-mode))))))
;;;###autoload
(defun +default/project-tasks ()
"Invokes `+ivy/tasks' or `+helm/tasks', depending on which is available."
(interactive)
(cond ((featurep! :tools magit)
(call-interactively #'magit-todos-list))
((featurep! :completion ivy) (+ivy/tasks))
((featurep! :completion helm) (+helm/tasks))))
;;;###autoload
(defun +default/newline-above ()
"Insert an indented new line before the current one."
@ -120,7 +111,7 @@ languages)."
(interactive)
(if (and (sp-point-in-comment)
comment-line-break-function)
(funcall comment-line-break-function)
(funcall comment-line-break-function nil)
(delete-horizontal-space t)
(newline nil t)
(indent-according-to-mode)))
@ -333,3 +324,22 @@ ARG is set, prompt for a known project to search from."
(while (server-running-p)
(sit-for 1))
(server-start))
;;;###autoload
(defun +default/find-file-under-here ()
"Perform a recursive file search from the current directory."
(interactive)
(if (featurep! :completion ivy)
(call-interactively #'counsel-file-jump)
(λ! (doom-project-find-file default-directory))))
;;;###autoload
(defun +default/insert-file-path (arg)
"Insert the file name (absolute path if prefix ARG).
If `buffer-file-name' isn't set, uses `default-directory'."
(interactive "P")
(let ((path (or buffer-file-name default-directory)))
(insert
(if arg
(abbreviate-file-name path)
(file-name-nondirectory path)))))

View file

@ -18,7 +18,7 @@ byte-compiled from.")
+literate-config-cache-file)
force-p)
(message "Compiling your literate config...")
(let* ((org (file-truename +literate-config-file))
(let* ((org (expand-file-name +literate-config-file))
(dest (concat (file-name-sans-extension +literate-config-file) ".el"))
(output (get-buffer-create "*org-tangle*")))
(unwind-protect

View file

@ -4,6 +4,7 @@
;;; Custom commands
;; Editing
(evil-ex-define-cmd "@" #'+evil:macro-on-all-lines) ; TODO Test me
(evil-ex-define-cmd "R[ead]" #'+evil:read)
(evil-ex-define-cmd "al[ign]" #'+evil:align)
(evil-ex-define-cmd "ral[ign]" #'+evil:align-right)
(evil-ex-define-cmd "enhtml" #'+web:encode-html-entities)
@ -56,25 +57,19 @@
(evil-ex-define-cmd "cd" #'+evil:cd)
(evil-ex-define-cmd "pwd" #'+evil:pwd)
(evil-define-command +evil:swiper (&optional search)
"Invoke `swiper' with SEARCH, otherwise with the symbol at point."
(interactive "<a>")
(swiper-isearch search))
(evil-ex-define-cmd "sw[iper]" #'+evil:swiper)
(cond ((featurep! :completion ivy)
(evil-ex-define-cmd "ag" #'+ivy:ag)
(evil-ex-define-cmd "agc[wd]" #'+ivy:ag-from-cwd)
(evil-ex-define-cmd "rg" #'+ivy:rg)
(evil-ex-define-cmd "rgc[wd]" #'+ivy:rg-from-cwd)
(evil-ex-define-cmd "grep" #'+ivy:grep)
(evil-ex-define-cmd "grepc[wd]" #'+ivy:grep-from-cwd)
(evil-ex-define-cmd "sw[iper]" #'+ivy:swiper)
(evil-ex-define-cmd "todo" #'+ivy:todo))
(evil-ex-define-cmd "pg[rep]" #'+ivy:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+ivy:project-search-from-cwd))
((featurep! :completion helm)
(evil-ex-define-cmd "ag" #'+helm:ag)
(evil-ex-define-cmd "agc[wd]" #'+helm:ag-from-cwd)
(evil-ex-define-cmd "rg" #'+helm:rg)
(evil-ex-define-cmd "rgc[wd]" #'+helm:rg-from-cwd)
(evil-ex-define-cmd "grep" #'+helm:grep)
(evil-ex-define-cmd "grepc[wd]" #'+helm:grep-from-cwd)
;; (evil-ex-define-cmd "todo" #'+helm:todo) TODO implement `+helm:todo'
))
(evil-ex-define-cmd "pg[rep]" #'+helm:project-search)
(evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd)))
;;; Project tools
(evil-ex-define-cmd "compile" #'+evil:compile)

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

@ -80,9 +80,10 @@ more information on modifiers."
(when (and (not (string= path "")) (equal (substring path -1) "/"))
(setq path (substring path 0 -1))))
(setq file-name
(replace-regexp-in-string (format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"
(regexp-quote (string-trim-left (car match))))
path file-name t t 1))))
(replace-regexp-in-string
(format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"
(regexp-quote (string-trim-left (car match))))
path file-name t t 1))))
(replace-regexp-in-string regexp "\\1" file-name t)))
(defun +evil--insert-newline (&optional above _noextranewline)
@ -99,7 +100,7 @@ more information on modifiers."
;; FIXME oh god why
(save-excursion
(if comment-line-break-function
(funcall comment-line-break-function)
(funcall comment-line-break-function nil)
(comment-indent-new-line))
(when (and (derived-mode-p 'c-mode 'c++-mode 'objc-mode 'java-mode 'js2-mode)
(eq (char-after) ?/))

View file

@ -182,3 +182,9 @@ non-nil, a search is preformed against Doom's manual (wiht `doom/help-search')."
(evil-ex-completed-binding (match-string 1 query))))
((message "Searching for %S, this may take a while..." query)
(apropos query t))))))
;;;###autoload (autoload '+evil:read "editor/evil/autoload/ex" nil t)
(evil-define-command +evil:read (count file)
"Alternative version of `evil-read' that replaces filename modifiers in FILE."
(interactive "P<fsh>")
(evil-read count (evil-ex-replace-special-filenames file)))

View file

@ -479,7 +479,20 @@ To change these keys see `+evil-repeat-keys'."
(:when (featurep! :tools eval)
:nv "gr" #'+eval:region
:n "gR" #'+eval/buffer
:v "gR" #'+eval:replace-region)
:v "gR" #'+eval:replace-region
;; Restore these keybinds, since the blacklisted/overwritten gr/gR will
;; undo them:
(:after dired
:map dired-mode-map
:n "gr" #'revert-buffer)
(:after notmuch
:map notmuch-common-keymap
:n "gr" #'notmuch-refresh-this-buffer
:n "gR" #'notmuch-poll-and-refresh-this-buffer)
(:after elfeed
:map elfeed-search-update--force
:n "gr" #'elfeed-search-update--force
:n "gR" #'elfeed-search-fetch))
:nv "z=" #'flyspell-correct-word-generic
;; custom evil keybinds

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

@ -100,7 +100,7 @@
(interactive)
(let* ((msg-path (car (plist-get (notmuch-tree-get-message-properties) :filename)))
(temp (make-temp-file "notmuch-message-" nil ".eml")))
(shell-command-to-string (format "cp '%s' '%s'" msg-path temp))
(doom-call-process "cp" msg-path temp)
(start-process-shell-command "email" nil (format "xdg-open '%s'" temp))))
;;;###autoload
@ -108,7 +108,7 @@
(interactive)
(let* ((msg-path (car (plist-get (notmuch-show-get-message-properties) :filename)))
(temp (make-temp-file "notmuch-message-" nil ".eml")))
(shell-command-to-string (format "cp '%s' '%s'" msg-path temp))
(doom-call-process "cp" msg-path temp)
(start-process-shell-command "email" nil (format "xdg-open '%s'" temp))))

View file

@ -160,6 +160,10 @@ This is ignored by ccls.")
;;
;; Major modes
(use-package! cmake-mode
:defer t
:config (set-docsets! 'cmake-mode "CMake"))
(use-package! company-cmake ; for `cmake-mode'
:when (featurep! :completion company)
:after cmake-mode

View file

@ -9,7 +9,8 @@
;; tries to load `proof-site'. We prevent this by defining these two variables
;; early, in our own autoloads file.
(setq pg-init--script-full-path (locate-library "proof-general")
pg-init--pg-root (file-name-directory pg-init--script-full-path))
pg-init--pg-root (file-name-directory pg-init--script-full-path)
proof-splash-enable nil)
;;;###package coq
@ -73,14 +74,15 @@
:references #'company-coq-grep-symbol
:documentation #'company-coq-doc)
(if (not (featurep! :completion company))
(setq company-coq-disabled-features '(company company-defaults))
(setq company-coq-disabled-features '(hello company-defaults))
(if (featurep! :completion company)
(map! :map coq-mode-map [remap company-complete-common]
#'company-indent-or-complete-common)
;; `company-coq''s company defaults impose idle-completion on folks, so
;; we'll set up company ourselves.
(add-to-list 'company-coq-disabled-features 'company-defaults)
;; See https://github.com/cpitclaudel/company-coq/issues/42
(map! :map coq-mode-map [remap company-complete-common]
#'company-indent-or-complete-common))
(add-to-list 'company-coq-disabled-features 'company))
(map! :map coq-mode-map
:localleader

View file

@ -21,7 +21,7 @@
:commands omnisharp-install-server
:preface
(setq omnisharp-auto-complete-want-documentation nil
omnisharp-cache-directory (concat doom-cache-dir "omnisharp"))
omnisharp-cache-directory (concat doom-etc-dir "omnisharp"))
:config
(defun +csharp-cleanup-omnisharp-server-h ()
"Clean up the omnisharp server once you kill the last csharp-mode buffer."

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

@ -36,7 +36,7 @@ This module adds [[https://golang.org][Go]] support.
+ [[https://github.com/syohex/emacs-go-eldoc][go-eldoc]]
+ [[https://github.com/dominikh/go-mode.el][go-guru]]
+ [[https://github.com/manute/gorepl-mode][gorepl-mode]]
+ [[https://github.com/syohex/emacs-go-add-tags][go-add-tags]]
+ [[https://github.com/brantou/emacs-go-tag][go-tag]]
+ [[https://github.com/mdempsky/gocode][company-go]]*
+ [[https://github.com/s-kostyaev/go-gen-test][go-gen-test]]
@ -69,6 +69,7 @@ This module requires a valid ~GOPATH~, and the following Go packages:
+ ~guru~ (for code navigation & refactoring commands)
+ ~goimports~ (optional: for auto-formatting code on save & fixing imports)
+ ~gotests~ (for generate test code)
+ ~gomodifytags~ (for manipulating tags)
#+BEGIN_SRC sh
export GOPATH=~/work/go
@ -80,6 +81,7 @@ go get -u golang.org/x/tools/cmd/goimports
go get -u golang.org/x/tools/cmd/gorename
go get -u golang.org/x/tools/cmd/guru
go get -u github.com/cweill/gotests/...
go get -u github.com/fatih/gomodifytags
#+END_SRC
* TODO Features

View file

@ -25,7 +25,8 @@
(map! :map go-mode-map
:localleader
"a" #'go-add-tags
"a" #'go-tag-add
"d" #'go-tag-remove
"e" #'+go/play-buffer-or-region
"i" #'go-goto-imports ; Go to imports
(:prefix ("h" . "help")

View file

@ -14,6 +14,9 @@
(unless (executable-find "gotests")
(warn! "Couldn't find gotests. Generating tests will not work"))
(unless (executable-find "gomodifytags")
(warn! "Couldn't find gomodifytags. Manipulating struct tags will not work"))
(when (featurep! :completion company)
(require 'company-go)
(unless (executable-find company-go-gocode-command)

View file

@ -5,7 +5,7 @@
(package! go-guru)
(package! go-mode)
(package! gorepl-mode)
(package! go-add-tags)
(package! go-tag)
(package! go-gen-test)
(when (featurep! :completion company)

View file

@ -188,7 +188,7 @@ to tide."
:map tide-mode-map
"R" #'tide-restart-server
"f" #'tide-format
"rs" #'tide-rename-symbol
"rrs" #'tide-rename-symbol
"roi" #'tide-organize-imports))
@ -205,7 +205,25 @@ to tide."
:config
(when (featurep! :editor evil +everywhere)
(let ((js2-refactor-mode-map (evil-get-auxiliary-keymap js2-refactor-mode-map 'normal t t)))
(js2r-add-keybindings-with-prefix (format "%s r" doom-localleader-key)))))
(js2r-add-keybindings-with-prefix (format "%s r" doom-localleader-key))))
(map! :map js2-mode-map
:localleader
(:prefix ("r" . "refactor")
(:prefix ("a" . "add/arguments"))
(:prefix ("b" . "barf"))
(:prefix ("c" . "contract"))
(:prefix ("d" . "debug"))
(:prefix ("e" . "expand/extract"))
(:prefix ("i" . "inject/inline/introduce"))
(:prefix ("l" . "localize/log"))
(:prefix ("o" . "organize"))
(:prefix ("r" . "rename"))
(:prefix ("s" . "slurp/split/string"))
(:prefix ("t" . "toggle"))
(:prefix ("u" . "unwrap"))
(:prefix ("v" . "var"))
(:prefix ("w" . "wrap"))
(:prefix ("3" . "ternary")))))
(use-package! eslintd-fix
@ -234,6 +252,9 @@ to tide."
(:after skewer-html
:map skewer-html-mode-map
"e" #'skewer-html-eval-tag))
(map! :map js2-mode-map
:localleader
(:prefix ("s" . "skewer")))
;;;###package npm-mode
@ -242,7 +263,10 @@ to tide."
:config
(map! :localleader
:map npm-mode-keymap
"n" npm-mode-command-keymap))
"n" npm-mode-command-keymap)
(map! :map js2-mode-map
:localleader
(:prefix ("n" . "npm"))))
;;

View file

@ -1,7 +1,7 @@
;;; lang/ocaml/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +ocaml/comment-indent-new-line ()
(defun +ocaml/comment-indent-new-line (&optional _)
"Break line at point and indent, continuing comment if within one."
(interactive)
(comment-indent-new-line)

View file

@ -21,12 +21,12 @@ Make sure your src block has a :session param.")
(defun +org--ob-ipython-generate-local-path-from-remote (session host params)
"Given a remote SESSION with PARAMS and corresponding HOST, copy remote config to local, start a jupyter console to generate a new one."
(let* ((runtime-dir
(substring (shell-command-to-string (concat "ssh " host " jupyter --runtime-dir")) 0 -1))
(cdr
(doom-call-process "ssh " host "jupyter" "--runtime-dir")))
(runtime-file (concat runtime-dir "/" "kernel-" session ".json"))
(tramp-path (concat "/ssh:" host ":" runtime-file))
(tramp-copy (concat (or +ob-ipython-local-runtime-dir
(substring (shell-command-to-string "jupyter --runtime-dir")
0 -1))
(cdr (doom-call-process "jupyter" "--runtime-dir")))
"/remote-" host "-kernel-" session ".json"))
(local-path
(concat

View file

@ -1,23 +1,5 @@
;;; lang/org/autoload/org.el -*- lexical-binding: t; -*-
;; HACK A necessary hack because org requires a compilation step after being
;; cloned, and during that compilation a org-version.el is generated with these
;; two functions, which return the output of a 'git describe ...' call in the
;; repo's root. Of course, this command won't work in a sparse clone, and more
;; than that, initiating these compilation step is a hassle, so...
;;;###autoload (defun +org--release-a () "9.3")
;;;###autoload (fset 'org-release #'+org--release-a)
;;;###autoload (fset 'org-git-version #'ignore)
;; Org itself may override the above if it's loaded too early by packages that
;; depend on it, so we have to advise it once again:
;;;###autoload (advice-add #'org-release :override #'+org--release-a)
;;;###autoload (advice-add #'org-git-version :override #'ignore)
;;;###autoload (add-to-list 'load-path (dir!))
;;;###autoload (provide 'org-version)
;;
;;; Helpers
@ -90,24 +72,19 @@
org-insert-heading-respect-content)
(goto-char (line-end-position))
(org-end-of-subtree)
(insert (concat "\n"
(when (= level 1)
(if at-eol
(ignore (cl-incf level))
"\n"))
(make-string level ?*)
" "))))
(insert "\n" (make-string level ?*) " ")))
(`above
(org-back-to-heading)
(insert (make-string level ?*) " ")
(save-excursion
(insert "\n")
(if (= level 1) (insert "\n")))))
(when-let (todo-keyword (org-element-property :todo-keyword context))
(org-todo (or (car (+org-get-todo-keywords-for todo-keyword))
'todo)))))
(save-excursion (insert "\n"))))
(when-let* ((todo-keyword (org-element-property :todo-keyword context))
(todo-type (org-element-property :todo-type context)))
(org-todo (cond ((eq todo-type 'done)
(car (+org-get-todo-keywords-for todo-keyword)))
(todo-keyword)
('todo))))))
(t (user-error "Not a valid list, heading or table")))
((user-error "Not a valid list, heading or table")))
(when (org-invisible-p)
(org-show-hidden-entry))

View file

@ -207,19 +207,7 @@ background (and foreground) match the current theme."
;; Fix 'require(...).print is not a function' error from `ob-js' when
;; executing JS src blocks
(setq org-babel-js-function-wrapper "console.log(require('util').inspect(function(){\n%s\n}()));")
;; Fix #2010: ob-async needs to initialize Doom Emacs at least minimally for
;; its async babel sessions to run correctly. This cannot be a named function
;; because it is interpolated directly into a closure to be evaluated on the
;; async session.
(defadvice! +org-init-doom-during-async-executation-a (orig-fn &rest args)
:around #'ob-async-org-babel-execute-src-block
(let ((ob-async-pre-execute-src-block-hook
;; Ensure our hook is always first
(cons `(lambda () (load ,(concat doom-emacs-dir "init.el")))
ob-async-pre-execute-src-block-hook)))
(apply orig-fn args))))
(setq org-babel-js-function-wrapper "console.log(require('util').inspect(function(){\n%s\n}()));"))
(defun +org-init-babel-lazy-loader-h ()
@ -633,6 +621,7 @@ between the two."
(:when (featurep! :completion helm)
"." #'helm-org-in-buffer-headings
"/" #'helm-org-agenda-files-headings)
"A" #'org-archive-subtree
"d" #'org-deadline
"e" #'org-export-dispatch
"f" #'org-footnote-new
@ -648,26 +637,29 @@ between the two."
"s" #'org-schedule
"t" #'org-todo
"T" #'org-todo-list
(:prefix ("r" . "refile")
"." #'+org/refile-to-current-file
"c" #'+org/refile-to-running-clock
"l" #'+org/refile-to-last-location
"o" #'+org/refile-to-other-window
"O" #'+org/refile-to-other-buffers
"r" #'org-refile) ; to all `org-refile-targets'
(:prefix ("a" . "attachments")
"a" #'+org-attach/file
"u" #'+org-attach/uri
"f" #'+org-attach/find-file
"s" #'+org-attach/sync)
(:prefix ("b" . "tables")
"-" #'org-table-insert-hline
"a" #'org-table-align
"c" #'org-table-create-or-convert-from-region
"e" #'org-table-edit-field
"h" #'org-table-field-info
(:when (featurep! +gnuplot)
"p" #'org-plot/gnuplot))
(:prefix ("c" . "clock")
"c" #'org-clock-in
"C" #'org-clock-out
"d" #'org-clock-mark-default-task
"e" #'org-clock-modify-effort-estimate
"E" #'org-set-effort
"l" #'org-clock-in-last
"g" #'org-clock-goto
"G" (λ! (org-clock-goto 'select))
"r" #'org-clock-report
"x" #'org-clock-cancel
"=" #'org-clock-timestamps-up
"-" #'org-clock-timestamps-down)
@ -676,21 +668,18 @@ between the two."
(:when (featurep! :completion ivy)
"g" #'counsel-org-goto
"G" #'counsel-org-goto-all)
"a" #'org-agenda-goto
"A" #'org-agenda-clock-goto
"c" #'org-clock-goto
"C" (λ! (org-clock-goto 'select))
"i" #'org-id-goto
"r" #'org-refile-goto-last-stored
"x" #'org-capture-goto-last-stored)
(:prefix ("b" . "tables")
"-" #'org-table-insert-hline
"a" #'org-table-align
"c" #'org-table-create-or-convert-from-region
"e" #'org-table-edit-field
"h" #'org-table-field-info
(:when (featurep! +gnuplot)
"p" #'org-plot/gnuplot)))
(:prefix ("r" . "refile")
"." #'+org/refile-to-current-file
"c" #'+org/refile-to-running-clock
"l" #'+org/refile-to-last-location
"o" #'+org/refile-to-other-window
"O" #'+org/refile-to-other-buffers
"r" #'org-refile)) ; to all `org-refile-targets'
(map! :after org-agenda
:map org-agenda-mode-map
@ -699,6 +688,13 @@ between the two."
[remap org-agenda-Quit] #'org-agenda-exit
:localleader
"d" #'org-agenda-deadline
(:prefix ("c" . "clock")
"c" #'org-agenda-clock-in
"C" #'org-agenda-clock-out
"g" #'org-agenda-clock-goto
"r" #'org-agenda-clockreport-mode
"s" #'org-agenda-show-clocking-issues
"x" #'org-agenda-clock-cancel)
"q" #'org-agenda-set-tags
"r" #'org-agenda-refile
"s" #'org-agenda-schedule

View file

@ -6,7 +6,23 @@
(when-let (orglib (locate-library "org" nil doom--initial-load-path))
(setq load-path (delete (substring (file-name-directory orglib) 0 -1)
load-path)))
(package! org-plus-contrib) ; install cutting-edge version of org-mode
;; HACK A necessary hack because org requires a compilation step after being
;; cloned, and during that compilation a org-version.el is generated with
;; these two functions, which return the output of a 'git describe ...'
;; call in the repo's root. Of course, this command won't work in a sparse
;; clone, and more than that, initiating these compilation step is a
;; hassle, so...
(setq straight-fix-org nil)
(add-hook! 'straight-use-package-pre-build-functions
(defun +org-fix-package-h (package &rest _)
(when (member package '("org" "org-plus-contrib"))
(with-temp-file (expand-file-name "org-version.el" (straight--repos-dir "org"))
(insert "(fset 'org-release (lambda () \"9.3\"))\n"
"(fset 'org-git-version #'ignore)\n"
"(provide 'org-version)\n")))))
(package! org-plus-contrib) ; install cutting-edge version of org-mode
(package! htmlize)
(package! org-bullets :recipe (:host github :repo "Kaligule/org-bullets"))
@ -14,12 +30,29 @@
(package! org-yt :recipe (:host github :repo "TobiasZawada/org-yt"))
(package! ox-clip)
(package! toc-org)
(when (featurep! :editor evil +everywhere)
(package! evil-org :recipe (:host github :repo "hlissner/evil-org-mode")))
(when (featurep! :tools pdf)
(package! org-pdfview))
(when (featurep! :tools magit)
(package! orgit))
(when (featurep! +dragndrop)
(package! org-download))
(when (featurep! +gnuplot)
(package! gnuplot)
(package! gnuplot-mode))
(when (featurep! +ipython)
(package! ob-ipython))
(when (featurep! +pomodoro)
(package! org-pomodoro))
(when (featurep! +present)
(package! centered-window
:recipe (:host github :repo "anler/centered-window-mode"))
(package! org-tree-slide)
(package! org-re-reveal))
(when (featurep! +journal)
(package! org-journal))
;;; Babel
(package! ob-async)
@ -36,25 +69,11 @@
(when (featurep! :lang rust)
(package! ob-rust))
;;; Modules
(when (featurep! +dragndrop)
(package! org-download))
(when (featurep! +gnuplot)
(package! gnuplot)
(package! gnuplot-mode))
(when (featurep! +ipython)
(package! ob-ipython))
;;; Export
(when (featurep! +pandoc)
(package! ox-pandoc))
(when (featurep! +pomodoro)
(package! org-pomodoro))
(when (featurep! +present)
(package! centered-window
:recipe (:host github :repo "anler/centered-window-mode"))
(package! org-tree-slide)
(package! org-re-reveal))
(when (featurep! +journal)
(package! org-journal))
(when (featurep! +hugo)
(package! ox-hugo
:recipe (:host github :repo "kaushalmodi/ox-hugo" :nonrecursive t)))
(when (featurep! :lang rst)
(package! ox-rst))

View file

@ -18,31 +18,19 @@
(kill-buffer (get-buffer "org")))
(describe "headlines"
(it "appends first-level headlines with an extra newline"
(it "opens new headline below"
(insert!! "* {0}Header")
(+org/insert-item-below 1)
(expect (eobp))
(expect (buffer-substring-no-properties (point-min) (point-max))
:to-equal "* Header\n\n* "))
(it "prepends first-level headlines with an extra newline"
(insert!! "* {0}Header")
(+org/insert-item-above 1)
(expect (eolp))
(expect (buffer-substring-no-properties (point-min) (point-max))
:to-equal "* \n\n* Header"))
:to-equal "* Header\n* "))
(it "appends second-level headlines with an no extra newline"
(insert!! "** {0}Header")
(+org/insert-item-below 1)
(expect (eobp))
(expect (buffer-substring-no-properties (point-min) (point-max))
:to-equal "** Header\n** "))
(it "prepends second-level headlines with an no extra newline"
(insert!! "** {0}Header")
(it "opens new headline above"
(insert!! "* {0}Header")
(+org/insert-item-above 1)
(expect (eolp))
(expect (buffer-substring-no-properties (point-min) (point-max))
:to-equal "** \n** Header"))
:to-equal "* \n* Header"))
(it "appends headlines, skipping subtrees"
(insert!! "** {0}First\n"

View file

@ -20,6 +20,9 @@ called.")
:init
(setq python-environment-directory doom-cache-dir
python-indent-guess-indent-offset-verbose nil)
(when (featurep! +lsp)
(add-hook 'python-mode-local-vars-hook #'lsp!))
:config
(set-repl-handler! 'python-mode #'+python/open-repl :persist t)
(set-docsets! 'python-mode "Python 3" "NumPy" "SciPy")
@ -45,9 +48,6 @@ called.")
;; Stop the spam!
(setq python-indent-guess-indent-offset-verbose nil)
(when (featurep! +lsp)
(add-hook 'python-mode-local-vars-hook #'lsp!))
;; Default to Python 3. Prefer the versioned Python binaries since some
;; systems stupidly make the unversioned one point at Python 2.
(when (and (executable-find "python3")
@ -88,10 +88,17 @@ called.")
(use-package! anaconda-mode
:after python
:defer t
:init
(setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/")
anaconda-mode-eldoc-as-single-line t)
(add-hook! 'python-mode-local-vars-hook
(defun +python-init-anaconda-mode-maybe-h ()
"Enable `anaconda-mode' if `lsp-mode' isn't."
(unless (or (bound-and-true-p lsp-mode)
(bound-and-true-p lsp--buffer-deferred))
(anaconda-mode +1))))
:config
(add-hook 'anaconda-mode-hook #'anaconda-eldoc-mode)
(set-company-backend! 'anaconda-mode '(company-anaconda))
@ -101,13 +108,6 @@ called.")
:documentation #'anaconda-mode-show-doc)
(set-popup-rule! "^\\*anaconda-mode" :select nil)
(add-hook! 'python-mode-local-vars-hook :append
(defun +python-init-anaconda-mode-maybe-h ()
"Enable `anaconda-mode' if `lsp-mode' isn't."
(unless (or (bound-and-true-p lsp-mode)
(bound-and-true-p lsp--buffer-deferred))
(anaconda-mode +1))))
(defun +python-auto-kill-anaconda-processes-h ()
"Kill anaconda processes if this buffer is the last python buffer."
(when (and (eq major-mode 'python-mode)
@ -115,7 +115,8 @@ called.")
(doom-buffers-in-mode 'python-mode (buffer-list)))))
(anaconda-mode-stop)))
(add-hook! 'python-mode-hook
(add-hook 'kill-buffer-hook #'+python-auto-kill-anaconda-processes-h nil t))
(add-hook 'kill-buffer-hook #'+python-auto-kill-anaconda-processes-h
nil 'local))
(when (featurep 'evil)
(add-hook 'anaconda-mode-hook #'evil-normalize-keymaps))
@ -130,9 +131,10 @@ called.")
(use-package! pyimport
:after python
:config
(map! :map python-mode-map
:defer t
:init
(map! :after python
:map python-mode-map
:localleader
(:prefix ("i" . "imports")
:desc "Insert missing imports" "i" #'pyimport-insert-missing
@ -193,7 +195,18 @@ called.")
(_ (pipenv-project-p)))
(format "PIPENV_MAX_DEPTH=9999 %s run %%c %%o %%s %%a" bin)
"%c %o %s %a")))
(:description . "Run Python script"))))
(:description . "Run Python script")))
(map! :map python-mode-map
:localleader
:prefix "e"
:desc "activate" "a" #'pipenv-activate
:desc "deactivate" "d" #'pipenv-deactivate
:desc "install" "i" #'pipenv-install
:desc "lock" "l" #'pipenv-lock
:desc "open module" "o" #'pipenv-open
:desc "run" "r" #'pipenv-run
:desc "shell" "s" #'pipenv-shell
:desc "uninstall" "u" #'pipenv-uninstall))
(use-package! pyvenv
@ -206,18 +219,7 @@ called.")
(add-hook 'python-mode-local-vars-hook #'pyvenv-track-virtualenv)
(add-to-list 'global-mode-string
'(pyvenv-virtual-env-name (" venv:" pyvenv-virtual-env-name " "))
'append)
(map! :map python-mode-map
:localleader
:prefix "e"
:desc "activate" "a" #'pipenv-activate
:desc "deactivate" "d" #'pipenv-deactivate
:desc "install" "i" #'pipenv-install
:desc "lock" "l" #'pipenv-lock
:desc "open module" "o" #'pipenv-open
:desc "run" "r" #'pipenv-run
:desc "shell" "s" #'pipenv-shell
:desc "uninstall" "u" #'pipenv-uninstall))
'append))
@ -243,19 +245,19 @@ called.")
;; If none of these work for you, `conda-anaconda-home' must be set
;; explicitly. Afterwards, run M-x `conda-env-activate' to switch between
;; environments
(unless (cl-loop for dir in (list conda-anaconda-home
"~/.anaconda"
"~/.miniconda"
"~/.miniconda3"
"~/miniconda3"
"/usr/bin/anaconda3"
"/usr/local/anaconda3"
"/usr/local/miniconda3"
"/usr/local/Caskroom/miniconda/base")
if (file-directory-p dir)
return (setq conda-anaconda-home dir
conda-env-home-directory dir))
(message "Cannot find Anaconda installation"))
(or (cl-loop for dir in (list conda-anaconda-home
"~/.anaconda"
"~/.miniconda"
"~/.miniconda3"
"~/miniconda3"
"/usr/bin/anaconda3"
"/usr/local/anaconda3"
"/usr/local/miniconda3"
"/usr/local/Caskroom/miniconda/base")
if (file-directory-p dir)
return (setq conda-anaconda-home dir
conda-env-home-directory dir))
(message "Cannot find Anaconda installation"))
;; integration with term/eshell
(conda-env-initialize-interactive-shells)
@ -297,5 +299,6 @@ called.")
(use-package! flycheck-cython
:when (featurep! +cython)
:when (featurep! :tools flycheck)
:after cython-mode)

View file

@ -24,10 +24,8 @@
(add-hook! 'racket-mode-hook
#'rainbow-delimiters-mode
#'highlight-quoted-mode)
(map! :map (racket-mode-map racket-repl-mode-map)
:i "[" #'racket-smart-open-bracket)
#'highlight-quoted-mode
#'racket-smart-open-bracket-mode)
(map! :localleader
:map racket-mode-map

View file

@ -0,0 +1,18 @@
;;; lang/rst/config.el -*- lexical-binding: t; -*-
(use-package! sphinx-mode
:hook (rst-mode . sphinx-mode))
(use-package! rst
:defer t
:config
(map! :localleader
:map rst-mode-map
(:prefix ("a" . "adjust")
"a" #'rst-adjust
"r" #'rst-adjust-region)
(:prefix ("t" . "table of contents")
"t" #'rst-toc
"i" #'rst-toc-insert
"u" #'rst-toc-update
"f" #'rst-toc-follow-link)))

View file

@ -0,0 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; lang/rst/packages.el
(package! sphinx-mode)

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

@ -1,7 +1,7 @@
;;; lang/scala/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +scala-comment-indent-new-line (&rest _)
(defun +scala-comment-indent-new-line (&optional _)
"Continue the commnt on the current line.
Meant to be used for `scala-mode's `comment-line-break-function'."

View file

@ -22,7 +22,7 @@
(use-package! lsp-sourcekit
:when (featurep! +lsp)
:after swift-mode
:init (add-hook 'swift-mode-hook #'lsp!)
:init (add-hook 'swift-mode-local-vars-hook #'lsp!)
:config
(unless (getenv "SOURCEKIT_TOOLCHAIN_PATH")
(setenv "SOURCEKIT_TOOLCHAIN_PATH" "/Library/Developer/Toolchains/swift-latest.xctoolchain"))

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

@ -42,11 +42,8 @@
(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))))))
(string-trim-right (cdr pair)
"\\(?:>\\|]\\|}\\)+\\'")))))
(delq! nil web-mode-engines-auto-pairs))
(map! :map web-mode-map

View file

@ -44,7 +44,7 @@
(+css--toggle-inline-or-block beg end))))
;;;###autoload
(defun +css/comment-indent-new-line ()
(defun +css/comment-indent-new-line (&optional _)
"Continues the comment in an indented new line.
Meant for `comment-line-break-function' in `css-mode' and `scss-mode'."

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

@ -22,9 +22,9 @@ buffer.")
(defvar +eshell-aliases
'(("q" "exit") ; built-in
("f" "find-file $1")
("d" "dired $1")
("bd" "eshell-up $1")
("rg" "rg --color=always $*")
("ag" "ag --color=always $*")
("l" "ls -lh")
("ll" "ls -lah")
("clear" "clear-scrollback")) ; more sensible than default
@ -132,7 +132,7 @@ You should use `set-eshell-alias!' to change this.")
:n "C" #'+eshell/evil-change-line
:n "d" #'+eshell/evil-delete
:n "D" #'+eshell/evil-delete-line
:ig "C-d" #'+eshell/quit-or-delete-char
:ig "C-d" #'+eshell/quit-or-delete-char
"TAB" #'+eshell/pcomplete
[tab] #'+eshell/pcomplete
"C-s" #'+eshell/search-history

View file

@ -1,7 +1,7 @@
;;; tools/ein/autoload/hydra.el -*- lexical-binding: t; -*-
;;;###if (featurep! :ui hydra)
;;;###autoload (autoload '+ein/hydra/body "tools/ein/autoload" nil t)
;;;###autoload (autoload '+ein/hydra/body "tools/ein/autoload/hydra" nil t)
(defhydra +ein/hydra (:hint t :color red)
"
Operations on Cells^^^^^^ Other

View file

@ -56,18 +56,27 @@
(defun +eval/buffer ()
"Evaluate the whole buffer."
(interactive)
(cond ((assq major-mode +eval-runners)
(+eval/region (point-min) (point-max)))
((quickrun))))
(if (or (assq major-mode +eval-runners)
(and (fboundp '+eval--ensure-in-repl-buffer)
(ignore-errors
(get-buffer-window (or (+eval--ensure-in-repl-buffer)
t)))))
(+eval/region (point-min) (point-max))
(quickrun)))
;;;###autoload
(defun +eval/region (beg end)
"Evaluate a region between BEG and END and display the output."
(interactive "r")
(let ((load-file-name buffer-file-name))
(if-let (runner (cdr (assq major-mode +eval-runners)))
(funcall runner beg end)
(quickrun-region beg end))))
(if (and (fboundp '+eval--ensure-in-repl-buffer)
(ignore-errors
(get-buffer-window (or (+eval--ensure-in-repl-buffer)
t))))
(+eval/send-region-to-repl beg end)
(if-let (runner (cdr (assq major-mode +eval-runners)))
(funcall runner beg end)
(quickrun-region beg end)))))
;;;###autoload
(defun +eval/line-or-region ()

View file

@ -6,10 +6,7 @@
"Evaluate selection or sends it to the open REPL, if available."
:move-point nil
(interactive "<r>")
(if (and (fboundp '+eval--ensure-in-repl-buffer)
(+eval--ensure-in-repl-buffer))
(+eval/send-region-to-repl (point-min) (point-max))
(+eval/region beg end)))
(+eval/region beg end))
;;;###autoload (autoload '+eval:replace-region "tools/eval/autoload/evil" nil t)
(evil-define-operator +eval:replace-region (beg end)

View file

@ -115,11 +115,28 @@ immediately after."
(buffer (+eval--ensure-in-repl-buffer)))
(unless buffer
(error "No REPL open"))
(with-selected-window (get-buffer-window buffer)
(when (bound-and-true-p evil-local-mode)
(call-interactively #'evil-append-line))
(insert (string-trim selection))
(unless inhibit-auto-execute-p
;; `comint-send-input' isn't enough because some REPLs may not use
;; comint, so just emulate the keypress.
(execute-kbd-macro (kbd "RET"))))))
(let ((origin-window (selected-window))
(selection
(with-temp-buffer
(insert selection)
(goto-char (point-min))
(when (> (skip-chars-forward "\n") 0)
(delete-region (point-min) (point)))
(indent-rigidly (point) (point-max)
(- (skip-chars-forward " \t")))
(concat (string-trim-right (buffer-string))
"\n"))))
(with-selected-window (get-buffer-window buffer)
(with-current-buffer buffer
(dolist (line (split-string selection "\n"))
(insert line)
(if inhibit-auto-execute-p
(insert "\n")
;; `comint-send-input' isn't enough because some REPLs may not use
;; comint, so just emulate the keypress.
(execute-kbd-macro (kbd "RET")))
(sit-for 0.001)
(redisplay 'force)))
(when (and (eq origin-window (selected-window))
(bound-and-true-p evil-local-mode))
(call-interactively #'evil-append-line))))))

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

@ -65,9 +65,10 @@ Docsets must be installed with one of the following commands:
+ `dash-docs-async-install-docset-from-file'
Docsets can be searched directly via `+lookup/in-docsets'."
(when-let (docsets (cl-remove-if-not #'dash-docs-docset-path (dash-docs-buffer-local-docsets)))
(+lookup/in-docsets nil identifier docsets)
'deferred))
(when (require 'dash-docs nil t)
(when-let (docsets (cl-remove-if-not #'dash-docs-docset-path (dash-docs-buffer-local-docsets)))
(+lookup/in-docsets nil identifier docsets)
'deferred)))
;;

View file

@ -208,17 +208,15 @@ This backend prefers \"just working\" over accuracy."
"Conducts a simple project text search for IDENTIFIER.
Uses and requires `+ivy-file-search' or `+helm-file-search'. Will return nil if
neither is available. These search backends will use ag, rg, or pt (in an order
dictated by `+ivy-project-search-engines' or `+helm-project-search-engines',
falling back to git-grep)."
neither is available. These require ripgrep to be installed."
(unless identifier
(let ((query (rxt-quote-pcre identifier)))
(ignore-errors
(cond ((featurep! :completion ivy)
(+ivy-file-search nil :query query)
(+ivy-file-search :query query)
t)
((featurep! :completion helm)
(+helm-file-search nil :query query)
(+helm-file-search :query query)
t))))))
(defun +lookup-evil-goto-definition-backend-fn (_identifier)

View file

@ -132,6 +132,7 @@ this list.")
(use-package! dash-docs
:when (featurep! +docsets)
:defer t
:init
(add-hook '+lookup-documentation-functions #'+lookup-dash-docsets-backend-fn)
:config

View file

@ -52,14 +52,17 @@ auto-killed (which is usually an expensive process)."
(funcall orig-fn))))
lsp--cur-workspace))))
(defadvice! +lsp-prompt-if-no-project-a (root)
"Prompt for the project root only if no project was found.
Also refuses to recognize $HOME as a valid project root."
:filter-return #'lsp--calculate-root
(cond ((and root (not (file-equal-p root "~")))
root)
(lsp-auto-guess-root
(lsp--find-root-interactively (lsp-session)))))
(defadvice! +lsp-prompt-if-no-project-a (session file-name)
"Prompt for the project root only if no project was found."
:after-until #'lsp--calculate-root
(cond ((not lsp-auto-guess-root)
nil)
((cl-find-if (lambda (dir)
(and (lsp--files-same-host dir file-name)
(file-in-directory-p file-name dir)))
(lsp-session-folders-blacklist session))
nil)
((lsp--find-root-interactively session))))
(defadvice! +lsp-init-a (&optional arg)
"Enable `lsp-mode' in the current buffer.
@ -106,8 +109,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

@ -23,7 +23,6 @@
(buffer-substring-no-properties (point-min) (point-max))))
;; `pass'
(after! pass
(set-evil-initial-state! 'pass-mode 'emacs)
(set-popup-rule! "^\\*Password-Store" :side 'left :size 0.25 :quit nil)
@ -36,5 +35,5 @@
;; Is built into Emacs 26+
(when (and EMACS26+ (featurep! +auth))
(when (featurep! +auth)
(auth-source-pass-enable))

View file

@ -128,8 +128,6 @@ PLIST can have the following properties:
(add-hook 'persp-before-switch-functions #'+doom-dashboard--persp-record-project-h)))
(add-hook 'doom-init-ui-hook #'+doom-dashboard-init-h)
(unless doom-debug-mode
(remove-hook 'window-setup-hook #'doom-display-benchmark-h))
;;
@ -200,8 +198,9 @@ PLIST can have the following properties:
(if (button-at (point))
(forward-button 0)
(backward-button 1)))
(progn (goto-char (point-min))
(forward-button 1))))
(ignore-errors
(goto-char (point-min))
(forward-button 1))))
(defun +doom-dashboard-reload-maybe-h ()
"Reload the dashboard or its state.

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

@ -8,3 +8,8 @@
;;;###package hydra
(setq lv-use-separator t)
(defadvice! +hydra--inhibit-window-switch-hooks-a (orig-fn)
:around #'lv-window
(let ((doom-inhibit-switch-window-hooks t))
(funcall orig-fn)))

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

@ -62,7 +62,7 @@
(doom-modeline-def-modeline 'special
'(bar window-number matches buffer-info-simple buffer-position selection-info)
'(objed-state misc-info persp-name debug input-method irc-buffers buffer-encoding lsp major-mode process checker))
'(objed-state misc-info persp-name debug input-method irc buffer-encoding lsp major-mode process checker))
(doom-modeline-def-modeline 'project
'(bar window-number buffer-default-directory)

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)