From 296cbff097a486f509b17c1267722b343d661716 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 27 Mar 2020 18:06:31 -0400 Subject: [PATCH] General, minor refactor & reformatting --- core/core-ui.el | 16 ++++----- modules/lang/dart/README.org | 56 +++++++++++++++--------------- modules/lang/javascript/README.org | 8 +++++ modules/lang/org/config.el | 6 +--- modules/lang/rust/config.el | 3 +- modules/ui/doom/README.org | 2 +- modules/ui/neotree/config.el | 32 ++++++++--------- 7 files changed, 63 insertions(+), 60 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index 765283ed9..5771ab2ec 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -353,8 +353,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ;; while we're in the minibuffer. (setq enable-recursive-minibuffers t) -;; Show current key-sequence in minibuffer, like vim does. Any feedback after -;; typing is better UX than no feedback at all. +;; Show current key-sequence in minibuffer ala 'set showcmd' in vim. Any +;; feedback after typing is better UX than no feedback at all. (setq echo-keystrokes 0.02) ;; Expand the minibuffer to fit multi-line text displayed in the echo-area. This @@ -364,7 +364,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original max-mini-window-height 0.15) ;; Typing yes/no is obnoxious when y/n will do -(fset #'yes-or-no-p #'y-or-n-p) +(advice-add #'yes-or-no-p :override #'y-or-n-p) ;; Try really hard to keep the cursor from getting stuck in the read-only prompt ;; portion of the minibuffer. @@ -421,17 +421,17 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ;; Temporarily disable `hl-line' when selection is active, since it doesn't ;; serve much purpose when the selection is so much more visible. - (defvar doom-buffer-hl-line-mode nil) + (defvar doom--hl-line-mode nil) (add-hook! '(evil-visual-state-entry-hook activate-mark-hook) (defun doom-disable-hl-line-h () (when hl-line-mode - (setq-local doom-buffer-hl-line-mode t) + (setq-local doom--hl-line-mode t) (hl-line-mode -1)))) (add-hook! '(evil-visual-state-exit-hook deactivate-mark-hook) (defun doom-enable-hl-line-maybe-h () - (when doom-buffer-hl-line-mode + (when doom--hl-line-mode (hl-line-mode +1))))) @@ -681,8 +681,8 @@ This offers a moderate boost in startup (or theme switch) time, so long as (after! whitespace (defun doom-disable-whitespace-mode-in-childframes-a (orig-fn) - "`whitespace-mode' inundates child frames with whitspace markers, so disable -it to fix all that visual noise." + "`whitespace-mode' inundates child frames with whitespace markers, so +disable it to fix all that visual noise." (unless (frame-parameter nil 'parent-frame) (funcall orig-fn))) (add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a)) diff --git a/modules/lang/dart/README.org b/modules/lang/dart/README.org index df26b4e64..ceaa901de 100644 --- a/modules/lang/dart/README.org +++ b/modules/lang/dart/README.org @@ -22,24 +22,24 @@ It is fast and optimized for UI, Famous for the [[https://flutter.io/][Flutter]] framework, also made by Google. Both Flutter and Dart are free and open-source. +This module wraps ~dart-mode~, with LSP code completion for =.dart= files, +syntax highlighting, etc. + ** Maintainers This module has no dedicated maintainers. ** Module Flags -The `dart` module wraps `dart-mode`, with LSP code completion for `.dart` files, -syntax highlighting, etc. Included is a `+lsp` flag for enabling LSP features, -and a `+flutter` flag for working with Flutter. - -+ =+lsp= Will start LSP automatically in `dart-mode-hook`. -+ =+flutter= Adds the `flutter` package and some settings for Flutter development. ++ =+lsp= Enable LSP server integration. ++ =+flutter= Adds ~flutter~ integration and some sane defaults for Flutter + development. ** Plugins + [[https://github.com/bradyt/dart-mode][dart-mode]] + [[https://github.com/amake/flutter.el][flutter.el]] * Prerequisites -Make sure that the Dart SDK is on your `PATH`, and if using Flutter, make sure -the Flutter binary is on your `PATH` as well. +Make sure that the Dart SDK is on your ~PATH~, and if using Flutter, make sure +the Flutter binary is on your ~PATH~ as well. ** Installing Dart SDK Before starting note that Flutter SDK will have a version of Dart. Therefore, @@ -50,20 +50,19 @@ The stable version of the SDK is in most major distributions repositories. If you find it necessary to install any other version or build from source, please refer to the official website at: https://dart.dev/get-dart -On Debian (also Ubuntu and its derivations), you can simply install the SDK via: -#+BEGIN_SRC shell -sudo apt-get install dart -#+END_SRC -Or on Arch (and its derivations, like Manjaro), you can install it using: -#+BEGIN_SRC shell -sudo pacman -S dart -#+END_SRC -And finally in MacOS, the [[https://brew.sh/][Homebrew]] can come in handy. If you have it installed -just run: -#+BEGIN_SRC shell -brew tap dart-lang/dart -brew install dart#+END_SRC -#+END_SRC ++ *On Debian (also Ubuntu and its derivations):* + #+BEGIN_SRC shell + sudo apt-get install dart + #+END_SRC ++ *On Arch Linux (and derivations like Manjaro):* + #+BEGIN_SRC shell + sudo pacman -S dart + #+END_SRC ++ *On macOS*: + #+BEGIN_SRC shell + brew tap dart-lang/dart + brew install dart#+END_SRC + #+END_SRC ** Installing Flutter SDK Due to complications with permissions, it is suggested not to use AUR or any @@ -71,6 +70,7 @@ automatic installation tools for Flutter SDK. On any system just run the following commands to install Flutter, once you have met dependencies named on [[https://flutter.dev/docs/get-started/install/][the site]]: + #+BEGIN_SRC shell git clone https://github.com/flutter/flutter --branch stable # to download Flutter export PATH="$PATH:$(pwd)/flutter/bin" # to add it to PATH @@ -78,13 +78,13 @@ flutter doctor # for Dependency check and further instructions #+END_SRC * Features -+ Syntax highlighting and formatting for `.dart` files provided by LSP ++ Syntax highlighting and formatting for ~.dart~ files provided by LSP + Emacs functions for running and debugging Flutter projects * Configuration ** Dart & Flutter -On Linux, the installers for Dart and Flutter use the `/opt` directory, and this -module assumes that. However, you may set `lsp-dart-sdk-dir` to your Dart +On Linux, the installers for Dart and Flutter use the ~/opt~ directory, and this +module assumes that. However, you may set ~lsp-dart-sdk-dir~ to your Dart install directory, if it differs, to make sure LSP can find the language server included with the Dart SDK. @@ -93,12 +93,12 @@ and Flutter on your `PATH` variable. ** Android You will also need to setup your system for Android development if you intend to use Flutter to develop mobile applications. Refer to your distributions package -manager for details. In most distributions the `/opt/android-sdk` directory is +manager for details. In most distributions the ~/opt/android-sdk~ directory is used, and you might have to change some permissions in this directory since it's owned by root. The [[https://wiki.archlinux.org/index.php/Android][Arch Linux wiki has a great guide on this here.]] * Troubleshooting See the configuration section for information on the binaries for Dart and -Flutter. On new installs to the `/opt` directory, you will likely need to edit -the permissions of the `/opt/dart-sdk` and `/opt/flutter` directories (not to +Flutter. On new installs to the ~/opt~ directory, you will likely need to edit +the permissions of the ~/opt/dart-sdk~ and ~/opt/flutter~ directories (not to mention the Android SDK, as discussed above). diff --git a/modules/lang/javascript/README.org b/modules/lang/javascript/README.org index 6a43af3e8..2d45742fa 100644 --- a/modules/lang/javascript/README.org +++ b/modules/lang/javascript/README.org @@ -11,6 +11,8 @@ - [[#macos][MacOS]] - [[#arch-linux][Arch Linux]] - [[#opensuse][openSUSE]] +- [[#troubleshooting][Troubleshooting]] + - [[#tide-sort-completions-by-kind-isnt-respected][~tide-sort-completions-by-kind~ isn't respected]] - [[#appendix][Appendix]] - [[#commands][Commands]] @@ -62,6 +64,12 @@ sudo pacman --needed --noconfirm -S nodejs npm sudo zypper install nodejs npm #+END_SRC +* Troubleshooting +** ~tide-sort-completions-by-kind~ isn't respected +The =:completion company= module uses =company-prescient= to sort completion by +[[https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Frecency_algorithm][frecency]], which overrules specialized sorting provided by some company backends +(like ~company-tide~). + * Appendix ** Commands *** JS2-mode diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index e5cd0e76e..ca68bd125 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -233,11 +233,7 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default (add-to-list 'org-babel-load-languages (cons lang t))) t)) - (defadvice! +org--noop-org-babel-do-load-languages-a (&rest _) - :override #'org-babel-do-load-languages - (message - (concat "`org-babel-do-load-languages' is redundant with Doom's lazy loading mechanism for babel " - "packages. There is no need to use it, so it has been disabled")))) + (advice-add #'org-babel-do-load-languages :override #'ignore)) (defun +org-init-capture-defaults-h () diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 1cc8046bd..a2cc94bd0 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -10,6 +10,7 @@ (use-package! rustic :mode ("\\.rs$" . rustic-mode) :commands rustic-run-cargo-command rustic-cargo-outdated + :hook (rustic-mode . rainbow-delimiters-mode) :config (set-docsets! 'rustic-mode "Rust") (set-popup-rule! "^\\*rustic-compilation" :vslot -1) @@ -18,8 +19,6 @@ ;; use :editor format instead rustic-format-trigger nil) - (add-hook 'rustic-mode-hook #'rainbow-delimiters-mode) - (if (featurep! +lsp) (add-hook 'rustic-mode-local-vars-hook #'lsp!) (setq rustic-lsp-server nil) diff --git a/modules/ui/doom/README.org b/modules/ui/doom/README.org index fead47300..17d365df6 100644 --- a/modules/ui/doom/README.org +++ b/modules/ui/doom/README.org @@ -1,7 +1,7 @@ #+TITLE: ui/doom #+DATE: October 9, 2019 #+SINCE: v1.3 -#+STARTUP: inlineimages +#+STARTUP: inlineimages nofold * Table of Contents :TOC_3:noexport: - [[#description][Description]] diff --git a/modules/ui/neotree/config.el b/modules/ui/neotree/config.el index a3c86353f..4f46167b9 100644 --- a/modules/ui/neotree/config.el +++ b/modules/ui/neotree/config.el @@ -55,19 +55,19 @@ (skip-chars-forward " \t\r")) (map! :map neotree-mode-map - :n [tab] (neotree-make-executor - :dir-fn #'neo-open-dir - :file-fn #'neotree-quick-look) - :n "DEL" #'evil-window-prev - :n "n" #'neotree-next-line - :n "p" #'neotree-previous-line - :m "h" #'+neotree/collapse-or-up - :m "l" #'+neotree/expand-or-open - :n "J" #'neotree-select-next-sibling-node - :n "K" #'neotree-select-previous-sibling-node - :n "H" #'neotree-select-up-node - :n "L" #'neotree-select-down-node - :n "G" #'evil-goto-line - :n "gg" #'evil-goto-first-line - :n "v" (neotree-make-executor :file-fn 'neo-open-file-vertical-split) - :n "s" (neotree-make-executor :file-fn 'neo-open-file-horizontal-split))) + :n [tab] (neotree-make-executor + :dir-fn #'neo-open-dir + :file-fn #'neotree-quick-look) + :n "DEL" #'evil-window-prev + :n "n" #'neotree-next-line + :n "p" #'neotree-previous-line + :m "h" #'+neotree/collapse-or-up + :m "l" #'+neotree/expand-or-open + :n "J" #'neotree-select-next-sibling-node + :n "K" #'neotree-select-previous-sibling-node + :n "H" #'neotree-select-up-node + :n "L" #'neotree-select-down-node + :n "G" #'evil-goto-line + :n "gg" #'evil-goto-first-line + :n "v" (neotree-make-executor :file-fn 'neo-open-file-vertical-split) + :n "s" (neotree-make-executor :file-fn 'neo-open-file-horizontal-split)))