Minor refactors across the board
- when-let* -> when-let - Fix projectile-locate-dominating-file for connected remote files
This commit is contained in:
parent
4ecf6c9414
commit
9a02bd8ac8
42 changed files with 114 additions and 110 deletions
|
@ -173,7 +173,7 @@ compilation dbs."
|
|||
;; (defun +cc|init-ccls-compile-options ()
|
||||
;; "TODO"
|
||||
;; (when (memq major-mode '(c-mode c++-mode objc-mode))
|
||||
;; (when-let* ((include-paths (+cc-resolve-include-paths)))
|
||||
;; (when-let (include-paths (+cc-resolve-include-paths))
|
||||
;; (let ((args (delq nil (cdr-safe (assq major-mode +cc-default-compiler-options)))))
|
||||
;; (setf (alist-get (or (lsp-workspace-root)
|
||||
;; (lsp--suggest-project-root)
|
||||
|
@ -190,10 +190,10 @@ compilation dbs."
|
|||
"Takes the local project include paths and registers them with ffap.
|
||||
This way, `find-file-at-point' (and `+lookup/file') will know where to find most
|
||||
header files."
|
||||
(when-let* ((project-root (or (bound-and-true-p irony--working-directory)
|
||||
(and (featurep 'lsp)
|
||||
(or (lsp-workspace-root)
|
||||
(doom-project-root))))))
|
||||
(when-let (project-root (or (bound-and-true-p irony--working-directory)
|
||||
(and (featurep 'lsp)
|
||||
(or (lsp-workspace-root)
|
||||
(doom-project-root)))))
|
||||
(require 'ffap)
|
||||
(make-local-variable 'ffap-c-path)
|
||||
(make-local-variable 'ffap-c++-path)
|
||||
|
|
|
@ -10,15 +10,15 @@ ignore the cache."
|
|||
(or (and (not refresh-p)
|
||||
(gethash project-root +javascript-npm-conf))
|
||||
(let ((package-file (expand-file-name "package.json" project-root)))
|
||||
(when-let* ((json (and (file-exists-p package-file)
|
||||
(require 'json)
|
||||
(json-read-file package-file))))
|
||||
(when-let (json (and (file-exists-p package-file)
|
||||
(require 'json)
|
||||
(json-read-file package-file)))
|
||||
(puthash project-root json +javascript-npm-conf))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +javascript-npm-dep-p (packages &optional project-root refresh-p)
|
||||
(when-let* ((data (and (bound-and-true-p +javascript-npm-mode)
|
||||
(+javascript-npm-conf project-root refresh-p))))
|
||||
(when-let (data (and (bound-and-true-p +javascript-npm-mode)
|
||||
(+javascript-npm-conf project-root refresh-p)))
|
||||
(let ((deps (append (cdr (assq 'dependencies data))
|
||||
(cdr (assq 'devDependencies data)))))
|
||||
(cond ((listp packages)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
(defun +lua/run-love-game ()
|
||||
"Run the current project with Love2D."
|
||||
(interactive)
|
||||
(when-let* ((root (locate-dominating-file buffer-file-name "main.lua")))
|
||||
(when-let (root (locate-dominating-file buffer-file-name "main.lua"))
|
||||
(async-shell-command
|
||||
(format "%s %s"
|
||||
(or (executable-find "love")
|
||||
|
|
|
@ -89,8 +89,8 @@ exit code."
|
|||
(defun +markdown-compile-markdown (beg end output-buffer)
|
||||
"Compiles markdown using the Markdown.pl script (or markdown executable), if
|
||||
available. Returns its exit code."
|
||||
(when-let* ((exe (or (executable-find "Markdown.pl")
|
||||
(executable-find "markdown"))))
|
||||
(when-let (exe (or (executable-find "Markdown.pl")
|
||||
(executable-find "markdown")))
|
||||
(call-process-region beg end
|
||||
shell-file-name nil output-buffer nil
|
||||
shell-command-switch
|
||||
|
|
|
@ -124,7 +124,7 @@ If on a:
|
|||
(org-table-blank-field)
|
||||
(org-table-recalculate)
|
||||
(when (and (string-empty-p (string-trim (org-table-get-field)))
|
||||
(bound-and-true-p evil-mode))
|
||||
(bound-and-true-p evil-local-mode))
|
||||
(evil-change-state 'insert)))
|
||||
|
||||
(`babel-call
|
||||
|
@ -226,7 +226,7 @@ wrong places)."
|
|||
(save-excursion
|
||||
(insert "\n")
|
||||
(if (= level 1) (insert "\n")))))
|
||||
(when-let* ((todo-keyword (org-element-property :todo-keyword context)))
|
||||
(when-let (todo-keyword (org-element-property :todo-keyword context))
|
||||
(org-todo (or (car (+org-get-todo-keywords-for todo-keyword))
|
||||
'todo)))))
|
||||
|
||||
|
@ -234,7 +234,7 @@ wrong places)."
|
|||
|
||||
(when (org-invisible-p)
|
||||
(org-show-hidden-entry))
|
||||
(when (bound-and-true-p evil-mode)
|
||||
(when (bound-and-true-p evil-local-mode)
|
||||
(evil-insert 1))))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -365,8 +365,8 @@ another level of headings on each invocation."
|
|||
"Indent the current item (header or item), if possible.
|
||||
Made for `org-tab-first-hook' in evil-mode."
|
||||
(interactive)
|
||||
(cond ((or (not (bound-and-true-p evil-mode))
|
||||
(not (eq evil-state 'insert)))
|
||||
(cond ((not (and (bound-and-true-p evil-local-mode)
|
||||
(evil-insert-state-p)))
|
||||
nil)
|
||||
((org-at-item-p)
|
||||
(if (eq this-command 'org-shifttab)
|
||||
|
@ -505,6 +505,6 @@ an effect when `evil-org-special-o/O' has `item' in it (not the default)."
|
|||
;;;###autoload
|
||||
(defun +org*display-link-in-eldoc (orig-fn &rest args)
|
||||
"Display the link at point in eldoc."
|
||||
(or (when-let* ((link (org-element-property :raw-link (org-element-context))))
|
||||
(or (when-let (link (org-element-property :raw-link (org-element-context)))
|
||||
(format "Link: %s" link))
|
||||
(apply orig-fn args)))
|
||||
|
|
|
@ -20,9 +20,9 @@ ignore the cache."
|
|||
(let ((project-root (or project-root (doom-project-root))))
|
||||
(or (and (not refresh-p) (gethash project-root +php-composer-conf))
|
||||
(let ((package-file (expand-file-name "composer.json" project-root)))
|
||||
(when-let* ((data (and (file-exists-p package-file)
|
||||
(require 'json)
|
||||
(json-read-file package-file))))
|
||||
(when-let (data (and (file-exists-p package-file)
|
||||
(require 'json)
|
||||
(json-read-file package-file)))
|
||||
(puthash project-root data +php-composer-conf))))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -11,7 +11,7 @@ can use a remote conda environment, including the corresponding remote python
|
|||
executable and packages."
|
||||
(interactive)
|
||||
(require 'conda)
|
||||
(when-let* ((home (read-directory-name "Set conda home: " "~" nil nil conda-anaconda-home)))
|
||||
(when-let (home (read-directory-name "Set conda home: " "~" nil nil conda-anaconda-home))
|
||||
(setq conda-anaconda-home home)
|
||||
(message "Successfully changed conda home to: %s" (abbreviate-file-name home))))
|
||||
|
||||
|
|
|
@ -50,6 +50,6 @@
|
|||
(let ((bin (expand-file-name (concat conda-env-current-name "/" exe-root)
|
||||
(conda-env-default-location))))
|
||||
(if (file-executable-p bin) bin))))
|
||||
((when-let* ((bin (projectile-locate-dominating-file default-directory "bin/python")))
|
||||
((when-let (bin (projectile-locate-dominating-file default-directory "bin/python"))
|
||||
(setq-local doom-modeline-python-executable (expand-file-name "bin/python" bin))))
|
||||
((executable-find exe))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue