[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa 8448d9b 133/139: Work with any old directory, no f
From: |
João Távora |
Subject: |
[elpa] externals/elpa 8448d9b 133/139: Work with any old directory, no formal project needed |
Date: |
Mon, 14 May 2018 09:53:50 -0400 (EDT) |
branch: externals/elpa
commit 8448d9b03b2813971093fd8420e739ee0b1856dd
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Work with any old directory, no formal project needed
Actually, uses a "transient project" which project-current returns if
desperate.
* README.md: Update
* eglot.el (eglot--current-process)
(eglot--current-process-or-lose): Simplify.
(eglot): Maybe prompt user for project.
---
README.md | 10 +++++-----
eglot.el | 18 ++++++------------
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/README.md b/README.md
index 39ec752..4683951 100644
--- a/README.md
+++ b/README.md
@@ -8,12 +8,12 @@ Eglot
(add-to-list 'load-path "/path/to/eglot")
(require 'eglot) ; Requires emacs 26!
-;; Now find some project file inside some Git-controlled dir
+;; Now find some source file, any source file
M-x eglot
```
*That's it*. If you're lucky, this guesses the LSP executable to start
-for the language of your choice, or it prompts you to enter one:
+for the language of your choice. Otherwise, it prompts you to enter one:
`M-x eglot` currently guesses and works out-of-the-box with:
@@ -29,9 +29,9 @@ customize `eglot-server-programs`:
(add-to-list 'eglot-server-programs '(fancy-mode . ("fancy-language-server"
"--args"")))
```
-Let me know how well it works and I'll add it to the list, or submit a
-PR. You can also enter a `server:port` pattern to connect to an LSP
-server. To skip the guess and always be prompted use `C-u M-x eglot`.
+Let me know how well it works and we can add it to the list. You can
+also enter a `server:port` pattern to connect to an LSP server. To
+skip the guess and always be prompted use `C-u M-x eglot`.
# Commands and keybindings
diff --git a/eglot.el b/eglot.el
index 2e872dc..c1b63ea 100644
--- a/eglot.el
+++ b/eglot.el
@@ -24,8 +24,7 @@
;;; Commentary:
-;; M-x eglot in some file under some .git controlled dir should get
-;; you started, but see README.md.
+;; Simply M-x eglot should be enough to get you started, but see README.md.
;;; Code:
@@ -79,15 +78,13 @@ lasted more than that many seconds."
(defun eglot--current-process ()
"The current logical EGLOT process."
- (let* ((cur (project-current))
- (processes (and cur (gethash cur eglot--processes-by-project))))
- (cl-find major-mode processes :key #'eglot--major-mode)))
+ (let* ((probe (or (project-current) (cons 'transient default-directory))))
+ (cl-find major-mode (gethash probe eglot--processes-by-project)
+ :key #'eglot--major-mode)))
(defun eglot--current-process-or-lose ()
"Return the current EGLOT process or error."
- (or (eglot--current-process)
- (eglot--error "No current EGLOT process%s"
- (if (project-current) "" " (Also no current project)"))))
+ (or (eglot--current-process) (eglot--error "No current EGLOT process")))
(defmacro eglot--define-process-var
(var-sym initval &optional doc)
@@ -326,11 +323,8 @@ MANAGED-MAJOR-MODE.
INTERACTIVE is t if called interactively."
(interactive (eglot--interactive))
- (let* ((project (project-current))
+ (let* ((project (project-current 'maybe))
(short-name (eglot--project-short-name project)))
- (unless project (eglot--error "Cannot work without a current project!"))
- (unless command (eglot--error "Don't know how to start EGLOT for %s
buffers"
- major-mode))
(let ((current-process (eglot--current-process)))
(if (and (process-live-p current-process)
interactive
- [elpa] externals/elpa d431d41 088/139: Fix bug in hover support, (continued)
- [elpa] externals/elpa d431d41 088/139: Fix bug in hover support, João Távora, 2018/05/14
- [elpa] externals/elpa d0b7773 117/139: Reduce log chatter, João Távora, 2018/05/14
- [elpa] externals/elpa 9af84a2 124/139: Prepare to sumbit to GNU ELPA, João Távora, 2018/05/14
- [elpa] externals/elpa 9577dfc 125/139: Duh, json.el is in Emacs, and json-mode.el is useless here, João Távora, 2018/05/14
- [elpa] externals/elpa 6e76b08 100/139: Support workspace/applyEdit, João Távora, 2018/05/14
- [elpa] externals/elpa 3e0f1c3 122/139: Misc little adjustments for readability, João Távora, 2018/05/14
- [elpa] externals/elpa 9bf3166 136/139: Don't define a menu if nothing to show there for now, João Távora, 2018/05/14
- [elpa] externals/elpa 1fb2bcb 132/139: Ask server for textDocument/signatureHelp if it supports it, João Távora, 2018/05/14
- [elpa] externals/elpa c7bd095 118/139: Improve eglot-eldoc-function, João Távora, 2018/05/14
- [elpa] externals/elpa ab575d2 120/139: Rename functions. eglot--request is now the synchronous one, João Távora, 2018/05/14
- [elpa] externals/elpa 8448d9b 133/139: Work with any old directory, no formal project needed,
João Távora <=
- [elpa] externals/elpa 589e1ea 138/139: Remove an unused variable, João Távora, 2018/05/14
- [elpa] externals/elpa 571b08f 076/139: Fix the odd bug here and there, João Távora, 2018/05/14
- [elpa] externals/elpa c4ffabc 083/139: Half-decent completion support, João Távora, 2018/05/14
- [elpa] externals/elpa 71e47d2 102/139: Fix odd bugs and tweak stuff, João Távora, 2018/05/14
- [elpa] externals/elpa ecd334f 101/139: Update README, João Távora, 2018/05/14
- [elpa] externals/elpa dda11dd 095/139: Try to fix some textDocument/completion bugs, João Távora, 2018/05/14
- [elpa] externals/elpa bfd82b5 108/139: Fancier RLS spinner, João Távora, 2018/05/14
- [elpa] externals/elpa c7b9002 116/139: Only call deferred actions after a full message has been received, João Távora, 2018/05/14
- [elpa] externals/elpa dc08e8e 134/139: Fix automatic project creation, João Távora, 2018/05/14
- [elpa] externals/elpa e63dad0 092/139: Simplify mode-line code with a helper., João Távora, 2018/05/14