Minor updates.

This commit is contained in:
Derek Taylor
2020-08-11 17:27:59 -05:00
parent c00618a23a
commit 367af05623
154 changed files with 2484 additions and 1801 deletions

View File

@@ -264,6 +264,13 @@ See `doom-real-buffer-p' for an explanation for real buffers."
;;
;; Interactive commands
;;;###autoload
(defun doom/save-and-kill-buffer ()
"Save the current buffer to file, then kill it."
(interactive)
(save-buffer)
(kill-current-buffer))
;;;###autoload
(defun doom/kill-this-buffer-in-all-windows (buffer &optional dont-save)
"Kill BUFFER globally and ensure all windows previously showing this buffer

View File

@@ -55,19 +55,18 @@ And jumps to your `doom!' block."
(defmacro doom--if-compile (command on-success &optional on-failure)
(declare (indent 2))
(let ((windowsym (make-symbol "doom-sync-window")))
`(with-current-buffer (compile ,command t)
(let ((,windowsym (get-buffer-window (current-buffer))))
(select-window ,windowsym)
(add-hook
'compilation-finish-functions
(lambda (_buf status)
(if (equal status "finished\n")
(progn
(delete-window ,windowsym)
,on-success)
,on-failure))
nil 'local)))))
`(with-current-buffer (compile ,command t)
(let ((w (get-buffer-window (current-buffer))))
(select-window w)
(add-hook
'compilation-finish-functions
(lambda (_buf status)
(if (equal status "finished\n")
(progn
(delete-window w)
,on-success)
,on-failure))
nil 'local))))
;;;###autoload
(defun doom/reload ()

View File

@@ -20,11 +20,9 @@
;;;###autoload
(define-minor-mode doom-debug-mode
"Toggle `debug-on-error' and `doom-debug-p' for verbose logging."
:init-value doom-debug-p
:init-value nil
:global t
(let ((value
(cond ((eq arg 'toggle) (not doom-debug-mode))
((> (prefix-numeric-value arg) 0)))))
(let ((value doom-debug-mode))
(mapc (doom-rpartial #'set value) doom-debug-variables)
(message "Debug mode %s" (if value "on" "off"))))

View File

@@ -28,8 +28,7 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
(mapcar (doom-rpartial #'doom--resolve-path-forms directory)
(cdr spec)))
(let ((filevar (make-symbol "file")))
`(let* ((file-name-handler-alist nil)
(,filevar ,spec))
`(let ((,filevar ,spec))
(and (stringp ,filevar)
,(if directory
`(let ((default-directory ,directory))
@@ -38,21 +37,19 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
,filevar)))))
(defun doom--path (&rest segments)
(let (file-name-handler-alist)
(let ((dir (pop segments)))
(unless segments
(setq dir (expand-file-name dir)))
(while segments
(setq dir (expand-file-name (car segments) dir)
segments (cdr segments)))
dir)))
(let ((dir (pop segments)))
(unless segments
(setq dir (expand-file-name dir)))
(while segments
(setq dir (expand-file-name (car segments) dir)
segments (cdr segments)))
dir))
;;;###autoload
(defun doom-glob (&rest segments)
"Construct a path from SEGMENTS and expand glob patterns.
Returns nil if the path doesn't exist."
(let* (case-fold-search
file-name-handler-alist
(dir (apply #'doom--path segments)))
(if (string-match-p "[[*?]" dir)
(file-expand-wildcards dir t)
@@ -105,7 +102,7 @@ be relative to it.
The search recurses up to DEPTH and no further. DEPTH is an integer.
MATCH is a string regexp. Only entries that match it will be included."
(let (result file-name-handler-alist)
(let (result)
(dolist (file (mapcan (doom-rpartial #'doom-glob "*") (doom-enlist paths)))
(cond ((file-directory-p file)
(appendq!

View File

@@ -214,7 +214,7 @@ selection of all minor-modes, active or not."
"*.org" doom-emacs-dir)
#'ignore))
:query initial-input
:args '("-g" "*.org")
:args '("-t" "org")
:in doom-emacs-dir
:prompt "Search documentation for: "))
@@ -633,7 +633,11 @@ config blocks in your private config."
(unless (executable-find "rg")
(user-error "Can't find ripgrep on your system"))
(if (fboundp 'counsel-rg)
(let ((counsel-rg-base-command (append counsel-rg-base-command dirs)))
(let ((counsel-rg-base-command
(if (stringp counsel-rg-base-command)
(format counsel-rg-base-command
(concat "%s " (mapconcat #'shell-quote-argument dirs " ")))
(append counsel-rg-base-command dirs))))
(counsel-rg query nil "-Lz" prompt))
;; TODO Add helm support?
(grep-find

View File

@@ -14,6 +14,7 @@
;;; Bump commands
(defun doom--package-full-recipe (package plist)
(require 'straight)
(doom-plist-merge
(plist-get plist :recipe)
(or (cdr (straight-recipes-retrieve package))

View File

@@ -106,9 +106,14 @@ in some cases."
(thing
(thing-at-point thing t))
((require 'xref nil t)
;; A little smarter than using `symbol-at-point', though in most cases,
;; xref ends up using `symbol-at-point' anyway.
(xref-backend-identifier-at-point (xref-find-backend)))
;; Eglot defines a dummy for `xref-find-backend', so we need a special
;; case to avoid xref when using eglot. See
;; https://github.com/joaotavora/eglot/issues/503
(if (eq (xref-find-backend) 'eglot)
(thing-at-point 'symbol t)
;; A little smarter than using `symbol-at-point', though in most
;; cases, xref ends up using `symbol-at-point' anyway.
(xref-backend-identifier-at-point (xref-find-backend))))
(prompt
(read-string (if (stringp prompt) prompt "")))))