[elpa] externals-release/org updated (a846152 -> 5ee39c3)
bastien1 pushed a change to branch externals-release/org. from a846152 doc/org-manual.org: Enhance examples new a4d0607 contrib/org-mac-link.el: fix Mail.app link compatibility with macOS 11 new 5ee39c3 ox-html: Add margin to fix overflow visibility problem Summary of changes: contrib/lisp/org-mac-link.el | 2 +- lisp/ox-html.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
[elpa] externals-release/org a4d0607 1/2: contrib/org-mac-link.el: fix Mail.app link compatibility with macOS 11
branch: externals-release/org commit a4d0607e1901338b50493533815489cb71ec3844 Author: Jan Lübke Commit: Kyle Meyer contrib/org-mac-link.el: fix Mail.app link compatibility with macOS 11 * org-mac-link.el (org-mac-message-open): Replace angular brackets with encoded version (< to %3C and > to %3E) so macOS 11 Big Sur can open the message in mail.app. macOS 11 does not open the mail link with angular brackets any more. This fix is backwards compatible. I have tested it on macOS 10.15.7. TINYCHANGE --- contrib/lisp/org-mac-link.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el index d16190e..e692acb 100644 --- a/contrib/lisp/org-mac-link.el +++ b/contrib/lisp/org-mac-link.el @@ -912,7 +912,7 @@ selected items in DEVONthink Pro Office and make link(s) out of it/them." "Visit the message with MESSAGE-ID. This will use the command `open' with the message URL." (start-process (concat "open message:" message-id) nil - "open" (concat "message://<" (substring message-id 2) ">"))) + "open" (concat "message://%3C" (substring message-id 2) "%3E"))) (defun org-as-get-selected-mail () "AppleScript to create links to selected messages in Mail.app."
[elpa] externals/org c822c80 1/2: contrib/lisp/org-contacts.el: Add stardiviner as the maintainer
branch: externals/org commit c822c80ef883e3514c0464d740b1f6ff276faa9e Author: Bastien Commit: Bastien contrib/lisp/org-contacts.el: Add stardiviner as the maintainer --- contrib/lisp/org-contacts.el | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index d8d4984..310166d 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2010-2014 Julien Danjou ;; Author: Julien Danjou +;; Maintainer: stardiviner ;; Keywords: outlines, hypermedia, calendar ;; ;; This file is NOT part of GNU Emacs.
[elpa] externals-release/org 5ee39c3 2/2: ox-html: Add margin to fix overflow visibility problem
branch: externals-release/org commit 5ee39c3524bfbd881b6ca1e5eec20a045543e585 Author: Fatih Aydin Commit: Kyle Meyer ox-html: Add margin to fix overflow visibility problem * lisp/ox-html.el (org-html-style-default): Add the margin-top property to pre.src:hover:before so that the programming language is fully visible. TINYCHANGE --- lisp/ox-html.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index d2f24f5..1a466fb 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -300,7 +300,7 @@ property on the headline itself.") padding: 3px; border: 1px solid black; } - pre.src:hover:before { display: inline;} + pre.src:hover:before { display: inline; margin-top: 14px;} /* Languages per Org manual */ pre.src-asymptote:before { content: 'Asymptote'; } pre.src-awk:before { content: 'Awk'; }
[elpa] externals/org updated (35e419b -> b1dc454)
bastien1 pushed a change to branch externals/org. from 35e419b Merge branch 'maint' new c822c80 contrib/lisp/org-contacts.el: Add stardiviner as the maintainer new a4d0607 contrib/org-mac-link.el: fix Mail.app link compatibility with macOS 11 new 5ee39c3 ox-html: Add margin to fix overflow visibility problem new b1dc454 Merge branch 'maint' Summary of changes: contrib/lisp/org-contacts.el | 1 + contrib/lisp/org-mac-link.el | 2 +- lisp/ox-html.el | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
[elpa] externals/org b1dc454 2/2: Merge branch 'maint'
branch: externals/org commit b1dc45424212031b451a568e5ea4938585aa6edb Merge: c822c80 5ee39c3 Author: Kyle Meyer Commit: Kyle Meyer Merge branch 'maint' --- contrib/lisp/org-mac-link.el | 2 +- lisp/ox-html.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-mac-link.el b/contrib/lisp/org-mac-link.el index d16190e..e692acb 100644 --- a/contrib/lisp/org-mac-link.el +++ b/contrib/lisp/org-mac-link.el @@ -912,7 +912,7 @@ selected items in DEVONthink Pro Office and make link(s) out of it/them." "Visit the message with MESSAGE-ID. This will use the command `open' with the message URL." (start-process (concat "open message:" message-id) nil - "open" (concat "message://<" (substring message-id 2) ">"))) + "open" (concat "message://%3C" (substring message-id 2) "%3E"))) (defun org-as-get-selected-mail () "AppleScript to create links to selected messages in Mail.app." diff --git a/lisp/ox-html.el b/lisp/ox-html.el index d2f24f5..1a466fb 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -300,7 +300,7 @@ property on the headline itself.") padding: 3px; border: 1px solid black; } - pre.src:hover:before { display: inline;} + pre.src:hover:before { display: inline; margin-top: 14px;} /* Languages per Org manual */ pre.src-asymptote:before { content: 'Asymptote'; } pre.src-awk:before { content: 'Awk'; }
[elpa] externals/elpa 8b94cf4 02/71: Per #397: Add new eglot-lsp-abiding-column test
branch: externals/elpa commit 8b94cf467b9894e5c623bca1ebe2052d960edf5a Author: theothornhill Commit: João Távora Per #397: Add new eglot-lsp-abiding-column test Co-authored-by: João Távora * eglot-tests.el: (eglot-lsp-abiding-column): add test to check for utf-16 non-ascii characters and character offset. --- eglot-tests.el | 24 1 file changed, 24 insertions(+) diff --git a/eglot-tests.el b/eglot-tests.el index 29770c6..d516891 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -631,6 +631,30 @@ pyls prefers autopep over yafp, despite its README stating the contrary." (should (looking-back "\"foo.bar\": \"")) (should (looking-at "fb\"$")) +(ert-deftest eglot-lsp-abiding-column () + "Test basic `eglot-lsp-abiding-column' and `eglot-move-to-lsp-abiding-column'" + (skip-unless (executable-find "clangd")) + (eglot--with-fixture + '(("project" . + (("foo.c" . "const char write_data[] = u8\"ðððð ððððððððððððð ð¡ð¤ð²\";" +(let ((eglot-server-programs + '((c-mode . ("clangd") + (with-current-buffer + (eglot--find-file-noselect "project/foo.c") +(setq-local eglot-move-to-column-function #'eglot-move-to-lsp-abiding-column) +(setq-local eglot-current-column-function #'eglot-lsp-abiding-column) +(eglot--sniffing (:client-notifications c-notifs) + (eglot--tests-connect) + (end-of-line) + (insert "p ") + (eglot--signal-textDocument/didChange) + (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys) +(should (equal 71 (cadddr (cadadr (aref (cadddr params) 0)) + (beginning-of-line) + (should (eq eglot-move-to-column-function #'eglot-move-to-lsp-abiding-column)) + (funcall eglot-move-to-column-function 71) + (should (looking-at "p"))) + (ert-deftest eglot-ensure () "Test basic `eglot-ensure' functionality" (skip-unless (executable-find "pyls"))
[elpa] externals/elpa af32ebf 06/71: Close #444: use text-mode for plaintext markup
branch: externals/elpa commit af32ebf8e8640c2dadf4b462c3fe921a1d750141 Author: Andrii Kolomoiets Commit: GitHub Close #444: use text-mode for plaintext markup * eglot.el (eglot--format-markup): Use text-mode for plaintext markup. --- eglot.el | 1 + 1 file changed, 1 insertion(+) diff --git a/eglot.el b/eglot.el index 13ee307..6d6f91f 100644 --- a/eglot.el +++ b/eglot.el @@ -1109,6 +1109,7 @@ Doubles as an indicator of snippet support." (list (plist-get markup :value) (pcase (plist-get markup :kind) ("markdown" 'gfm-view-mode) + ("plaintext" 'text-mode) (_ major-mode)) (with-temp-buffer (insert string)
[elpa] externals/elpa eb29f7c 19/71: Close #450: always string-trim markup
branch: externals/elpa commit eb29f7cb7679306fe8309ae09cd84cf345c7188b Author: Theodor Thornhill Commit: João Távora Close #450: always string-trim markup Co-authored-by: João Távora * eglot.el: (eglot--format-markup): Factor string trim out so we string-trim for all cases --- eglot.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eglot.el b/eglot.el index 436e5bf..bdc4cd0 100644 --- a/eglot.el +++ b/eglot.el @@ -1139,15 +1139,14 @@ Doubles as an indicator of snippet support." (defun eglot--format-markup (markup) "Format MARKUP according to LSP's spec." (pcase-let ((`(,string ,mode) - (if (stringp markup) (list (string-trim markup) - (intern "gfm-view-mode")) + (if (stringp markup) (list markup 'gfm-view-mode) (list (plist-get markup :value) (pcase (plist-get markup :kind) ("markdown" 'gfm-view-mode) ("plaintext" 'text-mode) (_ major-mode)) (with-temp-buffer - (insert string) + (insert (string-trim string)) (ignore-errors (delay-mode-hooks (funcall mode))) (font-lock-ensure) (buffer-string
[elpa] externals/elpa da04fdc 14/71: Close #303: support hierarchical DocumentSymbol in eglot-imenu
branch: externals/elpa commit da04fdcf62b622f7d7e6ddba0ea3e95e9143270f Author: Ingo Lohmar Commit: João Távora Close #303: support hierarchical DocumentSymbol in eglot-imenu A reworking of an original implementation by Ingo Lohmar * eglot.el (eglot-client-capabilities, defvar): Add DocumentSymbol. (eglot-client-capabilities): Add :hierarchicalDocumentSymbolSupport. (eglot--parse-DocumentSymbol): Remove. (eglot-imenu): Rewrite. * NEWS.md (1.7): Mention new feature --- NEWS.md | 9 +++- eglot.el | 79 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/NEWS.md b/NEWS.md index 2d2ae3c..9be8588 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,10 @@ -# 1.6 (16/20/2020) +# 1.7 (upcoming) + +# Support hierarchical symbols in Imenu ([#303][github#303]) + +Thanks to Ingo Lohmar for the original implementation. + +# 1.6 (16/04/2020) # Column offset calculation is now LSP-conform ([#361][github#361]) @@ -207,6 +213,7 @@ and now said bunch of references--> [github#270]: https://github.com/joaotavora/eglot/issues/270 [github#279]: https://github.com/joaotavora/eglot/issues/279 [github#302]: https://github.com/joaotavora/eglot/issues/302 +[github#303]: https://github.com/joaotavora/eglot/issues/303 [github#304]: https://github.com/joaotavora/eglot/issues/304 [github#311]: https://github.com/joaotavora/eglot/issues/311 [github#313]: https://github.com/joaotavora/eglot/issues/313 diff --git a/eglot.el b/eglot.el index 42fca9b..afb7063c 100644 --- a/eglot.el +++ b/eglot.el @@ -56,6 +56,7 @@ ;;; Code: (require 'json) +(require 'imenu) (require 'cl-lib) (require 'project) (require 'url-parse) @@ -255,7 +256,12 @@ let the buffer grow forever." (ShowMessageRequestParams (:type :message) (:actions)) (SignatureHelp (:signatures) (:activeSignature :activeParameter)) (SignatureInformation (:label) (:documentation :parameters)) - (SymbolInformation (:name :kind :location) (:deprecated :containerName)) + (SymbolInformation (:name :kind :location) + (:deprecated :containerName)) + (DocumentSymbol (:name :range :selectionRange :kind) + ;; `:containerName' isn't really allowed , but + ;; it simplifies the impl of `eglot-imenu'. + (:detail :deprecated :children :containerName)) (TextDocumentEdit (:textDocument :edits) ()) (TextEdit (:range :newText)) (VersionedTextDocumentIdentifier (:uri :version) ()) @@ -532,6 +538,7 @@ treated as in `eglot-dbind'." :typeDefinition `(:dynamicRegistration :json-false) :documentSymbol (list :dynamicRegistration :json-false + :hierarchicalDocumentSymbolSupport t :symbolKind `(:valueSet [,@(mapcar #'car eglot--symbol-kind-names)])) @@ -2361,36 +2368,48 @@ echo area cleared of any previous documentation." (defun eglot-imenu () "EGLOT's `imenu-create-index-function'." - (let ((entries - (and - (eglot--server-capable :documentSymbolProvider) - (mapcar - (eglot--lambda - ((SymbolInformation) name kind location containerName) - (cons (propertize -name -:kind (alist-get kind eglot--symbol-kind-names - "Unknown") -:containerName (and (stringp containerName) -(not (string-empty-p containerName)) -containerName)) - (eglot--lsp-position-to-point -(plist-get (plist-get location :range) :start - (jsonrpc-request (eglot--current-server-or-lose) -:textDocument/documentSymbol -`(:textDocument ,(eglot--TextDocumentIdentifier))) + (cl-labels + ((visit (_name one-obj-array) + (imenu-default-goto-function + nil (car (eglot--range-region + (eglot--dcase (aref one-obj-array 0) + (((SymbolInformation) location) +(plist-get location :range)) + (((DocumentSymbol) selectionRange) +selectionRange)) + (unfurl (obj) + (eglot--dcase obj + (((SymbolInformation)) (list obj)) + (((DocumentSymbol) name children) + (cons obj +(mapcar + (lambda (c) + (plist-put +c :containerName +(le
[elpa] externals/elpa 487cde5 18/71: Close #443: kind of honour eldoc-echo-area-use-multiline-p
branch: externals/elpa commit 487cde5f7c8eeac5e2ed105c887d0547b94d14b7 Author: João Távora Commit: João Távora Close #443: kind of honour eldoc-echo-area-use-multiline-p A reworking of an idea and original implementation by Andrii Kolomoiets . It doesn't honor it completely because the semantics for a non-t, non-nil value are tricky. And we don't always exactly know what the symbol prefix reliably. * eglot.el (eglot--update-doc): Kind of honour eldoc-echo-area-use-multiline-p. --- eglot.el | 53 ++--- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/eglot.el b/eglot.el index adfd4e2..436e5bf 100644 --- a/eglot.el +++ b/eglot.el @@ -2288,29 +2288,36 @@ Buffer is displayed with `display-buffer', which obeys Honours `eglot-put-doc-in-help-buffer'. HINT is used to potentially rename EGLOT's help buffer. If STRING is nil, the echo area cleared of any previous documentation." - (if (and string - (or (eq t eglot-put-doc-in-help-buffer) - (and eglot-put-doc-in-help-buffer -(funcall eglot-put-doc-in-help-buffer string - (with-current-buffer (eglot--help-buffer) -(let ((inhibit-read-only t) - (name (format "*eglot-help for %s*" hint))) - (unless (string= name (buffer-name)) -(rename-buffer (format "*eglot-help for %s*" hint)) -(erase-buffer) -(insert string) -(goto-char (point-min))) - (if eglot-auto-display-help-buffer - (display-buffer (current-buffer)) -(unless (get-buffer-window (current-buffer)) - (eglot--message - "%s\n(...truncated. Full help is in `%s')" - (truncate-string-to-width -(replace-regexp-in-string "\\(.*\\)\n.*" "\\1" string) -(frame-width) nil nil "...") - (buffer-name eglot--help-buffer - (help-mode))) -(eldoc-message string))) + (cond ((and string + (or (eq t eglot-put-doc-in-help-buffer) + (and eglot-put-doc-in-help-buffer + (funcall eglot-put-doc-in-help-buffer string + (with-current-buffer (eglot--help-buffer) + (let ((inhibit-read-only t) + (name (format "*eglot-help for %s*" hint))) + (unless (string= name (buffer-name)) + (rename-buffer (format "*eglot-help for %s*" hint)) + (erase-buffer) + (insert string) + (goto-char (point-min))) + (if eglot-auto-display-help-buffer + (display-buffer (current-buffer)) + (unless (get-buffer-window (current-buffer)) + (eglot--message + "%s\n(...truncated. Full help is in `%s')" + (truncate-string-to-width + (replace-regexp-in-string "\\(.*\\)\n.*" "\\1" string) + (frame-width) nil nil "...") + (buffer-name eglot--help-buffer + (help-mode +(eldoc-echo-area-use-multiline-p + (eldoc-message string)) +(t + (eldoc-message + (and string + (if (string-match "\n" string) + (substring string (match-end 0)) + string)) (defun eglot-eldoc-function () "EGLOT's `eldoc-documentation-function' function."
[elpa] externals/elpa 197984c 27/71: Remove trailing whitespaces
branch: externals/elpa commit 197984cdf16c2527910c5d7ea1fb6dc2bfebb13a Author: muffinmad Commit: muffinmad Remove trailing whitespaces * eglot.el (defvar company-backends, eglot-code-actions): Remove trailing whitespace --- eglot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index 03609a1..b5f05ce 100644 --- a/eglot.el +++ b/eglot.el @@ -74,7 +74,7 @@ (require 'array) ;; forward-declare, but don't require (Emacs 28 doesn't seem to care) (defvar markdown-fontify-code-blocks-natively) -(defvar company-backends) +(defvar company-backends) (defvar company-tooltip-align-annotations) @@ -2563,7 +2563,7 @@ documentation. Honour `eglot-put-doc-in-help-buffer', (menu `("Eglot code actions:" ("dummy" ,@menu-items))) (action (if (listp last-nonmenu-event) (x-popup-menu last-nonmenu-event menu) - (cdr (assoc (completing-read "[eglot] Pick an action: " + (cdr (assoc (completing-read "[eglot] Pick an action: " menu-items nil t nil nil (car menu-items)) menu-items)
[elpa] externals/elpa 0f57efb 26/71: Simplify bug-reporting instructions
branch: externals/elpa commit 0f57efb3d77dfb2992457611c77b665f78b7f8ec Author: João Távora Commit: João Távora Simplify bug-reporting instructions We assume the user has a recent enough jsonrpc.el that consolidates events and stderr int the same transcript. * README.md (Reporting bugs): Simplify instructions. * eglot.el (eglot-events-buffer): Can work with no server. --- README.md | 39 +-- eglot.el | 12 +--- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index d904c32..0bc20c0 100644 --- a/README.md +++ b/README.md @@ -174,33 +174,28 @@ operation? We may have help, so open a [new issue](https://github.com/joaotavora/eglot/issues) and try to be as precise and objective about the problem as you can: -1. Try to replicate the problem with **as clean an Emacs run as - possible**. This means an empty `.emacs` init file or close to it - (just loading `eglot.el`, `company.el` and `yasnippet.el` for - example, and you don't even need `use-package.el` to do that). - -2. Include the log of **LSP events** and the **stderr output** of the - server (if any). You can find the former with `M-x - eglot-events-buffer` and the latter with `M-x eglot-stderr-buffer`. - You run these commands in the buffer where you enabled Eglot, but - if you didn't manage to enable Eglot at all (because of some - bootstrapping problem), you can still find these buffers in your - buffer list: they're named like `*EGLOT / - events*` and `*EGLOT / stderr*`. +1. Include the invaluable **events transcript**. You can display that + buffer with `M-x eglot-events-buffer`. It contains the JSONRPC + messages exchanged between client and server, as well as the + messages the server prints to stderr. -3. If Emacs errored (you saw -- and possibly heard -- an error +2. If Emacs errored (you saw -- and possibly heard -- an error message), make sure you repeat the process using `M-x toggle-debug-on-error` so you **get a backtrace** of the error that you should also attach to the bug report. -Some more notes: it's understandable that you report it to Eglot -first, because that's the user-facing side of the LSP experience in -Emacs, but the outcome may well be that you will have to report the -problem to the server's developers, as is often the case. But the -problem can very well be on Eglot's side, of course, and in that case -we want to fix it! Also bear in mind that Eglot's developers have -limited resources and no way to test all the possible server -combinations, so you'll have to do most of the testing. +3. Try to replicate the problem with **as clean an Emacs run as + possible**. This means an empty `.emacs` init file or close to it + (just loading `eglot.el`, `company.el` and `yasnippet.el` for + example, and you don't even need `use-package.el` to do that). + +Some more notes: it is often the case the you will have to report the +problem to the LSP server's developers, too, though it's +understandable that you report it Eglot first, since it is the +user-facing frontend first. If the problem is indeed on Eglot's side, +we _do_ want to fix it, but because Eglot's developers have limited +resources and no way to test all the possible server combinations, +you'll sometimes have to do most of the testing. # Commands and keybindings diff --git a/eglot.el b/eglot.el index d172f4c..03609a1 100644 --- a/eglot.el +++ b/eglot.el @@ -808,9 +808,15 @@ INTERACTIVE is t if called interactively." (add-hook 'post-command-hook #'maybe-connect 'append nil) (defun eglot-events-buffer (server) - "Display events buffer for SERVER." - (interactive (list (eglot--current-server-or-lose))) - (display-buffer (jsonrpc-events-buffer server))) + "Display events buffer for SERVER. +Use current server's or first available Eglot events buffer." + (interactive (list eglot--cached-server)) + (let ((buffer (if server (jsonrpc-events-buffer server) + (cl-find "\\*EGLOT.*events\\*" + (buffer-list) + :key #'buffer-name :test #'string-match +(if buffer (display-buffer buffer) + (eglot--error "Can't find an Eglot events buffer!" (defun eglot-stderr-buffer (server) "Display stderr buffer for SERVER."
[elpa] externals/elpa 91a7cba 33/71: Fix #474, #478: prompt for executable if supplied name does not exist
branch: externals/elpa commit 91a7cba0a3d10d2dd1da89df3581d67486dfaf88 Author: Dan Davison Commit: João Távora Fix #474, #478: prompt for executable if supplied name does not exist * eglot.el (eglot--guess-contact): Interpret a list containing a single string as an executable when forming the interactive prompt. --- eglot.el | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index 112959b..8a1d162 100644 --- a/eglot.el +++ b/eglot.el @@ -704,7 +704,11 @@ be guessed." (prog1 (car guess) (setq guess (cdr guess 'eglot-lsp-server)) (program (and (listp guess) - (stringp (car guess)) (stringp (cadr guess)) (car guess))) + (stringp (car guess)) + ;; A second element might be the port of a (host, port) + ;; pair, but in that case it is not a string. + (or (null (cdr guess)) (stringp (cadr guess))) + (car guess))) (base-prompt (and interactive "Enter program to execute (or :): "))
[elpa] externals/elpa b0bfbfb 38/71: Fix #488: fix type error in eglot--xref-make-match
branch: externals/elpa commit b0bfbfb93d66595803942f186f81122de263 Author: Philipp Stephani Commit: GitHub Fix #488: fix type error in eglot--xref-make-match Its first argument is passed to xref-make-match, which expects a string as its SUMMARY argument, but symbol-at-point returns a symbol. Co-authored-by: João Távora * eglot.el (eglot--lsp-xrefs-for-method): use symbol-name. --- eglot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index c38620e..15fa2a1 100644 --- a/eglot.el +++ b/eglot.el @@ -1954,7 +1954,8 @@ Try to visit the target file for a richer summary line." (eglot--collecting-xrefs (collect) (mapc (eglot--lambda ((Location) uri range) - (collect (eglot--xref-make-match (symbol-at-point) uri range))) + (collect (eglot--xref-make-match (symbol-name (symbol-at-point)) + uri range))) (if (vectorp response) response (list response)) (cl-defun eglot--lsp-xref-helper (method &key extra-params capability )
[elpa] externals/elpa b19b294 64/71: Close #558: handle LSP 3.15's isPreferred code action property
branch: externals/elpa commit b19b294198b1d05a5cc9dfcf9b5a236519fdbd7b Author: Damien Merenne Commit: João Távora Close #558: handle LSP 3.15's isPreferred code action property * eglot.el (eglot--lsp-interface-alist): Add :isPreferred to CodeAction. (eglot-client-capabilities): Announce :isPreferredSupport. (eglot-code-actions): Consider preferred CodeAction item. Co-authored-by: João Távora --- eglot.el | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/eglot.el b/eglot.el index 60bc56e..bd3bb53 100644 --- a/eglot.el +++ b/eglot.el @@ -244,7 +244,7 @@ let the buffer grow forever." (eval-and-compile (defvar eglot--lsp-interface-alist `( - (CodeAction (:title) (:kind :diagnostics :edit :command)) + (CodeAction (:title) (:kind :diagnostics :edit :command :isPreferred)) (ConfigurationItem () (:scopeUri :section)) (Command ((:title . string) (:command . string)) (:arguments)) (CompletionItem (:label) @@ -576,7 +576,8 @@ treated as in `eglot-dbind'." ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" - "source" "source.organizeImports"]))) + "source" "source.organizeImports"])) + :isPreferredSupport t) :formatting `(:dynamicRegistration :json-false) :rangeFormatting`(:dynamicRegistration :json-false) :rename `(:dynamicRegistration :json-false) @@ -2516,12 +2517,19 @@ code actions at point" (cons title all)) actions) (eglot--error "No code actions here"))) + (preferred-action (cl-find-if + (jsonrpc-lambda (&key isPreferred &allow-other-keys) + isPreferred) + actions)) (menu `("Eglot code actions:" ("dummy" ,@menu-items))) (action (if (listp last-nonmenu-event) (x-popup-menu last-nonmenu-event menu) (cdr (assoc (completing-read "[eglot] Pick an action: " menu-items nil t -nil nil (car menu-items)) +nil nil (or (plist-get + preferred-action + :title) +(car menu-items))) menu-items) (eglot--dcase action (((Command) command arguments)
[elpa] externals/elpa 476c586 69/71: Cosmetic whitespace fix (indentation, long lines, tabs->spaces)
branch: externals/elpa commit 476c5865f631d3805926727da3e3a23b2cef0725 Author: João Távora Commit: João Távora Cosmetic whitespace fix (indentation, long lines, tabs->spaces) * eglot.el (eglot-server-programs, for, eglot--after-change) (eglot-code-actions, eglot-register-capability) (eglot-register-capability): Fix whitespace. --- eglot.el | 43 ++- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/eglot.el b/eglot.el index e148403..404ed19 100644 --- a/eglot.el +++ b/eglot.el @@ -100,15 +100,16 @@ typescript-mode) . ("javascript-typescript-stdio")) (sh-mode . ("bash-language-server" "start")) - (php-mode . ("php" "vendor/felixfbecker/\ +(php-mode + . ("php" "vendor/felixfbecker/\ language-server/bin/php-language-server.php")) ((c++-mode c-mode) . ("ccls")) ((caml-mode tuareg-mode reason-mode) . ("ocaml-language-server" "--stdio")) (ruby-mode - . ("solargraph" "socket" "--port" -:autoport)) -(haskell-mode . ("haskell-language-server-wrapper" "--lsp")) + . ("solargraph" "socket" "--port" :autoport)) +(haskell-mode + . ("haskell-language-server-wrapper" "--lsp")) (elm-mode . ("elm-language-server")) (kotlin-mode . ("kotlin-language-server")) (go-mode . ("gopls")) @@ -1522,7 +1523,7 @@ Uses THING, FACE, DEFS and PREPEND." (priority . ,(+ 50 i)) (keymap . ,(let ((map (make-sparse-keymap))) (define-key map [mouse-1] -(eglot--mouse-call 'eglot-code-actions)) + (eglot--mouse-call 'eglot-code-actions)) map) @@ -1763,8 +1764,8 @@ Records BEG, END and PRE-CHANGE-LENGTH locally." ,(buffer-substring-no-properties b-beg-marker b-end-marker))) (setcar eglot--recent-changes - `(,lsp-beg ,lsp-end ,pre-change-length -,(buffer-substring-no-properties beg end) + `(,lsp-beg ,lsp-end ,pre-change-length + ,(buffer-substring-no-properties beg end) (_ (setf eglot--recent-changes :emacs-messup))) (when eglot--change-idle-timer (cancel-timer eglot--change-idle-timer)) (let ((buf (current-buffer))) @@ -2533,9 +2534,9 @@ code actions at point" actions) (eglot--error "No code actions here"))) (preferred-action (cl-find-if - (jsonrpc-lambda (&key isPreferred &allow-other-keys) - isPreferred) - actions)) +(jsonrpc-lambda (&key isPreferred &allow-other-keys) + isPreferred) +actions)) (menu `("Eglot code actions:" ("dummy" ,@menu-items))) (action (if (listp last-nonmenu-event) (x-popup-menu last-nonmenu-event menu) @@ -2572,16 +2573,16 @@ code actions at point" finally return result)) (cl-defmethod eglot-register-capability -(server (method (eql workspace/didChangeWatchedFiles)) id &key watchers) + (server (method (eql workspace/didChangeWatchedFiles)) id &key watchers) "Handle dynamic registration of workspace/didChangeWatchedFiles" (eglot-unregister-capability server method id) (let* (success (globs (mapcar (eglot--lambda ((FileSystemWatcher) globPattern) globPattern) watchers)) -(glob-dirs - (delete-dups (mapcar #'file-name-directory - (mapcan #'file-expand-wildcards globs) + (glob-dirs + (delete-dups (mapcar #'file-name-directory + (mapcan #'file-expand-wildcards globs) (cl-labels ((handle-event (event) @@ -2605,13 +2606,13 @@ code actions at point" (handle-event `(,desc 'created ,file1))) (unwind-protect (progn - (dolist (dir glob-dirs) - (push (file-notify-add-watch dir '(change) #'handle-event) - (gethash id (eglot--file-watches server - (setq -success -
[elpa] externals/elpa 8dd0a15 67/71: Fix #367: Robustify previous fix of onChange breakage
branch: externals/elpa commit 8dd0a159d7103984e4d5f18849a49d49f2444818 Author: João Távora Commit: João Távora Fix #367: Robustify previous fix of onChange breakage From the in-code comments: ;; github#259 and github#367: With `capitalize-word' or somesuch, ;; `before-change-functions' always records the whole word's `b-beg' ;; and `b-end'. Similarly, when coalescing two lines into one, ;; `fill-paragraph' they mark the end of the first line up to the end ;; of the second line. In both situations, args received here ;; contradict that information: `beg' and `end' will differ by 1 and ;; will likely only encompass the letter that was capitalized or, in ;; the sentence-joining situation, the replacement of the newline with ;; a space. That's we keep markers _and_ positions so we're able to ;; detect and correct this. We ignore `beg', `len' and ;; `pre-change-len' and send "fuller" information about the region ;; from the markers. I've also experimented with doing this ;; unconditionally but it seems to break when newlines are added. * eglot.el (eglot--after-change): Robustify fix. --- eglot.el | 42 -- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/eglot.el b/eglot.el index aa89ae9..3ebdd04 100644 --- a/eglot.el +++ b/eglot.el @@ -1729,8 +1729,8 @@ THINGS are either registrations or unregisterations (sic)." ;; (github#259) (push `(,(eglot--pos-to-lsp-position beg) ,(eglot--pos-to-lsp-position end) -(,beg . ,(copy-marker beg)) -(,end . ,(copy-marker end))) +(,beg . ,(copy-marker beg nil)) +(,end . ,(copy-marker end t))) eglot--recent-changes))) (defun eglot--after-change (beg end pre-change-length) @@ -1742,23 +1742,29 @@ Records BEG, END and PRE-CHANGE-LENGTH locally." (`(,lsp-beg ,lsp-end (,b-beg . ,b-beg-marker) (,b-end . ,b-end-marker)) - ;; github#259: With `upcase-word' or somesuch, + ;; github#259 and github#367: With `capitalize-word' or somesuch, ;; `before-change-functions' always records the whole word's - ;; `beg' and `end'. Not only is this longer than needed but - ;; conflicts with the args received here, which encompass just - ;; the parts of the word that changed (if any). We detect this - ;; using markers recorded earlier and at looking - ;; `pre-change-len'. We also ensure that the before bounds - ;; indeed belong to the same line (if we don't, we get could get - ;; #367). - (when (and (= b-end b-end-marker) (= b-beg b-beg-marker) -(not (zerop pre-change-length)) -(= (plist-get lsp-beg :line) (plist-get lsp-end :line))) - (setq lsp-end (eglot--pos-to-lsp-position end) - lsp-beg (eglot--pos-to-lsp-position beg))) - (setcar eglot--recent-changes - `(,lsp-beg ,lsp-end ,pre-change-length -,(buffer-substring-no-properties beg end + ;; `b-beg' and `b-end'. Similarly, when coalescing two lines + ;; into one, `fill-paragraph' they mark the end of the first line + ;; up to the end of the second line. In both situations, args + ;; received here contradict that information: `beg' and `end' + ;; will differ by 1 and will likely only encompass the letter + ;; that was capitalized or, in the sentence-joining situation, + ;; the replacement of the newline with a space. That's we keep + ;; markers _and_ positions so we're able to detect and correct + ;; this. We ignore `beg', `len' and `pre-change-len' and send + ;; "fuller" information about the region from the markers. I've + ;; also experimented with doing this unconditionally but it seems + ;; to break when newlines are added. + (if (and (= b-end b-end-marker) (= b-beg b-beg-marker) + (or (/= beg b-beg) (/= end b-end))) + (setcar eglot--recent-changes + `(,lsp-beg ,lsp-end ,(- b-end-marker b-beg-marker) +,(buffer-substring-no-properties b-beg-marker + b-end-marker))) + (setcar eglot--recent-changes + `(,lsp-beg ,lsp-end ,pre-change-length +,(buffer-substring-no-properties beg end) (_ (setf eglot--recent-changes :emacs-messup))) (when eglot--change-idle-timer (cancel-timer eglot--change-idle-timer)) (let ((buf (current-buffer)))
[elpa] externals/elpa 1056ef5 03/71: Close #413: update dependencies and copyright years
branch: externals/elpa commit 1056ef58a0ac169cd4c966ec86523fc3f2e482da Author: Felicián Németh Commit: Felicián Németh Close #413: update dependencies and copyright years * eglot.el: Update dependencies and copyright years. --- eglot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index 58980a1..13ee307 100644 --- a/eglot.el +++ b/eglot.el @@ -1,13 +1,13 @@ ;;; eglot.el --- Client for Language Server Protocol (LSP) servers -*- lexical-binding: t; -*- -;; Copyright (C) 2018 Free Software Foundation, Inc. +;; Copyright (C) 2018-2020 Free Software Foundation, Inc. ;; Version: 1.6 ;; Author: João Távora ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.7") (flymake "1.0.5")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by
[elpa] externals/elpa 9efe207 05/71: Make curl invocation fail more explicitly in .travis.yml
branch: externals/elpa commit 9efe2071aa860dd80ac3a52de2d9bba8c6fc8985 Author: Tobias Rittweiler Commit: Tobias Rittweiler Make curl invocation fail more explicitly in .travis.yml A previous build (Build #926) failed with: ``` $ curl -LO https://github.com/npostavs/emacs-travis/releases/download/bins/emacs-bin-${EMACS_VERSION}.tar.gz $ tar -xaf emacs-bin-${EMACS_VERSION}.tar.gz -C / gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now ``` --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1644b59..47db13a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ env: - EMACS_VERSION=master install: - - curl -LO https://github.com/npostavs/emacs-travis/releases/download/bins/emacs-bin-${EMACS_VERSION}.tar.gz + - curl -fSLO https://github.com/npostavs/emacs-travis/releases/download/bins/emacs-bin-${EMACS_VERSION}.tar.gz - tar -xaf emacs-bin-${EMACS_VERSION}.tar.gz -C / # Configure $PATH: Emacs installed to /tmp/emacs - export PATH=/tmp/emacs/bin:${PATH}
[elpa] externals/elpa d99a447 12/71: Close #439: Hide eldoc-message on empty hover info
branch: externals/elpa commit d99a4478a9ede56d8e0ccf03800d70a78d8142a6 Author: muffinmad Commit: João Távora Close #439: Hide eldoc-message on empty hover info Co-authored-by: João Távora * eglot.el (eglot-eldoc-function): Pass nil to eglot--update-doc on empty hover info. (eglot--update-doc): Skip update eglot help buffer if string is nil. --- eglot.el | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/eglot.el b/eglot.el index 13571d4..c485b4e 100644 --- a/eglot.el +++ b/eglot.el @@ -2259,10 +2259,12 @@ Buffer is displayed with `display-buffer', which obeys (defun eglot--update-doc (string hint) "Put updated documentation STRING where it belongs. Honours `eglot-put-doc-in-help-buffer'. HINT is used to -potentially rename EGLOT's help buffer." - (if (or (eq t eglot-put-doc-in-help-buffer) - (and eglot-put-doc-in-help-buffer - (funcall eglot-put-doc-in-help-buffer string))) +potentially rename EGLOT's help buffer. If STRING is nil, the +echo area cleared of any previous documentation." + (if (and string + (or (eq t eglot-put-doc-in-help-buffer) + (and eglot-put-doc-in-help-buffer +(funcall eglot-put-doc-in-help-buffer string (with-current-buffer (eglot--help-buffer) (let ((inhibit-read-only t) (name (format "*eglot-help for %s*" hint))) @@ -2314,10 +2316,10 @@ potentially rename EGLOT's help buffer." :success-fn (eglot--lambda ((Hover) contents range) (unless sig-showing (when-buffer-window - (when-let (info (and (not (seq-empty-p contents)) - (eglot--hover-info contents - range))) -(eglot--update-doc info thing-at-point) + (eglot--update-doc (and (not (seq-empty-p contents)) + (eglot--hover-info contents + range)) + thing-at-point :deferred :textDocument/hover)) (when (eglot--server-capable :documentHighlightProvider) (jsonrpc-async-request
[elpa] externals/elpa ef6c483 13/71: Fix #452: also check types when destructuring LSP objects
branch: externals/elpa commit ef6c48328836434fa4dca68450c72aba2601a357 Author: João Távora Commit: João Távora Fix #452: also check types when destructuring LSP objects The problem in this issue is that the disambiguation between Command and CodeAction objects can only be performed by checking the types of the keys involved. So we added that to the spec and check it at runtime. * eglot.el (eglot--lsp-interface-alist): Add types to Command. Tweak docstring. (eglot--check-object): Renamed from eglot--call-with-interface. (eglot--ensure-type): New helper. (eglot--interface): New helper. (eglot--check-dspec): Renamed from eglot--check-interface. (eglot--dbind): Simplify. (eglot-code-actions): Adjust indentation. * eglot-tests.el (eglot-dcase-issue-452): New test. --- eglot-tests.el | 14 +++ eglot.el | 118 + 2 files changed, 82 insertions(+), 50 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index ea5a9cd..f2a9b7f 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -866,6 +866,20 @@ pyls prefers autopep over yafp, despite its README stating the contrary." (((CodeAction) _title _edit _command) (ert-fail "Shouldn't have destructured this object as a CodeAction"))) +(ert-deftest eglot-dcase-issue-452 () + (let ((eglot--lsp-interface-alist + `((FooObject . ((:foo :bar) (:baz))) + (CodeAction (:title) (:kind :diagnostics :edit :command)) + (Command ((string . :title) (:command . string)) (:arguments) +(should + (equal + (list "foo" '(:command "cmd" :title "alsofoo")) + (eglot--dcase '(:title "foo" :command (:command "cmd" :title "alsofoo")) +(((Command) _title _command _arguments) + (ert-fail "Shouldn't have destructured this object as a Command")) +(((CodeAction) title command) + (list title command))) + (provide 'eglot-tests) ;;; eglot-tests.el ends here diff --git a/eglot.el b/eglot.el index c485b4e..42fca9b 100644 --- a/eglot.el +++ b/eglot.el @@ -231,7 +231,7 @@ let the buffer grow forever." `( (CodeAction (:title) (:kind :diagnostics :edit :command)) (ConfigurationItem () (:scopeUri :section)) - (Command (:title :command) (:arguments)) + (Command ((:title . string) (:command . string)) (:arguments)) (CompletionItem (:label) (:kind :detail :documentation :deprecated :preselect :sortText :filterText :insertText :insertTextFormat @@ -265,13 +265,15 @@ let the buffer grow forever." INTERFACE-NAME is a symbol designated by the spec as \"interface\". INTERFACE is a list (REQUIRED OPTIONAL) where -REQUIRED and OPTIONAL are lists of keyword symbols designating -field names that must be, or may be, respectively, present in a -message adhering to that interface. +REQUIRED and OPTIONAL are lists of KEYWORD designating field +names that must be, or may be, respectively, present in a message +adhering to that interface. KEY can be a keyword or a cons (SYM +TYPE), where type is used by `cl-typep' to check types at +runtime. Here's what an element of this alist might look like: -(CreateFile . ((:kind :uri) (:options)))")) +(Command ((:title . string) (:command . string)) (:arguments))")) (eval-and-compile (defvar eglot-strict-mode (if load-file-name '() @@ -308,46 +310,69 @@ on unknown notifications and errors on unknown requests. (defun eglot--plist-keys (plist) (cl-loop for (k _v) on plist by #'cddr collect k)) -(defun eglot--call-with-interface (interface object fn) - "Call FN, checking that OBJECT conforms to INTERFACE." - (when-let ((missing (and (memq 'enforce-required-keys eglot-strict-mode) - (cl-set-difference (car (cdr interface)) - (eglot--plist-keys object) -(eglot--error "A `%s' must have %s" (car interface) missing)) - (when-let ((excess (and (memq 'disallow-non-standard-keys eglot-strict-mode) - (cl-set-difference - (eglot--plist-keys object) - (append (car (cdr interface)) (cadr (cdr interface))) -(eglot--error "A `%s' mustn't have %s" (car interface) excess)) - (funcall fn)) +(cl-defun eglot--check-object (interface-name + object + &optional + (enforce-required t) + (disallow-non-standard t) + (check-types t)) + "Check that OBJECT conforms to INTERFACE. Error otherwise." + (cl-destructuring-bind + (&key types required-keys optional-keys &allow-other-keys) + (eglot--interface interface-name) +(when-let ((missing (and enforce-required + (cl-set-difference requi
[elpa] externals/elpa c9230e8 20/71: Close #408: Declare markdown support iff gfm-view-mode installed
branch: externals/elpa commit c9230e8e705cb53ba7feb8ab4593ea931edc5c6b Author: Felicián Németh Commit: João Távora Close #408: Declare markdown support iff gfm-view-mode installed * eglot.el (eglot-client-capabilities): Support markdown only when gfm-view-mode is installed. --- eglot.el | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index bdc4cd0..596a82d 100644 --- a/eglot.el +++ b/eglot.el @@ -527,7 +527,10 @@ treated as in `eglot-dbind'." :json-false)) :contextSupport t) :hover (list :dynamicRegistration :json-false - :contentFormat ["markdown" "plaintext"]) + :contentFormat + (if (fboundp 'gfm-view-mode) + ["markdown" "plaintext"] + ["plaintext"])) :signatureHelp (list :dynamicRegistration :json-false :signatureInformation `(:parameterInformation
[elpa] externals/elpa a0249c8 23/71: Per #437: remap display-local-help (C-h .) to eglot-help-at-point
branch: externals/elpa commit a0249c81fa466c08df87de92749b77f0f0db5ff6 Author: João Távora Commit: João Távora Per #437: remap display-local-help (C-h .) to eglot-help-at-point * eglot.el (eglot-help-at-point): Fallback to display-local-help if no hover doc (eglot-mode-map): Remap display-local-help to eglot-help-at-point.. --- eglot.el | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/eglot.el b/eglot.el index 09be1f8..8fadd5f 100644 --- a/eglot.el +++ b/eglot.el @@ -1238,7 +1238,10 @@ and just return it. PROMPT shouldn't end with a question mark." ;;; Minor modes ;;; -(defvar eglot-mode-map (make-sparse-keymap)) +(defvar eglot-mode-map + (let ((map (make-sparse-keymap))) +(define-key map [remap display-local-help] 'eglot-help-at-point) +map)) (defvar-local eglot--current-flymake-report-fn nil "Current flymake report function for this buffer") @@ -2247,19 +2250,20 @@ is not active." (setq eglot--help-buffer (generate-new-buffer "*eglot-help*" (defun eglot-help-at-point () - "Request \"hover\" information for the thing at point." + "Request documentation for the thing at point." (interactive) (eglot--dbind ((Hover) contents range) (jsonrpc-request (eglot--current-server-or-lose) :textDocument/hover (eglot--TextDocumentPositionParams)) -(when (seq-empty-p contents) (eglot--error "No hover info here")) -(let ((blurb (eglot--hover-info contents range)) - (sym (thing-at-point 'symbol))) - (with-current-buffer (eglot--help-buffer) -(with-help-window (current-buffer) - (rename-buffer (format "*eglot-help for %s*" sym)) - (with-current-buffer standard-output (insert blurb)) - (setq-local nobreak-char-display nil)) +(if (seq-empty-p contents) +(display-local-help) + (let ((blurb (eglot--hover-info contents range)) +(sym (thing-at-point 'symbol))) +(with-current-buffer (eglot--help-buffer) + (with-help-window (current-buffer) +(rename-buffer (format "*eglot-help for %s*" sym)) +(with-current-buffer standard-output (insert blurb)) +(setq-local nobreak-char-display nil))) (defun eglot-doc-too-large-for-echo-area (string) "Return non-nil if STRING won't fit in echo area.
[elpa] externals/elpa e5cf30e 09/71: Close #435: create match xrefs when possible
branch: externals/elpa commit e5cf30e26bd3107583418f2b4539c7385d37d6c8 Author: Trevor Murphy Commit: GitHub Close #435: create match xrefs when possible "Match xrefs" are created with `xref-make-match' instead of `xref-make'. Match xrefs support `xref-query-replace-in-results' from the results buffer. * eglot.el (eglot--xref-make-match): Calculate xref match length from the eglot range. --- eglot.el | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/eglot.el b/eglot.el index 3ea8391..c7c4551 100644 --- a/eglot.el +++ b/eglot.el @@ -1833,8 +1833,8 @@ Calls REPORT-FN maybe if server publishes diagnostics in time." (maphash (lambda (_uri buf) (kill-buffer buf)) eglot--temp-location-buffers) (clrhash eglot--temp-location-buffers -(defun eglot--xref-make (name uri range) - "Like `xref-make' but with LSP's NAME, URI and RANGE. +(defun eglot--xref-make-match (name uri range) + "Like `xref-make-match' but with LSP's NAME, URI and RANGE. Try to visit the target file for a richer summary line." (pcase-let* ((file (eglot--uri-to-path uri)) @@ -1849,8 +1849,9 @@ Try to visit the target file for a richer summary line." (hi-end (- (min (point-at-eol) end) bol))) (add-face-text-property hi-beg hi-end 'highlight t substring) - (list substring (1+ (current-line)) (eglot-current-column)) - (`(,summary ,line ,column) + (list substring (1+ (current-line)) (eglot-current-column) + (- end beg)) + (`(,summary ,line ,column ,length) (cond (visiting (with-current-buffer visiting (funcall collect))) ((file-readable-p file) (with-current-buffer @@ -1859,9 +1860,12 @@ Try to visit the target file for a richer summary line." (insert-file-contents file) (funcall collect))) (t ;; fall back to the "dumb strategy" - (let ((start (cl-getf range :start))) -(list name (1+ (cl-getf start :line)) (cl-getf start :character))) -(xref-make summary (xref-make-file-location file line column + (let* ((start (cl-getf range :start)) + (line (1+ (cl-getf start :line))) + (start-pos (cl-getf start :character)) + (end-pos (cl-getf (cl-getf range :end) :character))) +(list name line start-pos (- end-pos start-pos))) +(xref-make-match summary (xref-make-file-location file line column) length))) (cl-defmethod xref-backend-identifier-completion-table ((_backend (eql eglot))) (eglot--error "cannot (yet) provide reliable completion table for LSP symbols")) @@ -1892,7 +1896,7 @@ Try to visit the target file for a richer summary line." (eglot--collecting-xrefs (collect) (mapc (eglot--lambda ((Location) uri range) - (collect (eglot--xref-make (symbol-at-point) uri range))) + (collect (eglot--xref-make-match (symbol-at-point) uri range))) (if (vectorp response) response (list response)) (cl-defun eglot--lsp-xref-helper (method &key extra-params capability ) @@ -1935,7 +1939,7 @@ Try to visit the target file for a richer summary line." (mapc (eglot--lambda ((SymbolInformation) name location) (eglot--dbind ((Location) uri range) location - (collect (eglot--xref-make name uri range + (collect (eglot--xref-make-match name uri range (jsonrpc-request (eglot--current-server-or-lose) :workspace/symbol `(:query ,pattern))
[elpa] externals/elpa 1cfcef4 37/71: Close #471: add support for erlang_ls
branch: externals/elpa commit 1cfcef4108f09a0d6cea84c6fe12fbdea1158f5e Author: Rudolf Schlatte Commit: GitHub Close #471: add support for erlang_ls * README.md: Mention erlang_ls * eglot.el (eglot-server-programs): Add erlang_ls --- README.md | 2 ++ eglot.el | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bc20c0..edbc779 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ for the language you're using. Otherwise, it prompts you to enter one. * R's [languageserver][r-languageserver] * Dart's [dart_language_server][dart_language_server] * Elixir's [elixir-ls][elixir-ls] +* Erlang's [erlang_ls][erlang_ls] * Ada's [ada_language_server][ada_language_server] * Scala's [metals][metals] * TeX/LaTeX's [Digestif][digestif] @@ -525,6 +526,7 @@ Under the hood: [r-languageserver]: https://cran.r-project.org/package=languageserver [dart_language_server]: https://github.com/natebosch/dart_language_server [elixir-ls]: https://github.com/JakeBecker/elixir-ls +[erlang_ls]: https://github.com/erlang-ls/erlang_ls [news]: https://github.com/joaotavora/eglot/blob/master/NEWS.md [ada_language_server]: https://github.com/AdaCore/ada_language_server [metals]: http://scalameta.org/metals/ diff --git a/eglot.el b/eglot.el index 21a2496..c38620e 100644 --- a/eglot.el +++ b/eglot.el @@ -111,7 +111,8 @@ language-server/bin/php-language-server.php")) (ada-mode . ("ada_language_server")) (scala-mode . ("metals-emacs")) ((tex-mode context-mode texinfo-mode bibtex-mode) - . ("digestif"))) + . ("digestif")) +(erlang-mode . ("erlang_ls" "--transport" "stdio"))) "How the command `eglot' guesses the server to start. An association list of (MAJOR-MODE . CONTACT) pairs. MAJOR-MODE is a mode symbol, or a list of mode symbols. The associated
[elpa] externals/elpa 2f75da2 28/71: Fix #460: fix "free variable" warning
branch: externals/elpa commit 2f75da24b78a0fe409958989ab99d7efbd7a8686 Author: Tobias Rittweiler Commit: GitHub Fix #460: fix "free variable" warning * eglot.el (eglot-events-buffer): Use `eglot-current-server' instead of `eglot--cached-server' because the latter is declared later in the file. --- eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index b5f05ce..8dae0b7 100644 --- a/eglot.el +++ b/eglot.el @@ -810,7 +810,7 @@ INTERACTIVE is t if called interactively." (defun eglot-events-buffer (server) "Display events buffer for SERVER. Use current server's or first available Eglot events buffer." - (interactive (list eglot--cached-server)) + (interactive (list (eglot-current-server))) (let ((buffer (if server (jsonrpc-events-buffer server) (cl-find "\\*EGLOT.*events\\*" (buffer-list)
[elpa] externals/elpa ffe79b9 34/71: Pin pyls to 0.31.10
branch: externals/elpa commit ffe79b9cae79d5d60b79795beea6c94b21f9f147 Author: Andrii Kolomoiets Commit: GitHub Pin pyls to 0.31.10 Fix `No support for renaming in Python 2/3.5 with Jedi` error in `rename-a-symbol` test. * (.travis.yml): Specify pyls version. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1c04ef5..085eebd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ install: # Install https://github.com/palantir/python-language-server - virtualenv . - . ./bin/activate - - pip install 'python-language-server[all]' + - pip install 'python-language-server[all]==0.31.10' # Install eclipse.jdt.ls - curl -fSL http://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz -o eclipse.tar.gz - mkdir eclipse.jdt.ls
[elpa] externals/elpa 433779d 49/71: * eglot.el (Package-Requires): Require Flymake 1.0.9 and eldoc 1.2.0
branch: externals/elpa commit 433779dbd27e1a9678e4c6cd4189c65d1900665a Author: João Távora Commit: João Távora * eglot.el (Package-Requires): Require Flymake 1.0.9 and eldoc 1.2.0 --- eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index b94fcc3..3e9c964 100644 --- a/eglot.el +++ b/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8") (project "0.3.0") (xref "1.0.1") (eldoc "1.1.0")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.9") (project "0.3.0") (xref "1.0.1") (eldoc "1.2.0")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by
[elpa] externals/elpa c34e2f6 50/71: Really install latest dependencies
branch: externals/elpa commit c34e2f692f600be37b037d5c43469c331e6bf139 Author: João Távora Commit: João Távora Really install latest dependencies * Makefile (ELPADEPS): Really install latest dependencies --- Makefile | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index dfbd69f..4f5e8fb 100644 --- a/Makefile +++ b/Makefile @@ -11,17 +11,23 @@ LOAD_PATH=-L . ELFILES := eglot.el eglot-tests.el ELCFILES := $(ELFILES:.el=.elc) -ELPADEPS ?=--eval '(package-initialize)' \ - --eval '(package-refresh-contents)' \ - --eval '(package-install (quote jsonrpc))' \ - --eval '(package-install (quote project))' \ - --eval '(package-install (quote xref))' \ - --eval '(package-install (quote eldoc))'\ - --eval '(package-install (quote company))' \ - --eval '(package-install (quote yasnippet))'\ - --eval '(package-install\ - (cadr (assoc (quote flymake) \ - package-archive-contents)))' +ELPADEPS ?=--eval '(package-initialize)'\ + --eval '(package-refresh-contents)' \ + --eval '(defun install-latest (p)\ + (package-install \ + (cadr (assoc p \ + package-archive-contents \ + (quote equal)'\ + --eval '(install-latest (quote jsonrpc))'\ + --eval '(install-latest (quote project))'\ + --eval '(install-latest (quote xref))' \ + --eval '(install-latest (quote eldoc))' \ + --eval '(unintern\ + (quote eldoc-documentation-function))' \ + --eval '(load "eldoc")' \ + --eval '(install-latest (quote company))'\ + --eval '(install-latest (quote yasnippet))' \ + --eval '(install-latest (quote flymake))' BYTECOMP_ERROR_ON_WARN := \ --eval '(setq byte-compile-error-on-warn $(ERROR_ON_WARN))'
[elpa] externals/elpa 6d96601 52/71: Closes #509: fix sorting of completion items
branch: externals/elpa commit 6d9660152b6d86931a6b1dd25f81a354b77a5ae8 Author: João Távora Commit: João Távora Closes #509: fix sorting of completion items This fixes a problem pointed out by Yuwei Tian . * eglot.el (eglot-completion-at-point): Fix getting :sortText content of the completion item. --- eglot.el | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/eglot.el b/eglot.el index 3e9c964..87fd9c8 100644 --- a/eglot.el +++ b/eglot.el @@ -2053,12 +2053,15 @@ is not active." ;; Commit logs for this function help understand what's going on. (when-let (completion-capability (eglot--server-capable :completionProvider)) (let* ((server (eglot--current-server-or-lose)) - (sort-completions (lambda (completions) - (sort completions - (lambda (a b) - (string-lessp -(or (get-text-property 0 :sortText a) "") -(or (get-text-property 0 :sortText b) "")) + (sort-completions +(lambda (completions) + (cl-sort completions + #'string-lessp + :key (lambda (c) + (or (plist-get + (get-text-property 0 'eglot--lsp-item c) + :sortText) + "") (metadata `(metadata . ((display-sort-function . ,sort-completions resp items (cached-proxies :none) (proxies
[elpa] externals/elpa e3ce64a 54/71: Fix #510: use a hash-table for storing resolved completions
branch: externals/elpa commit e3ce64adc09922a87936617484e48cbecc5db729 Author: João Távora Commit: João Távora Fix #510: use a hash-table for storing resolved completions * eglot.el (eglot-completion-at-point): use a hash-table for storing resolved completions. --- eglot.el | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/eglot.el b/eglot.el index 865ca03..c0f3143 100644 --- a/eglot.el +++ b/eglot.el @@ -2103,20 +2103,20 @@ is not active." (put-text-property 0 1 'eglot--lsp-item item proxy)) proxy)) items) - resolved + (resolved (make-hash-table)) (resolve-maybe ;; Maybe completion/resolve JSON object `lsp-comp' into ;; another JSON object, if at all possible. Otherwise, ;; just return lsp-comp. (lambda (lsp-comp) - (cond (resolved resolved) -((and (eglot--server-capable :completionProvider - :resolveProvider) - (plist-get lsp-comp :data)) - (setq resolved - (jsonrpc-request server :completionItem/resolve -lsp-comp :cancel-on-input t))) -(t lsp-comp + (or (gethash lsp-comp resolved) + (setf (gethash lsp-comp resolved) +(if (and (eglot--server-capable :completionProvider +:resolveProvider) + (plist-get lsp-comp :data)) +(jsonrpc-request server :completionItem/resolve + lsp-comp :cancel-on-input t) + lsp-comp) (bounds (bounds-of-thing-at-point 'symbol))) (list (or (car bounds) (point))
[elpa] externals/elpa 8c9219d 55/71: Unbreak tests after changes to eldoc.el
branch: externals/elpa commit 8c9219d5dd7bdc329704953f9b34cdaeb23a70e1 Author: João Távora Commit: João Távora Unbreak tests after changes to eldoc.el Related to #505. * eglot-tests.el (eglot--eldoc-on-demand): Don't rely on gone eldoc-display-message-p. --- eglot-tests.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 4730ee7..86d2f0c 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -423,8 +423,7 @@ Pass TIMEOUT to `eglot--with-timeout'." (defun eglot--eldoc-on-demand () ;; Trick Eldoc 1.1.0 into accepting on-demand calls. (let ((this-command nil) (last-command 'forward-char)) -(should (eldoc-display-message-p)) -(eldoc))) +(should (eldoc (defun eglot--tests-force-full-eldoc () (let ((origin (current-buffer)))
[elpa] externals/elpa ea82b4b 57/71: Close #505: ensure completion terminates in correct buffer
branch: externals/elpa commit ea82b4bb746e45d9d48c738294f8e84598aff502 Author: Andrew Schwartzmeyer Commit: João Távora Close #505: ensure completion terminates in correct buffer To design a completion-in-region-function replacement that leverages the elements in completion-at-point-functions, we must ensure that their :exit-function parts execute in the correct buffer. That is the buffer where the text to be completed lives, not necessarily the buffer being used for user interaction. Later on, this guarantee should be provided by Emacs itself, perhaps by putting the correct with-current-buffer call in completion--done. Copyright-paperwork-exempt: yes Co-authored-by: João Távora * eglot.el (eglot-completion-at-point): Ensure :exit-function's buffer is where the source is. --- eglot.el | 86 +++- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/eglot.el b/eglot.el index c0f3143..0b23337 100644 --- a/eglot.el +++ b/eglot.el @@ -2175,45 +2175,53 @@ is not active." (line-beginning-position :exit-function (lambda (proxy _status) - (eglot--dbind ((CompletionItem) insertTextFormat -insertText textEdit additionalTextEdits label) - (funcall - resolve-maybe - (or (get-text-property 0 'eglot--lsp-item proxy) -;; When selecting from the *Completions* -;; buffer, `proxy' won't have any properties. -;; A lookup should fix that (github#148) -(get-text-property - 0 'eglot--lsp-item - (cl-find proxy (funcall proxies) :test #'string= - (let ((snippet-fn (and (eql insertTextFormat 2) - (eglot--snippet-expansion-fn - (cond (textEdit -;; Undo (yes, undo) the newly inserted completion. -;; If before completion the buffer was "foo.b" and -;; now is "foo.bar", `proxy' will be "bar". We -;; want to delete only "ar" (`proxy' minus the -;; symbol whose bounds we've calculated before) -;; (github#160). -(delete-region (+ (- (point) (length proxy)) - (if bounds (- (cdr bounds) (car bounds)) 0)) - (point)) -(eglot--dbind ((TextEdit) range newText) textEdit - (pcase-let ((`(,beg . ,end) (eglot--range-region range))) -(delete-region beg end) -(goto-char beg) -(funcall (or snippet-fn #'insert) newText))) -(when (cl-plusp (length additionalTextEdits)) - (eglot--apply-text-edits additionalTextEdits))) - (snippet-fn -;; A snippet should be inserted, but using plain -;; `insertText'. This requires us to delete the -;; whole completion, since `insertText' is the full -;; completion's text. -(delete-region (- (point) (length proxy)) (point)) -(funcall snippet-fn (or insertText label) - (eglot--signal-textDocument/didChange) - (eldoc))) + ;; To assist in using this whole `completion-at-point' + ;; function inside `completion-in-region', ensure the exit + ;; function runs in the buffer where the completion was + ;; triggered from. This should probably be in Emacs itself. + ;; (github#505) + (with-current-buffer (if (minibufferp) + (window-buffer (minibuffer-selected-window)) +(current-buffer)) + (eglot--dbind ((CompletionItem) insertTextFormat + insertText textEdit additionalTextEdits label) + (funcall +resolve-maybe +(or (get-text-property 0 'eglot--lsp-item proxy) +;; When selecting from the *Completions* +;; buffer, `proxy' won't have any properties. +;; A lookup should fix that (github#148) +(get-text-property + 0 'eglot--lsp-item + (cl-find proxy (funcall proxies) :test #'string= + (let ((snippet-fn (and (eql insertTextFormat 2) +(eglot--snippet-expansion-fn + (cond (textEdit + ;; Undo (yes, undo) the newly inserted completion. + ;; If before completion the buffer was "foo.b" and + ;; now is "foo.bar", `proxy' will be "bar".
[elpa] externals/elpa fb6b17e 58/71: New 'make interactive' target for debuggable M-x ert
branch: externals/elpa commit fb6b17e86eddc22b9ec81f52718fad6bcbb53668 Author: João Távora Commit: João Távora New 'make interactive' target for debuggable M-x ert * Makefile (interactive): New target for interactive testing. --- Makefile | 7 +++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 4f5e8fb..a53ee91 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,13 @@ eglot-check: compile --eval '(setq ert-batch-backtrace-right-margin 200)'\ --eval '(ert-run-tests-batch-and-exit (quote $(SELECTOR)))' +interactive: compile + $(EMACS) -Q \ + $(ELPADEPS) \ + $(LOAD_PATH)\ + -l eglot\ + -l eglot-tests \ + check: eglot-check # Cleanup
[elpa] externals/elpa 5a2cde9 59/71: Close #511: add built-int support for Godot Engine
branch: externals/elpa commit 5a2cde98d4b629a14370bf4ce52449bbf3294838 Author: Steven vanZyl Commit: João Távora Close #511: add built-int support for Godot Engine Copyright-paperwork-exempt: yes Co-authored-by: João Távora * README.md: mention Godot * eglot.el (eglot-server-programs): Add godot engine via port --- README.md | 2 ++ eglot.el | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index caf03ba..c45ba28 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ for the language you're using. Otherwise, it prompts you to enter one. * Ada's [ada_language_server][ada_language_server] * Scala's [metals][metals] * TeX/LaTeX's [Digestif][digestif] +* Godot Engine's [built-in LSP][godot] I'll add to this list as I test more servers. In the meantime you can customize `eglot-server-programs`: @@ -529,3 +530,4 @@ Under the hood: [flymake]: https://www.gnu.org/software/emacs/manual/html_node/flymake/index.html#Top [yasnippet]: http://elpa.gnu.org/packages/yasnippet.html [markdown]: https://github.com/defunkt/markdown-mode +[godot]: https://godotengine.org diff --git a/eglot.el b/eglot.el index 0b23337..023c0df 100644 --- a/eglot.el +++ b/eglot.el @@ -121,7 +121,8 @@ language-server/bin/php-language-server.php")) (scala-mode . ("metals-emacs")) ((tex-mode context-mode texinfo-mode bibtex-mode) . ("digestif")) -(erlang-mode . ("erlang_ls" "--transport" "stdio"))) +(erlang-mode . ("erlang_ls" "--transport" "stdio")) +(gdscript-mode . ("localhost" 6008)) "How the command `eglot' guesses the server to start. An association list of (MAJOR-MODE . CONTACT) pairs. MAJOR-MODE is a mode symbol, or a list of mode symbols. The associated
[elpa] externals/elpa 61b71ea 62/71: Fix #528: unbreak Haskell's hie-wrapper built-in incantation
branch: externals/elpa commit 61b71ea769fa14887465517f70832861f7052816 Author: R Primus Commit: GitHub Fix #528: unbreak Haskell's hie-wrapper built-in incantation * eglot.el (eglot-server-programs): Add required argument for hie-wrapper Copyright-paperwork-exempt: yes --- eglot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index 64543d7..c752322 100644 --- a/eglot.el +++ b/eglot.el @@ -100,7 +100,7 @@ typescript-mode) . ("javascript-typescript-stdio")) (sh-mode . ("bash-language-server" "start")) - (php-mode . ("php" "vendor/felixfbecker/\ + (php-mode . ("php" "vendor/felixfbecker/\ language-server/bin/php-language-server.php")) ((c++-mode c-mode) . ("ccls")) ((caml-mode tuareg-mode reason-mode) @@ -108,7 +108,7 @@ language-server/bin/php-language-server.php")) (ruby-mode . ("solargraph" "socket" "--port" :autoport)) -(haskell-mode . ("hie-wrapper")) +(haskell-mode . ("hie-wrapper" "--lsp")) (elm-mode . ("elm-language-server")) (kotlin-mode . ("kotlin-language-server")) (go-mode . ("gopls"))
[elpa] externals/elpa 22aa27c 01/71: Close #397: Simplify a bit of code
branch: externals/elpa commit 22aa27cd08ee7b671a0ee45af15a0865c08f4116 Author: theothornhill Commit: João Távora Close #397: Simplify a bit of code Co-authored-by: João Távora * eglot.el (eglot-move-to-lsp-abiding-column): use already existing function to refer to lsp-abiding-column --- eglot.el | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/eglot.el b/eglot.el index eafe22e..58980a1 100644 --- a/eglot.el +++ b/eglot.el @@ -1012,9 +1012,10 @@ fully LSP-compliant servers, this should be set to `eglot-lsp-abiding-column' (the default), and `eglot-current-column' for all others.") -(defun eglot-lsp-abiding-column () - "Calculate current COLUMN as defined by the LSP spec." - (/ (- (length (encode-coding-region (line-beginning-position) +(defun eglot-lsp-abiding-column (&optional lbp) + "Calculate current COLUMN as defined by the LSP spec. +LBP defaults to `line-beginning-position'." + (/ (- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2) 2)) @@ -1057,9 +1058,7 @@ be set to `eglot-move-to-lsp-abiding-column' (the default), and (narrow-to-region lbp (line-end-position)) (move-to-column column) for diff = (- column - (/ (- (length (encode-coding-region lbp (point) 'utf-16 t)) - 2) - 2)) + (eglot-lsp-abiding-column lbp)) until (zerop diff) do (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2))
[elpa] branch externals/elpa created (now 4edd478)
capitaomorte pushed a change to branch externals/elpa. at 4edd478 Bump Eglot version to 1.7 This branch includes the following new commits: new 22aa27c Close #397: Simplify a bit of code new 8b94cf4 Per #397: Add new eglot-lsp-abiding-column test new 1056ef5 Close #413: update dependencies and copyright years new 8900a35 Prevent "Cant guess python-indent-offset..." messages in tests new 9efe207 Make curl invocation fail more explicitly in .travis.yml new af32ebf Close #444: use text-mode for plaintext markup new e1e7362 Fix #445: don't reupdate help buffer if already rendered new dd48f4a * eglot.el (eglot-put-doc-in-help-buffer): Tiny docstring fix. new e5cf30e Close #435: create match xrefs when possible new 3483a2f Tests: print contents of *EGLOT ...* buffers in batch mode. new 73bc752 Close #441: shield tests from some user customizations new d99a447 Close #439: Hide eldoc-message on empty hover info new ef6c483 Fix #452: also check types when destructuring LSP objects new da04fdc Close #303: support hierarchical DocumentSymbol in eglot-imenu new f7a7e33 Tweak docstring of eglot-server-programs new b6519a5 Per #446: Add tests for eglot-server-programs new 9bc58df Fix #446: unbreak eglot--guess-contact for host-and-port case new 487cde5 Close #443: kind of honour eldoc-echo-area-use-multiline-p new eb29f7c Close #450: always string-trim markup new c9230e8 Close #408: Declare markdown support iff gfm-view-mode installed new a2fa9ab Per #408: fontify markdown source code blocks by default new d244cc5 Per #443: tweak handling of eldoc-echo-area-use-multiline-p new a0249c8 Per #437: remap display-local-help (C-h .) to eglot-help-at-point new ad3f049 Close #417: minimally document relation with project.el new 50f9a69 Fix #433: survive hover responses with empty markdown strings new 0f57efb Simplify bug-reporting instructions new 197984c Remove trailing whitespaces new 2f75da2 Fix #460: fix "free variable" warning new e514f9e Close #461: make CI fail if byte compiler warns new bb51d47 Close #409: make a test more robust new da7ff48 Fix #468: don't call flymake report function if flymake is disabled new e690e8c Per #474, #478: add more tests for `eglot--guess-contact' new 91a7cba Fix #474, #478: prompt for executable if supplied name does not exist new ffe79b9 Pin pyls to 0.31.10 new bf75312 Require Xref, Project and Eldoc from GNU ELPA new 3634402 Fix #479: correctly place diagnostics in narrowed buffers new 1cfcef4 Close #471: add support for erlang_ls new b0bfbfb Fix #488: fix type error in eglot--xref-make-match new 3b01561 Close #459: rework computation of string given to Eldoc (again) new e7a43e2 Fix #480: also consider label of a CompletionItem for snippets new ee87519 Replace uses of project-roots with project-root new 9874456 Close #482: use filter-buffer-substring to get buffer text new a807b4f Some test-related cleanup new 2b16952 Try to make hover-multiline-doc-locus test pass on Travis new b34447c Close #473: simplify eglot-code-actions new ac9239b Fix small problems around Eglot's help buffer new a044dec Delegate "hover" and "signature" doc synchronization efforts to Eldoc new a04b826 Update tests after update to newer Eldoc new 433779d * eglot.el (Package-Requires): Require Flymake 1.0.9 and eldoc 1.2.0 new c34e2f6 Really install latest dependencies new 2b7ec0e Expect eglot-multiline-eldoc to fail on Travis new 6d96601 Closes #509: fix sorting of completion items new 4e82f53 Reload Eldoc if needed on Emacs < 28 new e3ce64a Fix #510: use a hash-table for storing resolved completions new 8c9219d Unbreak tests after changes to eldoc.el new e5fefc7 Really unbreak eldoc-related tests new ea82b4b Close #505: ensure completion terminates in correct buffer new fb6b17e New 'make interactive' target for debuggable M-x ert new 5a2cde9 Close #511: add built-int support for Godot Engine new 5f873d2 Fix #521: Correct paren mismatch blunder introduced by earlier commit new 209b227 Fix #524: provide suitable default to M-x eglot-rename new 61b71ea Fix #528: unbreak Haskell's hie-wrapper built-in incantation new f9a11fe Per #300: Don't send JSON null (Elisp nil) down the wire new b19b294 Close #558: handle LSP 3.15's isPreferred code action property new 2172641 Fix #558: Don't force eglot-strict-mode completely in eglot--dcase new 389
[elpa] externals/elpa 8900a35 04/71: Prevent "Cant guess python-indent-offset..." messages in tests
branch: externals/elpa commit 8900a3533da1cecc016d5f61242c90ea38b9b9d6 Author: Tobias Rittweiler Commit: GitHub Prevent "Cant guess python-indent-offset..." messages in tests * eglot-tests.el (eglot--tests--python-mode-bindings): New. Sets `python-indent-guess-indent-offset-verbose' to nil. (auto-detect-running-server) (auto-shutdown) (auto-reconnect) (basic-diagnostics) (rename-a-symbol) (basic-completion) (basic-xref) (snippet-completions) (snippet-completions-with-company) (hover-after-completions) (python-autopep-formatting) (python-yaps-formatting) (eglot-ensure) (slow-sync-connection-wait) (slow-sync-connection-intime) (slow-async-connection) (slow-sync-timeout): Use `eglot--tests--python-mode-bindings' in these tests. --- eglot-tests.el | 75 +- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index d516891..fb62a72 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -31,7 +31,7 @@ (require 'python) ; python-mode-hook (require 'company nil t) -;; Helpers +;;; Helpers (defun eglot--have-eclipse-jdt-ls-p () (and (getenv "CLASSPATH") @@ -232,6 +232,14 @@ Pass TIMEOUT to `eglot--with-timeout'." (eglot-connect-timeout timeout)) (apply #'eglot--connect (eglot--guess-contact +(defvar eglot--tests--python-mode-bindings + '(;; Prevent "Can't guess python-indent-offset ..." messages. +(python-indent-guess-indent-offset-verbose . nil)) + "Alist of variable bindings to be used in tests involving `python-mode'.") + + +;;; Unit tests + (ert-deftest eclipse-connect () "Connect to eclipse.jdt.ls server." (skip-unless (eglot--have-eclipse-jdt-ls-p)) @@ -278,9 +286,10 @@ Pass TIMEOUT to `eglot--with-timeout'." (skip-unless (executable-find "pyls")) (let (server) (eglot--with-fixture -'(("project" . (("coiso.py" . "bla") +`(("project" . (("coiso.py" . "bla") ("merdix.py" . "bla"))) - ("anotherproject" . (("cena.py" . "bla" + ("anotherproject" . (("cena.py" . "bla"))) + ,@eglot--tests--python-mode-bindings) (with-current-buffer (eglot--find-file-noselect "project/coiso.py") (should (setq server (eglot--tests-connect))) @@ -299,7 +308,8 @@ Pass TIMEOUT to `eglot--with-timeout'." (let (server buffer) (eglot--with-fixture -'(("project" . (("coiso.py" . "def coiso: pass" +`(("project" . (("coiso.py" . "def coiso: pass"))) + ,@eglot--tests--python-mode-bindings) (with-current-buffer (setq buffer (eglot--find-file-noselect "project/coiso.py")) (should (setq server (eglot--tests-connect))) @@ -317,8 +327,9 @@ Pass TIMEOUT to `eglot--with-timeout'." (skip-unless (executable-find "pyls")) (let (server (eglot-autoreconnect 1)) (eglot--with-fixture -'(("project" . (("coiso.py" . "bla") -("merdix.py" . "bla" +`(("project" . (("coiso.py" . "bla") +("merdix.py" . "bla"))) + ,@eglot--tests--python-mode-bindings) (with-current-buffer (eglot--find-file-noselect "project/coiso.py") (should (setq server (eglot--tests-connect))) @@ -375,8 +386,9 @@ Pass TIMEOUT to `eglot--with-timeout'." "Test basic diagnostics." (skip-unless (executable-find "pyls")) (eglot--with-fixture - '(("diag-project" . - (("main.py" . "def foo(): if True pass" ; colon missing after True + `(("diag-project" . + (("main.py" . "def foo(): if True pass"))) ; colon missing after True +,@eglot--tests--python-mode-bindings) (with-current-buffer (eglot--find-file-noselect "diag-project/main.py") (eglot--sniffing (:server-notifications s-notifs) @@ -427,9 +439,10 @@ Pass TIMEOUT to `eglot--with-timeout'." "Test basic symbol renaming" (skip-unless (executable-find "pyls")) (eglot--with-fixture - '(("rename-project" + `(("rename-project" . (("main.py" . - "def foo (bar) : 1 + bar\n\ndef bar() : pass" + "def foo (bar) : 1 + bar\n\ndef bar() : pass"))) +,@eglot--tests--python-mode-bindings) (with-current-buffer (eglot--find-file-noselect "rename-project/main.py") (eglot--tests-connect) @@ -442,7 +455,8 @@ Pass TIMEOUT to `eglot--with-timeout'." "Test basic autocompletion in a python LSP" (skip-unless (executable-find "pyls")) (eglot--with-fixture - '(("project" . (("something.py" . "import sys\nsys.exi" + `(("project" . (("something.py" . "import sys\nsys.exi"))) +,@eglot--tests--python-mode-bindings) (with-current-buffer (eglot--find-file-noselect "project/something.py") (should (eglot--tests-connect)) @@ -454,7 +468,8 @@ Pass TIMEOUT to `eglot--wi
[elpa] externals/elpa 3483a2f 10/71: Tests: print contents of *EGLOT ...* buffers in batch mode.
branch: externals/elpa commit 3483a2fd0792b988ec6c4dbc1b92dd4fe7a8c4e5 Author: Tobias Rittweiler Commit: Tobias Rittweiler Tests: print contents of *EGLOT ...* buffers in batch mode. Useful for the CI on github. To be able to see more of the context of a failure. * eglot.el (eglot-server-initialized-hook): Changed semantics. Now called when an instance of `eglot-lsp-server' is created as part of the "connect to server" flow. Previously, there was no difference between this hook and `eglot-connect-hook' which continues to be run once a connection was successfully established. The `eglot-server-initialized-hook' will now capture ALL server instances including those that failed to be started. This change was necessary to make the test suite be able to dump the output of processes that fail to start when running the test suite in batch mode ("make check" and the CI.) In PR #448 it was decided that it is ok to change the semantics of this hook rather than introducing a new hook. (eglot--connect): Change place of where the hook is run. (eglot-connect-hook): Initialized now with `eglot-signal-didChangeConfiguration' which was kept in `eglot-server-initialized-hook' before. * eglot-tests.el (eglot--call-with-fixture): Use `eglot-server-initialized-hook' rather than `eglot-connect-hook'. And dump the contents of the *EGLOT ...* buffers when run in `noninteractive' (i.e. batch) mode. (eglot--cleanup-after-test): New auxiliary function. Extracted verbatim out of `eglot--call-with-fixture` in order to lower the latter's LOC. --- eglot-tests.el | 61 +++--- eglot.el | 18 - 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index fb62a72..faf0e16 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -84,7 +84,7 @@ then restored." (set (car spec) (cadr spec))) ((stringp (car spec)) (push spec file-specs (unwind-protect -(let ((eglot-connect-hook +(let ((eglot-server-initialized-hook (lambda (server) (push server new-servers (setq created-files (mapcan #'eglot--make-file-or-dir file-specs)) (prog1 (funcall fn) @@ -93,25 +93,46 @@ then restored." "Test body was %s" (if test-body-successful-p "OK" "A FAILURE")) (unwind-protect (let ((eglot-autoreconnect nil)) -(mapc (lambda (server) -(condition-case oops -(eglot-shutdown - server nil 3 (not test-body-successful-p)) - (error - (message "[eglot] Non-critical shutdown error after test: %S" -oops - (cl-remove-if-not #'jsonrpc-running-p new-servers))) -(let ((buffers-to-delete - (delete nil (mapcar #'find-buffer-visiting created-files - (eglot--message "Killing %s, wiping %s, restoring %s" - buffers-to-delete - default-directory - (mapcar #'car syms-to-restore)) - (cl-loop for (sym . val) in syms-to-restore - do (set sym val)) - (dolist (buf buffers-to-delete) ;; have to save otherwise will get prompted -(with-current-buffer buf (save-buffer) (kill-buffer))) - (delete-directory fixture-directory 'recursive)) +(dolist (server new-servers) + (when (jsonrpc-running-p server) +(condition-case oops +(eglot-shutdown + server nil 3 (not test-body-successful-p)) + (error + (eglot--message "Non-critical shutdown error after test: %S" + oops + (when (not test-body-successful-p) +;; We want to do this after the sockets have +;; shut down such that any pending data has been +;; consumed and is available in the process +;; buffers. +(let ((buffers (delq nil (list + ;; FIXME: Accessing "internal" symbol here. + (process-buffer (jsonrpc--process server)) + (jsonrpc-stderr-buffer server) + (jsonrpc-events-buffer server) + (cond (noninteractive + (dolist (buffer buffers) + (eglot--message "%s:" (buffer-name buffer)) + (princ (with-current-buffer buffer (buffer-string)) + 'external-debugging-output))) +(t + (eglot--message
[elpa] externals/elpa 73bc752 11/71: Close #441: shield tests from some user customizations
branch: externals/elpa commit 73bc752e2f194a17d076c1bc5efd5dba473b0e40 Author: Tobias Rittweiler Commit: GitHub Close #441: shield tests from some user customizations Users' customization of Python indenting style in the standard XDG_CONFIG_HOME location of ~/.config/pycodestyle could cause spurious test failures. We prevent this and similar problems by overriding that environment variable in tests. If this turns out to hurt other language servers used in the test suite, we'll have to revisit. Co-authored-by: João Távora * eglot-tests.el (eglot--call-with-fixture): Temporarily set XDG_CONFIG_HOME to /dev/null. (python-autopep-formatting): Remove conditional on TRAVIS_TESTING. --- eglot-tests.el | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index faf0e16..ea5a9cd 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -84,7 +84,11 @@ then restored." (set (car spec) (cadr spec))) ((stringp (car spec)) (push spec file-specs (unwind-protect -(let ((eglot-server-initialized-hook +(let ((process-environment + ;; Prevent user-configuration to have an influence on + ;; language servers. (See github#441) + (cons "XDG_CONFIG_HOME=/dev/null" process-environment)) + (eglot-server-initialized-hook (lambda (server) (push server new-servers (setq created-files (mapcan #'eglot--make-file-or-dir file-specs)) (prog1 (funcall fn) @@ -572,14 +576,8 @@ def foobazquuz(d, e, f): pass (ert-deftest python-autopep-formatting () "Test formatting in the pyls python LSP. pyls prefers autopep over yafp, despite its README stating the contrary." - ;; For some reason Travis will fail the part of the test where we - ;; try to reformat just the second line, i.e. it will _not_ add - ;; newlines before the region we asked to reformat. I actually - ;; think Travis' behaviour is more sensible, but I don't know how to - ;; reproduce it locally. Must be some Python version thing. - ;; Beware, this test is brittle if ~/.config/pycodestyle exists, or - ;; default autopep rules change, which has happened. - (skip-unless (null (getenv "TRAVIS_TESTING"))) + ;; Beware, default autopep rules can change over time, which may + ;; affect this test. (skip-unless (and (executable-find "pyls") (executable-find "autopep8"))) (eglot--with-fixture
[elpa] externals/elpa 9bc58df 17/71: Fix #446: unbreak eglot--guess-contact for host-and-port case
branch: externals/elpa commit 9bc58df7add8ad36e95a758d25854732ffe9098a Author: Dan Davison Commit: João Távora Fix #446: unbreak eglot--guess-contact for host-and-port case * eglot.el (eglot--guess-contact): Fix bug in (host port) connection case. --- eglot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index 6db0a09..adfd4e2 100644 --- a/eglot.el +++ b/eglot.el @@ -698,7 +698,8 @@ be guessed." (class (or (and (consp guess) (symbolp (car guess)) (prog1 (car guess) (setq guess (cdr guess 'eglot-lsp-server)) - (program (and (listp guess) (stringp (car guess)) (car guess))) + (program (and (listp guess) + (stringp (car guess)) (stringp (cadr guess)) (car guess))) (base-prompt (and interactive "Enter program to execute (or :): "))
[elpa] externals/elpa ad3f049 24/71: Close #417: minimally document relation with project.el
branch: externals/elpa commit ad3f0499b44ac673fc2847b718bd572dbd5701ae Author: João Távora Commit: João Távora Close #417: minimally document relation with project.el * README.md (lisp): Mention project.el --- README.md | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42e1ffc..d904c32 100644 --- a/README.md +++ b/README.md @@ -305,12 +305,15 @@ indicator pop up in your mode-line. More importantly, this means current *and future* file buffers of that major mode *inside your current project* automatically become \"managed\" by the LSP server, This means that information about these file's contents is exchanged -periodically to provide enhanced code analysis. Among other features: +periodically to provide enhanced coding assistance. Eglot works +primarily with Emacs' built-in libraries and _not_ with third-party +replacements for those facilities. * definitions can be found via `xref-find-definitions`; * on-the-fly diagnostics are given by `flymake-mode`; * function signature hints are given by `eldoc-mode`; * completion can be summoned with `completion-at-point`. +* projects are discovered via `project.el`'s API; Some extra features are provided if certain libraries are installed and enabled, such as:
[elpa] externals/elpa 50f9a69 25/71: Fix #433: survive hover responses with empty markdown strings
branch: externals/elpa commit 50f9a698fc6721cd6df5aafac0636bd6776a6930 Author: João Távora Commit: João Távora Fix #433: survive hover responses with empty markdown strings * eglot.el (eglot-help-at-point): Protect against null eglot--hover-info --- eglot.el | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/eglot.el b/eglot.el index 8fadd5f..d172f4c 100644 --- a/eglot.el +++ b/eglot.el @@ -2255,15 +2255,16 @@ is not active." (eglot--dbind ((Hover) contents range) (jsonrpc-request (eglot--current-server-or-lose) :textDocument/hover (eglot--TextDocumentPositionParams)) -(if (seq-empty-p contents) -(display-local-help) - (let ((blurb (eglot--hover-info contents range)) -(sym (thing-at-point 'symbol))) -(with-current-buffer (eglot--help-buffer) - (with-help-window (current-buffer) -(rename-buffer (format "*eglot-help for %s*" sym)) -(with-current-buffer standard-output (insert blurb)) -(setq-local nobreak-char-display nil))) +(let ((blurb (and (not (seq-empty-p contents)) + (eglot--hover-info contents range + (if blurb + (with-current-buffer (eglot--help-buffer) +(with-help-window (current-buffer) + (rename-buffer (format "*eglot-help for %s*" + (thing-at-point 'symbol))) + (with-current-buffer standard-output (insert blurb)) + (setq-local nobreak-char-display nil))) +(display-local-help) (defun eglot-doc-too-large-for-echo-area (string) "Return non-nil if STRING won't fit in echo area.
[elpa] externals/elpa d244cc5 22/71: Per #443: tweak handling of eldoc-echo-area-use-multiline-p
branch: externals/elpa commit d244cc53593141ade9714fd3d1c2ff480a397a23 Author: Theodor Thornhill Commit: João Távora Per #443: tweak handling of eldoc-echo-area-use-multiline-p Also close #453 Co-authored-by: João Távora * eglot.el (eglot--first-line-of-doc): New helper. (eglot--update-doc): Tweak docstring. Simplify. (eglot-put-doc-in-help-buffer): Tweak docstring --- eglot.el | 41 ++--- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/eglot.el b/eglot.el index 22a8aef..09be1f8 100644 --- a/eglot.el +++ b/eglot.el @@ -2274,10 +2274,11 @@ Respects `max-mini-window-height' (which see)." (defcustom eglot-put-doc-in-help-buffer #'eglot-doc-too-large-for-echo-area "If non-nil, put \"hover\" documentation in separate `*eglot-help*' buffer. -If nil, use whatever `eldoc-message-function' decides (usually -the echo area). If t, use `*eglot-help*' unconditionally. If a -function, it is called with the docstring to display and should a -boolean producing one of the two previous values." +If nil, use whatever `eldoc-message-function' decides, honouring +`eldoc-echo-area-use-multiline-p'. If t, use `*eglot-help*' +unconditionally. If a function, it is called with the docstring +to display and should a boolean producing one of the two previous +values." :type '(choice (const :tag "Never use `*eglot-help*'" nil) (const :tag "Always use `*eglot-help*'" t) (function :tag "Ask a function"))) @@ -2288,15 +2289,22 @@ Buffer is displayed with `display-buffer', which obeys `display-buffer-alist' & friends." :type 'boolean) +(defun eglot--first-line-of-doc (string) + (truncate-string-to-width + (replace-regexp-in-string "\\(.*\\)\n.*" "\\1" string) + (frame-width) nil nil "...")) + (defun eglot--update-doc (string hint) "Put updated documentation STRING where it belongs. -Honours `eglot-put-doc-in-help-buffer'. HINT is used to -potentially rename EGLOT's help buffer. If STRING is nil, the -echo area cleared of any previous documentation." - (cond ((and string - (or (eq t eglot-put-doc-in-help-buffer) - (and eglot-put-doc-in-help-buffer - (funcall eglot-put-doc-in-help-buffer string +HINT is used to potentially rename EGLOT's help buffer. If +STRING is nil, the echo area cleared of any previous +documentation. Honour `eglot-put-doc-in-help-buffer', +`eglot-auto-display-help-buffer' and +`eldoc-echo-area-use-multiline-p'." + (cond ((null string) (eldoc-message nil)) +((or (eq t eglot-put-doc-in-help-buffer) + (and eglot-put-doc-in-help-buffer + (funcall eglot-put-doc-in-help-buffer string))) (with-current-buffer (eglot--help-buffer) (let ((inhibit-read-only t) (name (format "*eglot-help for %s*" hint))) @@ -2310,19 +2318,14 @@ echo area cleared of any previous documentation." (unless (get-buffer-window (current-buffer)) (eglot--message "%s\n(...truncated. Full help is in `%s')" - (truncate-string-to-width - (replace-regexp-in-string "\\(.*\\)\n.*" "\\1" string) - (frame-width) nil nil "...") + (eglot--first-line-of-doc string) (buffer-name eglot--help-buffer (help-mode (eldoc-echo-area-use-multiline-p + ;; Can't really honour non-t non-nil values if this var (eldoc-message string)) (t - (eldoc-message - (and string - (if (string-match "\n" string) - (substring string (match-end 0)) - string)) + (eldoc-message (eglot--first-line-of-doc string) (defun eglot-eldoc-function () "EGLOT's `eldoc-documentation-function' function."
[elpa] externals/elpa ee87519 41/71: Replace uses of project-roots with project-root
branch: externals/elpa commit ee87519afdfc58a96c55ebf2da01deaae77ee3b0 Author: João Távora Commit: João Távora Replace uses of project-roots with project-root * eglot.el (Package-Requires): Require project 0.3.0. (eglot--connect, eglot-handle-request) (eglot-initialization-options, eglot--eclipse-jdt-contact): Use project-root. --- eglot.el | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/eglot.el b/eglot.el index fe8..dc0200d 100644 --- a/eglot.el +++ b/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8") (package "0.1.1") (xref "1.0.1") (eldoc "1.0.0")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8") (project "0.3.0") (xref "1.0.1") (eldoc "1.0.0")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -851,7 +851,7 @@ Each function is passed the server as an argument") (defun eglot--connect (managed-major-mode project class contact) "Connect to MANAGED-MAJOR-MODE, PROJECT, CLASS and CONTACT. This docstring appeases checkdoc, that's all." - (let* ((default-directory (car (project-roots project))) + (let* ((default-directory (project-root project)) (nickname (file-name-base (directory-file-name default-directory))) (readable-name (format "EGLOT (%s/%s)" nickname managed-major-mode)) autostart-inferior-process @@ -947,7 +947,7 @@ This docstring appeases checkdoc, that's all." (lambda () (setf (eglot--inhibit-autoreconnect server) (null eglot-autoreconnect))) - (let ((default-directory (car (project-roots project))) + (let ((default-directory (project-root project)) (major-mode managed-major-mode)) (hack-dir-local-variables-non-file-buffer) (run-hook-with-args 'eglot-connect-hook server)) @@ -1781,7 +1781,7 @@ When called interactively, use the currently active server" (if (and (not (string-empty-p uri-path)) (file-directory-p uri-path)) uri-path - (car (project-roots (eglot--project server)) + (project-root (eglot--project server) (setq-local major-mode (eglot--major-mode server)) (hack-dir-local-variables-non-file-buffer) (alist-get section eglot-workspace-configuration @@ -2705,16 +2705,14 @@ documentation. Honour `eglot-put-doc-in-help-buffer', `(:workspaceFolders [,@(cl-delete-duplicates (mapcar #'eglot--path-to-uri -(let* ((roots (project-roots (eglot--project server))) - (root (car roots))) - (append - roots - (mapcar -#'file-name-directory -(append - (file-expand-wildcards (concat root "*/pom.xml")) - (file-expand-wildcards (concat root "*/build.gradle")) - (file-expand-wildcards (concat root "*/.project"))) +(let* ((root (project-root (eglot--project server + (cons root +(mapcar + #'file-name-directory + (append + (file-expand-wildcards (concat root "*/pom.xml")) + (file-expand-wildcards (concat root "*/build.gradle")) + (file-expand-wildcards (concat root "*/.project"))) :test #'string=)] ,@(if-let ((home (or (getenv "JAVA_HOME") (ignore-errors @@ -2762,7 +2760,7 @@ If INTERACTIVE, prompt user for details." (t "config_linux" (project (or (project-current) `(transient . ,default-directory))) (workspace -(expand-file-name (md5 (car (project-roots project))) +(expand-file-name (md5 (project-root project)) (concat user-emacs-directory "eglot-eclipse-jdt-cache" (unless jar
[elpa] externals/elpa 3634402 36/71: Fix #479: correctly place diagnostics in narrowed buffers
branch: externals/elpa commit 363440249b091f229672727841d63250f970ea2e Author: João Távora Commit: João Távora Fix #479: correctly place diagnostics in narrowed buffers * eglot.el (eglot--lsp-position-to-point) (eglot-handle-notification): save-restriction and widen --- eglot.el | 44 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/eglot.el b/eglot.el index f3501cb..21a2496 100644 --- a/eglot.el +++ b/eglot.el @@ -1118,19 +1118,21 @@ be set to `eglot-move-to-lsp-abiding-column' (the default), and "Convert LSP position POS-PLIST to Emacs point. If optional MARKER, return a marker instead" (save-excursion -(goto-char (point-min)) -(forward-line (min most-positive-fixnum - (plist-get pos-plist :line))) -(unless (eobp) ;; if line was excessive leave point at eob - (let ((tab-width 1) -(col (plist-get pos-plist :character))) -(unless (wholenump col) - (eglot--warn - "Caution: LSP server sent invalid character position %s. Using 0 instead." - col) - (setq col 0)) -(funcall eglot-move-to-column-function col))) -(if marker (copy-marker (point-marker)) (point +(save-restriction + (widen) + (goto-char (point-min)) + (forward-line (min most-positive-fixnum + (plist-get pos-plist :line))) + (unless (eobp) ;; if line was excessive leave point at eob +(let ((tab-width 1) + (col (plist-get pos-plist :character))) + (unless (wholenump col) +(eglot--warn + "Caution: LSP server sent invalid character position %s. Using 0 instead." + col) +(setq col 0)) + (funcall eglot-move-to-column-function col))) + (if marker (copy-marker (point-marker)) (point) (defun eglot--path-to-uri (path) "URIfy PATH." @@ -1585,13 +1587,15 @@ COMMAND is a symbol naming the command." message `((eglot-lsp-diag . ,diag-spec) into diags finally (cond ((and flymake-mode eglot--current-flymake-report-fn) -(funcall eglot--current-flymake-report-fn diags - ;; If the buffer hasn't changed since last - ;; call to the report function, flymake won't - ;; delete old diagnostics. Using :region - ;; keyword forces flymake to delete - ;; them (github#159). - :region (cons (point-min) (point-max))) +(save-restriction + (widen) + (funcall eglot--current-flymake-report-fn diags + ;; If the buffer hasn't changed since last + ;; call to the report function, flymake won't + ;; delete old diagnostics. Using :region + ;; keyword forces flymake to delete + ;; them (github#159). + :region (cons (point-min) (point-max (setq eglot--unreported-diagnostics nil)) (t (setq eglot--unreported-diagnostics (cons t diags))
[elpa] externals/elpa e7a43e2 40/71: Fix #480: also consider label of a CompletionItem for snippets
branch: externals/elpa commit e7a43e28eddef3e923942699bb30b7bc7e1480fc Author: Gary Oberbrunner Commit: João Távora Fix #480: also consider label of a CompletionItem for snippets Copyright-paperwork-exempt: yes * eglot.el (eglot-completion-at-point): Consider label when expanding snippets. --- eglot.el | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/eglot.el b/eglot.el index cc60290..fe8 100644 --- a/eglot.el +++ b/eglot.el @@ -2152,9 +2152,7 @@ is not active." :exit-function (lambda (proxy _status) (eglot--dbind ((CompletionItem) insertTextFormat -insertText -textEdit -additionalTextEdits) +insertText textEdit additionalTextEdits label) (funcall resolve-maybe (or (get-text-property 0 'eglot--lsp-item proxy) @@ -2189,7 +2187,7 @@ is not active." ;; whole completion, since `insertText' is the full ;; completion's text. (delete-region (- (point) (length proxy)) (point)) -(funcall snippet-fn insertText +(funcall snippet-fn (or insertText label) (eglot--signal-textDocument/didChange) (eglot-eldoc-function)))
[elpa] externals/elpa a04b826 48/71: Update tests after update to newer Eldoc
branch: externals/elpa commit a04b8266ec12a6f65db09884c02ea7a8d1b52f52 Author: João Távora Commit: João Távora Update tests after update to newer Eldoc It's likely that these will fail until the very latest Emacs master is available in travis. * eglot-tests.el (eglot--eldoc-on-demand) (eglot--tests-force-full-eldoc): New helpers. (rls-hover-after-edit): Use new helpers. (hover-multiline-doc-locus): Remove. (hover-after-completions): Remove (eglot-single-line-eldoc, eglot-multiline-eldoc) (egnnlot-eldoc-after-completions): New tests. --- eglot-tests.el | 86 -- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 2f8e25f..37f3c06 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -420,6 +420,27 @@ Pass TIMEOUT to `eglot--with-timeout'." (flymake-goto-next-error 1 '() t) (should (eq 'flymake-error (face-at-point))) +(defun eglot--eldoc-on-demand () + ;; Trick Eldoc 1.1.0 into accepting on-demand calls. + (let ((this-command nil) (last-command 'forward-char)) +(should (eldoc-display-message-p)) +(eldoc))) + +(defun eglot--tests-force-full-eldoc () + (let ((origin (current-buffer))) +(with-current-buffer (eldoc-doc-buffer) + (let ((inhibit-read-only t)) +(erase-buffer) +(with-current-buffer origin + (eglot--eldoc-on-demand)) +(cl-loop + repeat 10 + while (zerop (length (buffer-string))) + do (sit-for 0.1)) +(should (cl-plusp (length (buffer-string +(message "returning %s" (buffer-string)) +(buffer-string) + (ert-deftest rls-hover-after-edit () "Hover and highlightChanges are tricky in RLS." (skip-unless (executable-find "rls")) @@ -444,7 +465,7 @@ Pass TIMEOUT to `eglot--with-timeout'." ;; simulate these two which don't happen when buffer isn't ;; visible in a window. (eglot--signal-textDocument/didChange) - (eglot-eldoc-function)) + (eglot--eldoc-on-demand)) (let (pending-id) (eglot--wait-for (c-reqs 2) (&key id method &allow-other-keys) @@ -542,49 +563,48 @@ def foobazquuz(d, e, f): pass ;; pyls will change the representation of this candidate (should (member "foobazquuz(d, e, f)" company-candidates) -(ert-deftest hover-after-completions () +(ert-deftest eglot-eldoc-after-completions () "Test documentation echo in a python LSP" (skip-unless (executable-find "pyls")) - ;; JT@19/06/21: We check with `eldoc-last-message' because it's - ;; practical, which forces us to use - ;; `eglot-put-doc-in-help-buffer' to nil. - (let ((eglot-put-doc-in-help-buffer nil)) -(eglot--with-fixture -`(("project" . (("something.py" . "import sys\nsys.exi" - (with-current-buffer - (eglot--find-file-noselect "project/something.py") -(should (eglot--tests-connect)) -(goto-char (point-max)) -(setq eldoc-last-message nil) -(completion-at-point) -(should (looking-back "sys.exit")) -(while (not eldoc-last-message) (accept-process-output nil 0.1)) -(should (string-match "^exit" eldoc-last-message)) + (eglot--with-fixture + `(("project" . (("something.py" . "import sys\nsys.exi" +(with-current-buffer +(eglot--find-file-noselect "project/something.py") + (should (eglot--tests-connect)) + (goto-char (point-max)) + (completion-at-point) + (should (looking-back "sys.exit")) + (should (string-match "^exit" (eglot--tests-force-full-eldoc)) + +(ert-deftest eglot-multiline-eldoc () + "Test if suitable amount of lines of hover info are shown." + (skip-unless (executable-find "pyls")) + (eglot--with-fixture + `(("project" . (("hover-first.py" . "from datetime import datetime" +(with-current-buffer +(eglot--find-file-noselect "project/hover-first.py") + (should (eglot--tests-connect)) + (goto-char (point-max)) + ;; one-line + (let* ((eldoc-echo-area-use-multiline-p t) + (captured-message (eglot--tests-force-full-eldoc))) +(should (string-match "datetim" captured-message)) +(should (cl-find ?\n eldoc-last-message)) -(ert-deftest hover-multiline-doc-locus () +(ert-deftest eglot-single-line-eldoc () "Test if suitable amount of lines of hover info are shown." (skip-unless (executable-find "pyls")) (eglot--with-fixture - `(("project" . (("hover-first.py" . "from datetime import datetime"))) -(eglot-put-doc-in-help-buffer nil)) + `(("project" . (("hover-first.py" . "from datetime import datetime" (with-current-buffer (eglot--find-file-noselect "project/hover-first.py") (should (eglot--tests-connect)) (goto-char (point-max)) ;; one-line - (setq eldoc-last-messa
[elpa] externals/elpa 265b486 70/71: Fix #569: allow Eglot to stay out of Xref configuration
branch: externals/elpa commit 265b4865f508191d3fc5006d95c7994d7833bd52 Author: João Távora Commit: João Távora Fix #569: allow Eglot to stay out of Xref configuration * eglot.el (eglot-stay-out-of): Rework docstring. (eglot--managed-mode): Can now stay out of xref. --- eglot.el | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/eglot.el b/eglot.el index 404ed19..c240c42 100644 --- a/eglot.el +++ b/eglot.el @@ -1288,6 +1288,10 @@ and just return it. PROMPT shouldn't end with a question mark." (defvar eglot-stay-out-of '() "List of Emacs things that Eglot should try to stay of. +Each element is a string, a symbol, or a regexp which is matched +against a variable's name. Examples include the string +\"company\" or the symbol `xref'. + Before Eglot starts \"managing\" a particular buffer, it opinionatedly sets some peripheral Emacs facilites, such as Flymake, Xref and Company. These overriding settings help ensure @@ -1296,9 +1300,8 @@ consistent Eglot behaviour and only stay in place until previous settings are restored. However, if you wish for Eglot to stay out of a particular Emacs -facility that you'd like to keep control of, add a string, a -symbol, or a regexp here that will be matched against the -variable's name, and Eglot will refrain from setting it. +facility that you'd like to keep control of add an element to +this list and Eglot will refrain from setting it. For example, to keep your Company customization use @@ -1338,13 +1341,14 @@ Use `eglot-managed-p' to determine if current buffer is managed.") (add-hook 'after-change-functions 'eglot--after-change nil t) (add-hook 'before-change-functions 'eglot--before-change nil t) (add-hook 'kill-buffer-hook #'eglot--managed-mode-off nil t) -;; Prepend "didClose" to the hook after the "onoff", so it will run first +;; Prepend "didClose" to the hook after the "nonoff", so it will run first (add-hook 'kill-buffer-hook 'eglot--signal-textDocument/didClose nil t) (add-hook 'before-revert-hook 'eglot--signal-textDocument/didClose nil t) (add-hook 'after-revert-hook 'eglot--after-revert-hook nil t) (add-hook 'before-save-hook 'eglot--signal-textDocument/willSave nil t) (add-hook 'after-save-hook 'eglot--signal-textDocument/didSave nil t) -(add-hook 'xref-backend-functions 'eglot-xref-backend nil t) +(unless (eglot--stay-out-of-p 'xref) + (add-hook 'xref-backend-functions 'eglot-xref-backend nil t)) (add-hook 'completion-at-point-functions #'eglot-completion-at-point nil t) (add-hook 'change-major-mode-hook #'eglot--managed-mode-off nil t) (add-hook 'post-self-insert-hook 'eglot--post-self-insert-hook nil t)
[elpa] externals/elpa 4edd478 71/71: Bump Eglot version to 1.7
branch: externals/elpa commit 4edd4782f1c16c0516533b52e16b02b772812d16 Author: João Távora Commit: João Távora Bump Eglot version to 1.7 * eglot.el (Version): Bump to 1.7. (Package-Requires): Bump dependency versions. --- eglot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index c240c42..35c959b 100644 --- a/eglot.el +++ b/eglot.el @@ -2,12 +2,12 @@ ;; Copyright (C) 2018-2020 Free Software Foundation, Inc. -;; Version: 1.6 +;; Version: 1.7 ;; Author: João Távora ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.9") (project "0.3.0") (xref "1.0.1") (eldoc "1.5.0")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.14") (flymake "1.0.9") (project "0.3.0") (xref "1.0.1") (eldoc "1.11.0")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by
[elpa] externals/elpa e1e7362 07/71: Fix #445: don't reupdate help buffer if already rendered
branch: externals/elpa commit e1e7362e7af4e074584c703355e6126404a99066 Author: João Távora Commit: João Távora Fix #445: don't reupdate help buffer if already rendered * eglot.el (eglot--update-doc): Don't reupdate if doc buffer already exists. --- eglot.el | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/eglot.el b/eglot.el index 6d6f91f..ce4f19c 100644 --- a/eglot.el +++ b/eglot.el @@ -2252,11 +2252,13 @@ potentially rename EGLOT's help buffer." (and eglot-put-doc-in-help-buffer (funcall eglot-put-doc-in-help-buffer string))) (with-current-buffer (eglot--help-buffer) -(rename-buffer (format "*eglot-help for %s*" hint)) -(let ((inhibit-read-only t)) - (erase-buffer) - (insert string) - (goto-char (point-min)) +(let ((inhibit-read-only t) + (name (format "*eglot-help for %s*" hint))) + (unless (string= name (buffer-name)) +(rename-buffer (format "*eglot-help for %s*" hint)) +(erase-buffer) +(insert string) +(goto-char (point-min))) (if eglot-auto-display-help-buffer (display-buffer (current-buffer)) (unless (get-buffer-window (current-buffer))
[elpa] externals/elpa dd48f4a 08/71: * eglot.el (eglot-put-doc-in-help-buffer): Tiny docstring fix.
branch: externals/elpa commit dd48f4acfbf7dc6eb7e0f4848d5b4182919d3ea2 Author: João Távora Commit: João Távora * eglot.el (eglot-put-doc-in-help-buffer): Tiny docstring fix. --- eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index ce4f19c..3ea8391 100644 --- a/eglot.el +++ b/eglot.el @@ -2231,7 +2231,7 @@ Respects `max-mini-window-height' (which see)." #'eglot-doc-too-large-for-echo-area "If non-nil, put \"hover\" documentation in separate `*eglot-help*' buffer. If nil, use whatever `eldoc-message-function' decides (usually -the echo area). If t, use `*eglot-help; unconditionally. If a +the echo area). If t, use `*eglot-help*' unconditionally. If a function, it is called with the docstring to display and should a boolean producing one of the two previous values." :type '(choice (const :tag "Never use `*eglot-help*'" nil)
[elpa] externals/elpa f7a7e33 15/71: Tweak docstring of eglot-server-programs
branch: externals/elpa commit f7a7e33c1e846cb09d93ff63cf2dafa398410d8f Author: Dan Davison Commit: João Távora Tweak docstring of eglot-server-programs Co-authored-by: João Távora * eglot.el (eglot-server-programs): Fix typos and phrasing. --- eglot.el | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/eglot.el b/eglot.el index afb7063c..6db0a09 100644 --- a/eglot.el +++ b/eglot.el @@ -120,27 +120,28 @@ of those modes. CONTACT can be: PROGRAM is called with ARGS and is expected to serve LSP requests over the standard input/output channels. -* A list (HOST PORT [TCP-ARGS...]) where HOST is a string and PORT is - na positive integer number for connecting to a server via TCP. +* A list (HOST PORT [TCP-ARGS...]) where HOST is a string and + PORT is a positive integer for connecting to a server via TCP. Remaining ARGS are passed to `open-network-stream' for upgrading the connection with encryption or other capabilities. -* A list (PROGRAM [ARGS...] :autoport [MOREARGS...]), whereby a - combination of the two previous options is used.. First, an +* A list (PROGRAM [ARGS...] :autoport [MOREARGS...]), whereupon a + combination of the two previous options is used. First, an attempt is made to find an available server port, then PROGRAM is launched with ARGS; the `:autoport' keyword substituted for - that number; and MOREARGS. Eglot then attempts to to establish - a TCP connection to that port number on the localhost. + that number; and MOREARGS. Eglot then attempts to establish a + TCP connection to that port number on the localhost. * A cons (CLASS-NAME . INITARGS) where CLASS-NAME is a symbol designating a subclass of `eglot-lsp-server', for representing experimental LSP servers. INITARGS is a keyword-value plist - used to initialize CLASS-NAME, or a plain list interpreted as - the previous descriptions of CONTACT, in which case it is - converted to produce a plist with a suitable :PROCESS initarg - to CLASS-NAME. The class `eglot-lsp-server' descends - `jsonrpc-process-connection', which you should see for the - semantics of the mandatory :PROCESS argument. + used to initialize the object of CLASS-NAME, or a plain list + interpreted as the previous descriptions of CONTACT. In the + latter case that plain list is used to produce a plist with a + suitable :PROCESS initarg to CLASS-NAME. The class + `eglot-lsp-server' descends from `jsonrpc-process-connection', + which you should see for the semantics of the mandatory + :PROCESS argument. * A function of a single argument producing any of the above values for CONTACT. The argument's value is non-nil if the
[elpa] externals/elpa a2fa9ab 21/71: Per #408: fontify markdown source code blocks by default
branch: externals/elpa commit a2fa9ab17bd6db709bf7feb071912144eede3949 Author: João Távora Commit: João Távora Per #408: fontify markdown source code blocks by default * eglot.el (eglot--format-markup): Set markdown-fontify-code-blocks-natively to t locally. --- eglot.el | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index 596a82d..22a8aef 100644 --- a/eglot.el +++ b/eglot.el @@ -72,7 +72,9 @@ (require 'filenotify) (require 'ert) (require 'array) -(defvar company-backends) ; forward-declare, but don't require company +;; forward-declare, but don't require (Emacs 28 doesn't seem to care) +(defvar markdown-fontify-code-blocks-natively) +(defvar company-backends) (defvar company-tooltip-align-annotations) @@ -1149,6 +1151,7 @@ Doubles as an indicator of snippet support." ("plaintext" 'text-mode) (_ major-mode)) (with-temp-buffer + (setq-local markdown-fontify-code-blocks-natively t) (insert (string-trim string)) (ignore-errors (delay-mode-hooks (funcall mode))) (font-lock-ensure)
[elpa] externals/elpa b6519a5 16/71: Per #446: Add tests for eglot-server-programs
branch: externals/elpa commit b6519a5c1ba965bbb3b2853318b28da5e5faa811 Author: Dan Davison Commit: João Távora Per #446: Add tests for eglot-server-programs The tests use eglot--guess-contact, since that is the only gateway to that variable's complex semantics. Co-authored-by: João Távora * eglot-tests.el (eglot--guessing-contact): New helper. (eglot-server-programs-simple-executable): New test. (eglot-server-programs-executable-multiple-major-modes): New test. (eglot-server-programs-executable-with-arg): New test. (eglot-server-programs-executable-with-args-and-autoport): New test. (eglot-server-programs-host-and-port): New test. (eglot-server-programs-host-and-port-and-tcp-args): New test. (eglot-server-programs-class-name-and-plist): New test. (eglot-server-programs-class-name-and-contact-spec): New test. (eglot-server-programs-function): New test. --- eglot-tests.el | 80 ++ 1 file changed, 80 insertions(+) diff --git a/eglot-tests.el b/eglot-tests.el index f2a9b7f..48c3bfd 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -880,6 +880,86 @@ pyls prefers autopep over yafp, despite its README stating the contrary." (((CodeAction) title command) (list title command))) +(cl-defmacro eglot--guessing-contact ((guessed-class-sym guessed-contact-sym) + &body body) + "Bind the result of `eglot--guess-contact' then evaluate BODY." + (declare (indent 1) (debug t)) + `(let ((buffer-file-name "_")) + (cl-destructuring-bind + (_ _ ,guessed-class-sym ,guessed-contact-sym) + (eglot--guess-contact) + ,@body))) + +(ert-deftest eglot-server-programs-simple-executable () + (let ((eglot-server-programs '((foo-mode "some-executable"))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("some-executable")) + +(ert-deftest eglot-server-programs-executable-multiple-major-modes () + (let ((eglot-server-programs '(((bar-mode foo-mode) "some-executable"))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("some-executable")) + +(ert-deftest eglot-server-programs-executable-with-arg () + (let ((eglot-server-programs '((foo-mode "some-executable" "arg1"))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("some-executable" "arg1")) + +(ert-deftest eglot-server-programs-executable-with-args-and-autoport () + (let ((eglot-server-programs '((foo-mode "some-executable" "arg1" + :autoport "arg2"))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("some-executable" "arg1" + :autoport "arg2")) + +(ert-deftest eglot-server-programs-host-and-port () + (let ((eglot-server-programs '((foo-mode "somehost.example.com" ))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("somehost.example.com" )) + +(ert-deftest eglot-server-programs-host-and-port-and-tcp-args () + (let ((eglot-server-programs '((foo-mode "somehost.example.com" + :type network))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("somehost.example.com" + :type network)) + +(ert-deftest eglot-server-programs-class-name-and-plist () + (let ((eglot-server-programs '((foo-mode bar-class :init-key init-val))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'bar-class)) + (should (equal guessed-contact '(:init-key init-val)) + +(ert-deftest eglot-server-programs-class-name-and-contact-spec () + (let ((eglot-server-programs '((foo-mode bar-class "some-executable" "arg1" + :autoport "arg2"))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (guessed-class guessed-contact) + (should (equal guessed-class 'bar-class)) + (should (equal guessed-contact '("some-executable" "arg1" + :autoport "arg2")) + +(ert-deftest eglot-server-progr
[elpa] externals/elpa e690e8c 32/71: Per #474, #478: add more tests for `eglot--guess-contact'
branch: externals/elpa commit e690e8cc27e148c5c743c21d96c201e864686ab8 Author: Dan Davison Commit: João Távora Per #474, #478: add more tests for `eglot--guess-contact' Modify eglot--guessing-contact so that (1) each test is run once with eglot--guessing-contact INTERACTIVE argument set to t, and again with it set to nil; (2) executable-find is mocked, and (3) arguments passed to read-shell-command are captured and made available to tests. Co-authored-by: João Távora * eglot-tests.el (eglot--guessing-contact): Rework. (eglot-server-programs-simple-existing-executable): New test. (eglot-server-programs-simple-executable) (eglot-server-programs-executable-multiple-major-modes) (eglot-server-programs-executable-with-arg) (eglot-server-programs-executable-with-args-and-autoport) (eglot-server-programs-host-and-port) (eglot-server-programs-host-and-port-and-tcp-args) (eglot-server-programs-class-name-and-plist) (eglot-server-programs-class-name-and-contact-spec) (eglot-server-programs-function): Add new test assertions. --- eglot-tests.el | 69 -- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 909770c..919fc97 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -880,34 +880,65 @@ pyls prefers autopep over yafp, despite its README stating the contrary." (((CodeAction) title command) (list title command))) -(cl-defmacro eglot--guessing-contact ((guessed-class-sym guessed-contact-sym) +(cl-defmacro eglot--guessing-contact ((interactive-sym prompt-args-sym + guessed-class-sym guessed-contact-sym) &body body) - "Bind the result of `eglot--guess-contact' then evaluate BODY." + "Evaluate BODY twice, binding results of `eglot--guess-contact'. + +INTERACTIVE-SYM is bound to the boolean passed to +`eglot--guess-contact' each time. If the user would have been +prompted, PROMPT-ARGS-SYM is bound to the list of arguments that +would have been passed to `read-shell-command', else nil. +GUESSED-CLASS-SYM and GUESSED-CONTACT-SYM are bound to the useful +return values of `eglot--guess-contact'. Unless the server +program evaluates to \"a-missing-executable.exe\", this macro +will assume it exists." (declare (indent 1) (debug t)) - `(let ((buffer-file-name "_")) - (cl-destructuring-bind - (_ _ ,guessed-class-sym ,guessed-contact-sym) - (eglot--guess-contact) - ,@body))) + (let ((i-sym (cl-gensym))) +`(dolist (,i-sym '(nil t)) + (let ((,interactive-sym ,i-sym) + (buffer-file-name "_") + (,prompt-args-sym nil)) + (cl-letf (((symbol-function 'executable-find) +(lambda (name) (unless (string-equal +name "a-missing-executable.exe") + (format "/totally-mock-bin/%s" name + ((symbol-function 'read-shell-command) +(lambda (&rest args) (setq ,prompt-args-sym args) ""))) + (cl-destructuring-bind + (_ _ ,guessed-class-sym ,guessed-contact-sym) + (eglot--guess-contact ,i-sym) + ,@body)) (ert-deftest eglot-server-programs-simple-executable () (let ((eglot-server-programs '((foo-mode "some-executable"))) (major-mode 'foo-mode)) -(eglot--guessing-contact (guessed-class guessed-contact) +(eglot--guessing-contact (_ prompt-args guessed-class guessed-contact) + (should (not prompt-args)) (should (equal guessed-class 'eglot-lsp-server)) (should (equal guessed-contact '("some-executable")) +(ert-deftest eglot-server-programs-simple-missing-executable () + (let ((eglot-server-programs '((foo-mode "a-missing-executable.exe"))) +(major-mode 'foo-mode)) +(eglot--guessing-contact (interactive-p prompt-args guessed-class guessed-contact) + (should (equal (not prompt-args) (not interactive-p))) + (should (equal guessed-class 'eglot-lsp-server)) + (should (equal guessed-contact '("a-missing-executable.exe")) + (ert-deftest eglot-server-programs-executable-multiple-major-modes () (let ((eglot-server-programs '(((bar-mode foo-mode) "some-executable"))) (major-mode 'foo-mode)) -(eglot--guessing-contact (guessed-class guessed-contact) +(eglot--guessing-contact (_ prompt-args guessed-class guessed-contact) + (should (not prompt-args)) (should (equal guessed-class 'eglot-lsp-server)) (should (equal guessed-contact '("some-executable")) (ert-deftest eglot-server-programs-executable-with-arg () (let ((eglot-server-programs '((foo-mode "some-executable" "arg1"))) (major-mode 'foo-mode)) -(eglot--guessing-contact (guessed-class guessed-contact) +(eglot--gu
[elpa] externals/elpa bb51d47 30/71: Close #409: make a test more robust
branch: externals/elpa commit bb51d47dd6e59e5bef1bfb393a39a73a7811d0ee Author: Felicián Németh Commit: Felicián Németh Close #409: make a test more robust See https://github.com/joaotavora/eglot/issues/279#issuecomment-542306382 * eglot-tests.el (snippet-completions): Check location of point as well. --- eglot-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 14e79a9..909770c 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -524,8 +524,8 @@ def foobazquuz(d, e, f): pass (goto-char (point-max)) (insert "foobar") (completion-at-point) - (beginning-of-line) - (should (looking-at "foobarquux(a, b)") + (should (looking-back "foobarquux(")) + (should (looking-at "a, b)") (defvar company-candidates)
[elpa] externals/elpa da7ff48 31/71: Fix #468: don't call flymake report function if flymake is disabled
branch: externals/elpa commit da7ff4883d3108468265fdc16a217d8e6aff92f2 Author: Dan Davison Commit: GitHub Fix #468: don't call flymake report function if flymake is disabled Also fix #472. Copyright-paperwork-exempt: yes * eglot.el (eglot-handle-notification): Check that flymake-mode is active before calling flymake report function. --- eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index 8dae0b7..112959b 100644 --- a/eglot.el +++ b/eglot.el @@ -1580,7 +1580,7 @@ COMMAND is a symbol naming the command." (t 'eglot-note)) message `((eglot-lsp-diag . ,diag-spec) into diags - finally (cond (eglot--current-flymake-report-fn + finally (cond ((and flymake-mode eglot--current-flymake-report-fn) (funcall eglot--current-flymake-report-fn diags ;; If the buffer hasn't changed since last ;; call to the report function, flymake won't
[elpa] externals/elpa e514f9e 29/71: Close #461: make CI fail if byte compiler warns
branch: externals/elpa commit e514f9e1ed290a5f4457509859d61ee535294413 Author: Tobias Rittweiler Commit: GitHub Close #461: make CI fail if byte compiler warns The environment variable ERROR_ON_WARN controls this. Co-authored-by: João Távora * Makefile: Set `byte-compile-error-on-warn' to $(ERROR_ON_WARN) so one can decide about the desired strictness at the command line. * .travis.yml: Compile eglot.el with `ERROR_ON_WARN' true. Do not do the same for eglot-tests.el because some tests (`eglot-dcase' and `eglot-strict-interfaces') produce byte compile warning purposedly. * eglot-tests.el: Replace `seq-contains` with `cl-find` because `seq-contains' was obsoleted by `seq-contains-p' in Emacs 27.1 and produces a warning. --- .travis.yml| 3 +++ Makefile | 10 -- eglot-tests.el | 6 +++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47db13a..1c04ef5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,9 @@ install: - tar -C eclipse.jdt.ls -xzf eclipse.tar.gz - export CLASSPATH=$(pwd)/$(find eclipse.jdt.ls/ -regex eclipse.jdt.ls/plugins/org.eclipse.equinox.launcher_.*.jar):${CLASSPATH} +before_script: + - make eglot.elc ERROR_ON_WARN=t + script: - make check diff --git a/Makefile b/Makefile index 02259ed..63db244 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ # EMACS=emacs SELECTOR=t +ERROR_ON_WARN=nil LOAD_PATH=-L . @@ -19,12 +20,17 @@ ELPADEPS ?=--eval '(package-initialize)' \ (cadr (assoc (quote flymake) \ package-archive-contents)))' +BYTECOMP_ERROR_ON_WARN := \ + --eval '(setq byte-compile-error-on-warn $(ERROR_ON_WARN))' + all: compile -# Compilation +# Compilation. Note BYTECOMP_ERROR_ON_WARN after ELPADEPS +# so deps can still warn on compilation. # %.elc: %.el - $(EMACS) -Q $(ELPADEPS) $(LOAD_PATH) --batch -f batch-byte-compile $< + $(EMACS) -Q $(ELPADEPS) $(BYTECOMP_ERROR_ON_WARN) $(LOAD_PATH) \ + --batch -f batch-byte-compile $< compile: $(ELCFILES) diff --git a/eglot-tests.el b/eglot-tests.el index 48c3bfd..14e79a9 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -301,9 +301,9 @@ Pass TIMEOUT to `eglot--with-timeout'." :workspaceFolders)) (default-directory root)) (and - (seq-contains folders (eglot--path-to-uri "project/")) - (seq-contains folders (eglot--path-to-uri "project/sub1/")) - (seq-contains folders (eglot--path-to-uri "project/sub2/")) + (cl-find (eglot--path-to-uri "project/") folders :test #'equal) + (cl-find (eglot--path-to-uri "project/sub1/") folders :test #'equal) + (cl-find (eglot--path-to-uri "project/sub2/") folders :test #'equal) (= 3 (length folders))) (ert-deftest auto-detect-running-server ()
[elpa] externals/elpa 3b01561 39/71: Close #459: rework computation of string given to Eldoc (again)
branch: externals/elpa commit 3b01561cef8fef78a2ca28af342bf473ef30b2e0 Author: muffinmad Commit: João Távora Close #459: rework computation of string given to Eldoc (again) Co-authored-by: Andreii Kolomoiets Also do some refactoring to join similar logic in eglot-doc-too-large-for-echo-area and eglot--truncate-string. * eglot.el (eglot-doc-too-large-for-echo-area): Now returns the number of lines available. (eglot--truncate-string): New helper. (eglot--first-line-of-doc, eglot--top-lines-of-doc): Remove. (eglot--update-doc): Use new helpers. * eglot-tests.el (hover-multiline-doc-locus): New test --- eglot-tests.el | 26 ++ eglot.el | 68 +++--- 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 919fc97..f701a01 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -573,6 +573,32 @@ def foobazquuz(d, e, f): pass (while (not eldoc-last-message) (accept-process-output nil 0.1)) (should (string-match "^exit" eldoc-last-message)) +(ert-deftest hover-multiline-doc-locus () + "Test if suitable amount of lines of hover info are shown." + (skip-unless (executable-find "pyls")) + (eglot--with-fixture + `(("project" . (("hover-first.py" . "from datetime import datetime"))) +(eglot-put-doc-in-help-buffer nil) +,@eglot--tests--python-mode-bindings) +(with-current-buffer +(eglot--find-file-noselect "project/hover-first.py") + (should (eglot--tests-connect)) + (goto-char (point-max)) + ;; one-line + (setq eldoc-last-message nil) + (setq-local eldoc-echo-area-use-multiline-p nil) + (eglot-eldoc-function) + (while (not eldoc-last-message) (accept-process-output nil 0.1)) + (should (string-match "datetime" eldoc-last-message)) + (should (not (cl-find ?\n eldoc-last-message))) + ;; multi-line + (setq eldoc-last-message nil) + (setq-local eldoc-echo-area-use-multiline-p t) + (eglot-eldoc-function) + (while (not eldoc-last-message) (accept-process-output nil 0.1)) + (should (string-match "datetime" eldoc-last-message)) + (should (cl-find ?\n eldoc-last-message) + (ert-deftest python-autopep-formatting () "Test formatting in the pyls python LSP. pyls prefers autopep over yafp, despite its README stating the contrary." diff --git a/eglot.el b/eglot.el index 15fa2a1..cc60290 100644 --- a/eglot.el +++ b/eglot.el @@ -2282,24 +2282,47 @@ is not active." (setq-local nobreak-char-display nil))) (display-local-help) -(defun eglot-doc-too-large-for-echo-area (string) - "Return non-nil if STRING won't fit in echo area. -Respects `max-mini-window-height' (which see)." - (let ((max-height - (cond ((floatp max-mini-window-height) (* (frame-height) - max-mini-window-height)) - ((integerp max-mini-window-height) max-mini-window-height) - (t 1 -(> (cl-count ?\n string) max-height))) +(cl-defun eglot-doc-too-large-for-echo-area +(string &optional (height max-mini-window-height)) + "Return non-nil if STRING won't fit in echo area of height HEIGHT. +HEIGHT defaults to `max-mini-window-height' (which see) and is +interpreted like that variable. If non-nil, the return value is +the number of lines available." + (let ((available-lines (cl-typecase height + (float (truncate (* (frame-height) height))) + (integer height) + (t 1 +(when (> (1+ (cl-count ?\n string)) available-lines) + available-lines))) + +(cl-defun eglot--truncate-string (string height &optional (width (frame-width))) + "Return as much from STRING as fits in HEIGHT and WIDTH. +WIDTH, if non-nil, truncates last line to those columns." + (cl-flet ((maybe-trunc + (str) (if width (truncate-string-to-width str width + nil nil "...") + str))) +(cl-loop + repeat height + for i from 1 + for break-pos = (cl-position ?\n string) + for (line . rest) = (and break-pos + (cons (substring string 0 break-pos) +(substring string (1+ break-pos + concat (cond (line (if (= i height) (maybe-trunc line) (concat line "\n"))) + (t (maybe-trunc string))) + while rest do (setq string rest (defcustom eglot-put-doc-in-help-buffer + ;; JT@2020-05-21: TODO: this variable should be renamed and the + ;; decision somehow be in eldoc.el itself. #'eglot-doc-too-large-for-echo-area "If non-nil, put \"hover\" documentation in separate `*eglot-help*' buffer. If nil, use whatever `eldoc-message-function' decides, honouring `eldoc-echo-area-use-multilin
[elpa] externals/elpa bf75312 35/71: Require Xref, Project and Eldoc from GNU ELPA
branch: externals/elpa commit bf75312b8e7ea5136905d7a55a6d705b51b2b6c9 Author: João Távora Commit: João Távora Require Xref, Project and Eldoc from GNU ELPA * Makefile (ELPADEPS): Install Xref, Project and Eldoc. * eglot.el (Package-Requires): Require Xref, Project and Eldoc from GNU ELPA. --- Makefile | 3 +++ eglot.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 63db244..1a39c65 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ ELPADEPS ?=--eval '(package-initialize)' \ --eval '(package-refresh-contents)' \ --eval '(package-install (quote company))' \ --eval '(package-install (quote jsonrpc))' \ + --eval '(package-install (quote xref))' \ + --eval '(package-install (quote project))' \ + --eval '(package-install (quote eldoc))'\ --eval '(package-install (quote yasnippet))'\ --eval '(package-install\ (cadr (assoc (quote flymake) \ diff --git a/eglot.el b/eglot.el index 8a1d162..f3501cb 100644 --- a/eglot.el +++ b/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8") (package "0.1.1") (xref "1.0.1") (eldoc "1.0.0")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by
[elpa] externals/elpa a807b4f 43/71: Some test-related cleanup
branch: externals/elpa commit a807b4f30b6128f64d1ad44271e62a39a9623dc8 Author: João Távora Commit: João Távora Some test-related cleanup * Makefile (ELPADEPS): Change order of ELPADEPS. * eglot-tests.el (eglot--call-with-fixture): Bind python-indent-guess-indent-offset-verbose here. (eglot--tests--python-mode-bindings): Remove. (auto-detect-running-server, auto-shutdown, auto-reconnect) (basic-diagnostics, rename-a-symbol, basic-completions, basic-xref) (snippet-completions, snippet-completions-with-company) (hover-after-completions, hover-multiline-doc-locus) (python-autopep-formatting, python-yapf-formatting, json-basic) (eglot-ensure, slow-sync-connection-wait, slow-sync-connection-intime) (slow-async-connection, slow-sync-timeout): Don't use eglot--tests--python-mode-bindings. (eglot--guessing-contact): Reindent. --- Makefile | 4 +- eglot-tests.el | 117 - 2 files changed, 51 insertions(+), 70 deletions(-) diff --git a/Makefile b/Makefile index 1a39c65..dfbd69f 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,11 @@ ELCFILES := $(ELFILES:.el=.elc) ELPADEPS ?=--eval '(package-initialize)' \ --eval '(package-refresh-contents)' \ - --eval '(package-install (quote company))' \ --eval '(package-install (quote jsonrpc))' \ - --eval '(package-install (quote xref))' \ --eval '(package-install (quote project))' \ + --eval '(package-install (quote xref))' \ --eval '(package-install (quote eldoc))'\ + --eval '(package-install (quote company))' \ --eval '(package-install (quote yasnippet))'\ --eval '(package-install\ (cadr (assoc (quote flymake) \ diff --git a/eglot-tests.el b/eglot-tests.el index f701a01..059a565 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -88,6 +88,8 @@ then restored." ;; Prevent user-configuration to have an influence on ;; language servers. (See github#441) (cons "XDG_CONFIG_HOME=/dev/null" process-environment)) + ;; Prevent "Can't guess python-indent-offset ..." messages. + (python-indent-guess-indent-offset-verbose . nil) (eglot-server-initialized-hook (lambda (server) (push server new-servers (setq created-files (mapcan #'eglot--make-file-or-dir file-specs)) @@ -257,11 +259,6 @@ Pass TIMEOUT to `eglot--with-timeout'." (eglot-connect-timeout timeout)) (apply #'eglot--connect (eglot--guess-contact -(defvar eglot--tests--python-mode-bindings - '(;; Prevent "Can't guess python-indent-offset ..." messages. -(python-indent-guess-indent-offset-verbose . nil)) - "Alist of variable bindings to be used in tests involving `python-mode'.") - ;;; Unit tests @@ -313,8 +310,7 @@ Pass TIMEOUT to `eglot--with-timeout'." (eglot--with-fixture `(("project" . (("coiso.py" . "bla") ("merdix.py" . "bla"))) - ("anotherproject" . (("cena.py" . "bla"))) - ,@eglot--tests--python-mode-bindings) + ("anotherproject" . (("cena.py" . "bla" (with-current-buffer (eglot--find-file-noselect "project/coiso.py") (should (setq server (eglot--tests-connect))) @@ -333,8 +329,7 @@ Pass TIMEOUT to `eglot--with-timeout'." (let (server buffer) (eglot--with-fixture -`(("project" . (("coiso.py" . "def coiso: pass"))) - ,@eglot--tests--python-mode-bindings) +`(("project" . (("coiso.py" . "def coiso: pass" (with-current-buffer (setq buffer (eglot--find-file-noselect "project/coiso.py")) (should (setq server (eglot--tests-connect))) @@ -353,8 +348,7 @@ Pass TIMEOUT to `eglot--with-timeout'." (let (server (eglot-autoreconnect 1)) (eglot--with-fixture `(("project" . (("coiso.py" . "bla") -("merdix.py" . "bla"))) - ,@eglot--tests--python-mode-bindings) +("merdix.py" . "bla" (with-current-buffer (eglot--find-file-noselect "project/coiso.py") (should (setq server (eglot--tests-connect))) @@ -412,8 +406,8 @@ Pass TIMEOUT to `eglot--with-timeout'." (skip-unless (executable-find "pyls")) (eglot--with-fixture `(("diag-project" . - (("main.py" . "def foo(): if True pass"))) ; colon missing after True -,@eglot--tests--python-mode-bindings) +; colon missing after True + (("main.py" . "def foo(): if True pass" (with-current-buffer (eglot--find-file-noselect "diag-project/main.py") (eglot-
[elpa] externals/elpa 9874456 42/71: Close #482: use filter-buffer-substring to get buffer text
branch: externals/elpa commit 987445648a893444ac1bbdfe3035221fa7797b45 Author: Andrii Kolomoiets Commit: GitHub Close #482: use filter-buffer-substring to get buffer text This way modes used to represent hover info text, such as gfm-view-mode can e.g. filter out invisible text by providing own `filter-buffer-substring-function'. * eglot.el (eglot--format-markup): Use `filter-buffer-substring'. --- eglot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index dc0200d..8bb610b 100644 --- a/eglot.el +++ b/eglot.el @@ -1165,10 +1165,10 @@ Doubles as an indicator of snippet support." (_ major-mode)) (with-temp-buffer (setq-local markdown-fontify-code-blocks-natively t) - (insert (string-trim string)) + (insert string) (ignore-errors (delay-mode-hooks (funcall mode))) (font-lock-ensure) - (buffer-string + (string-trim (filter-buffer-substring (point-min) (point-max)) (defcustom eglot-ignored-server-capabilites (list) "LSP server capabilities that Eglot could use, but won't.
[elpa] externals/elpa 2b16952 44/71: Try to make hover-multiline-doc-locus test pass on Travis
branch: externals/elpa commit 2b16952d702a4784fe243dc5ecda02e2c5ae7d8d Author: João Távora Commit: João Távora Try to make hover-multiline-doc-locus test pass on Travis A batch emacs apparently runs with a frame-width of 10 $ emacs -Q --batch --eval '(princ (frame-width))' 10 This could possibly not be enough, for the hover-multiline-doc-locus test, which uses pyls docstrings, to avoid truncation of "datetime(...)" into "datetim...". The failure doesn't happen locally, but changing the assertion to check one character less isn't very problematic. * eglot-tests.el (hover-multiline-doc-locus): Try to make test pass on Travis. --- eglot-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 059a565..2f8e25f 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -576,14 +576,14 @@ def foobazquuz(d, e, f): pass (setq-local eldoc-echo-area-use-multiline-p nil) (eglot-eldoc-function) (while (not eldoc-last-message) (accept-process-output nil 0.1)) - (should (string-match "datetime" eldoc-last-message)) + (should (string-match "datetim" eldoc-last-message)) (should (not (cl-find ?\n eldoc-last-message))) ;; multi-line (setq eldoc-last-message nil) (setq-local eldoc-echo-area-use-multiline-p t) (eglot-eldoc-function) (while (not eldoc-last-message) (accept-process-output nil 0.1)) - (should (string-match "datetime" eldoc-last-message)) + (should (string-match "datetim" eldoc-last-message)) (should (cl-find ?\n eldoc-last-message) (ert-deftest python-autopep-formatting ()
[elpa] externals/elpa b34447c 45/71: Close #473: simplify eglot-code-actions
branch: externals/elpa commit b34447c6698837186552e4bab6b1a422b45e42dd Author: muffinmad Commit: João Távora Close #473: simplify eglot-code-actions If no region is active, ask for code actions at point, even if there are no diagnostics at point. Co-authored-by: João Távora * eglot.el (eglot-code-actions): Simplify. --- eglot.el | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/eglot.el b/eglot.el index 8bb610b..4b25368 100644 --- a/eglot.el +++ b/eglot.el @@ -2563,15 +2563,13 @@ documentation. Honour `eglot-put-doc-in-help-buffer', current-prefix-arg)) -(defun eglot-code-actions (&optional beg end) - "Get and offer to execute code actions between BEG and END." +(defun eglot-code-actions (beg &optional end) + "Offer to execute code actions between BEG and END. +Interactively, if a region is active, BEG and END are its bounds, +else BEG is point and END is nil, which results in a request for +code actions at point" (interactive - (let (diags) - (cond ((region-active-p) (list (region-beginning) (region-end))) - ((setq diags (flymake-diagnostics (point))) -(list (cl-reduce #'min (mapcar #'flymake-diagnostic-beg diags)) - (cl-reduce #'max (mapcar #'flymake-diagnostic-end diags - (t (list (point-min) (point-max)) + (if (region-active-p) `(,(region-beginning) ,(region-end)) `(,(point) nil))) (unless (eglot--server-capable :codeActionProvider) (eglot--error "Server can't execute code actions!")) (let* ((server (eglot--current-server-or-lose))
[elpa] externals/elpa ac9239b 46/71: Fix small problems around Eglot's help buffer
branch: externals/elpa commit ac9239bed5e3bfbf057382d1a75cdfa23f2caddd Author: João Távora Commit: João Távora Fix small problems around Eglot's help buffer Specifically: - correctly format the message shown to the user about doc being truncated - don't show message if the buffer is showing in some frame's window - correctly name the help buffer switched to with `C-h .'. This is still not ideal: - When the `C-h .' suggestion is shown to the user, typing that keybinding shouldn't result in a new LSP request to fetch probably the same info; - All this functionality belongs in eldoc.el. * eglot.el (eglot-help-at-point): Fix buffer name. (eglot--update-doc): Provide more help. --- eglot.el | 28 +++- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/eglot.el b/eglot.el index 4b25368..733b69c 100644 --- a/eglot.el +++ b/eglot.el @@ -2270,12 +2270,12 @@ is not active." (jsonrpc-request (eglot--current-server-or-lose) :textDocument/hover (eglot--TextDocumentPositionParams)) (let ((blurb (and (not (seq-empty-p contents)) - (eglot--hover-info contents range + (eglot--hover-info contents range))) + (hint (thing-at-point 'symbol))) (if blurb (with-current-buffer (eglot--help-buffer) (with-help-window (current-buffer) - (rename-buffer (format "*eglot-help for %s*" - (thing-at-point 'symbol))) + (rename-buffer (format "*eglot-help for %s*" hint)) (with-current-buffer standard-output (insert blurb)) (setq-local nobreak-char-display nil))) (display-local-help) @@ -2350,16 +2350,18 @@ documentation. Honour `eglot-put-doc-in-help-buffer', (erase-buffer) (insert string) (goto-char (point-min))) - (if eglot-auto-display-help-buffer - (display-buffer (current-buffer)) - (unless (get-buffer-window (current-buffer)) - ;; This prints two lines. Should it print 1? Or - ;; honour max-mini-window-height? - (eglot--message - "%s\n(...truncated. Full help is in `%s')" - (eglot--truncate-string string 1 (- (frame-width) 8)) - (buffer-name eglot--help-buffer - (help-mode + (help-mode))) + (if eglot-auto-display-help-buffer + (display-buffer eglot--help-buffer) + (unless (get-buffer-window eglot--help-buffer t) + ;; Hand-tweaked to print two lines. Should it print + ;; 1? Or honour max-mini-window-height? + (eglot--message + "%s\n(Truncated, %sfull help in buffer %s)" + (eglot--truncate-string string 1 (- (frame-width) 9)) + (if-let (key (car (where-is-internal 'eglot-help-at-point))) + (format "use %s to see " (key-description key)) "") + (buffer-name eglot--help-buffer) ((eq eldoc-echo-area-use-multiline-p t) (if-let ((available (eglot-doc-too-large-for-echo-area string))) (eldoc-message (eglot--truncate-string string available))
[elpa] externals/elpa a044dec 47/71: Delegate "hover" and "signature" doc synchronization efforts to Eldoc
branch: externals/elpa commit a044dec7f94d0d21bd65cf8a04f09cc63324db18 Author: João Távora Commit: João Távora Delegate "hover" and "signature" doc synchronization efforts to Eldoc Uses Eldoc's eldoc-documentation-functions variable. In Eldoc v1.0.0 that variable was already available as a way of handling/composing multiple docstrings from different sources, but it didn't work practically with mutiple concurrent async sources. This was fixed in 1.1.0, which Eglot now requires. This fixes the synchronization problems reported in #494 and also issue #439. It is likely that some of the exact doc-composing functionality in Eglot, (developed during those issues) was lost, and has to be remade, quite likely in Eldoc itself. Flymake is now also an Eldoc producer, and therefore the problems of github issues #481 and #454 will also soon be fixed as soon as Eglot starts using the upcoming Flymake 1.0.9. * NEWS.md: New entry. * README.md (eglot-put-doc-in-help-buffer) (eglot-auto-display-help-buffer): Remove mention to these options. * eglot.el (Package-Requires:) Require eldoc.el 1.1.0. (eglot--when-live-buffer): Rename from eglot--with-live-buffer. (eglot--when-buffer-window): New macro. (eglot--after-change, eglot--on-shutdown, eglot-ensure): Use eglot--when-live-buffer. (eglot--managed-mode): Use eglot-documentation-functions and eldoc-documentation-strategy. (eglot--highlights): Move down. (eglot-signature-eldoc-function, eglot-hover-eldoc-function) (eglot--highlight-piggyback): New eldoc functions. (eglot--help-buffer, eglot--update-doc) (eglot-auto-display-help-buffer, eglot-put-doc-in-help-buffer) (eglot--truncate-string, eglot-doc-too-large-for-echo-area) (eglot-help-at-point): Remove all of this. (eglot--apply-workspace-edit): Call eldoc manually after an edit. (eglot-mode-map): Remap display-local-help to eldoc-doc-buffer --- NEWS.md | 11 +++ README.md | 6 -- eglot.el | 259 +++--- 3 files changed, 91 insertions(+), 185 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9be8588..cb72ba3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,17 @@ Thanks to Ingo Lohmar for the original implementation. +# Handle multiple "documentation at point" sources ([#439][github#439], [#494][github#494], [#481][github#481], [#454][github#454]) + +Such sources include as LSP's signature, hover and also the Flymake +diagnostic messages. They can all be presented in the echo area +(space permitting), or via `C-h .`. For now, composition of different +sources can be customized using `eldoc-documentation-strategy`, +`eldoc-echo-area-use-multiline-p` and `eldoc-prefer-doc-buffer`. + +The variables `eglot-put-doc-in-help-buffer` and +`eglot-auto-display-help-buffer` have been removed. + # 1.6 (16/04/2020) # Column offset calculation is now LSP-conform ([#361][github#361]) diff --git a/README.md b/README.md index edbc779..caf03ba 100644 --- a/README.md +++ b/README.md @@ -264,12 +264,6 @@ documentation on what these do. - `eglot-ignored-server-capabilites`: LSP server capabilities that Eglot could use, but won't; -- `eglot-put-doc-in-help-buffer`: If non-nil, put eldoc docstrings in - separate `*eglot-help*` buffer; - -- `eglot-auto-display-help-buffer`: If non-nil, automatically display - `*eglot-help*` buffer; - - `eglot-confirm-server-initiated-edits`: If non-nil, ask for confirmation before allowing server to edit the source buffer's text; diff --git a/eglot.el b/eglot.el index 733b69c..b94fcc3 100644 --- a/eglot.el +++ b/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8") (project "0.3.0") (xref "1.0.1") (eldoc "1.0.0")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.8") (project "0.3.0") (xref "1.0.1") (eldoc "1.1.0")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -470,11 +470,19 @@ treated as in `eglot-dbind'." ;;; API (WORK-IN-PROGRESS!) ;;; -(cl-defmacro eglot--with-live-buffer (buf &rest body) +(cl-defmacro eglot--when-live-buffer (buf &rest body) "Check BUF live, then do BODY in it." (declare (indent 1) (debug t)) (let ((b (cl-gensym))) `(let ((,b ,buf)) (if (buffer-live-p ,b) (with-current-buffer ,b ,@body) +(cl-defmacro eglot--when-buffer-window (buf &body body) + "Check BUF showing somewhere, then do BODY in it" (declare (indent 1) (debug t)) + (let ((b (cl-gensym))) +`(let ((,b ,buf)) + ;;notice the exception when testing with `ert' + (when (or (get-buffer-window ,b) (ert-running-test)) + (with-current-buffer ,b ,@body)
[elpa] externals/elpa 2b7ec0e 51/71: Expect eglot-multiline-eldoc to fail on Travis
branch: externals/elpa commit 2b7ec0ec998de8cd00480e16935613109fb2b5cf Author: João Távora Commit: João Távora Expect eglot-multiline-eldoc to fail on Travis For some reason, the test consistently fails on Travis. * eglot-tests.el (eglot-multiline-eldoc): Skip test on Travis. --- eglot-tests.el | 1 + 1 file changed, 1 insertion(+) diff --git a/eglot-tests.el b/eglot-tests.el index 37f3c06..4730ee7 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -578,6 +578,7 @@ def foobazquuz(d, e, f): pass (ert-deftest eglot-multiline-eldoc () "Test if suitable amount of lines of hover info are shown." + :expected-result (if (getenv "TRAVIS_TESTING") :failed :passed) (skip-unless (executable-find "pyls")) (eglot--with-fixture `(("project" . (("hover-first.py" . "from datetime import datetime"
[elpa] externals/elpa 4e82f53 53/71: Reload Eldoc if needed on Emacs < 28
branch: externals/elpa commit 4e82f53f17a5df0737c353a5ce811a6f6cc9a366 Author: João Távora Commit: João Távora Reload Eldoc if needed on Emacs < 28 ElDoc is preloaded in Emacs, so `require`-ing won't guarantee we are using the latest version from GNU Elpa when we load eglot.el. Use an heuristic to see if we need to `load` it in Emacs < 28. * eglot.el (Package-Requires): Require eldoc 1.5.0 (top): Sometimes load eldoc --- eglot.el | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index 87fd9c8..865ca03 100644 --- a/eglot.el +++ b/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.9") (project "0.3.0") (xref "1.0.1") (eldoc "1.2.0")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.9") (flymake "1.0.9") (project "0.3.0") (xref "1.0.1") (eldoc "1.5.0")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -72,6 +72,15 @@ (require 'filenotify) (require 'ert) (require 'array) + +;; ElDoc is preloaded in Emacs, so `require'-ing won't guarantee we are +;; using the latest version from GNU Elpa when we load eglot.el. Use an +;; heuristic to see if we need to `load' it in Emacs < 28. +(if (and (< emacs-major-version 28) + (not (boundp 'eldoc-documentation-strategy))) +(load "eldoc") + (require 'eldoc)) + ;; forward-declare, but don't require (Emacs 28 doesn't seem to care) (defvar markdown-fontify-code-blocks-natively) (defvar company-backends)
[elpa] externals/elpa e5fefc7 56/71: Really unbreak eldoc-related tests
branch: externals/elpa commit e5fefc7512e3a8104b3b83e6cee88ea5952e6110 Author: João Távora Commit: João Távora Really unbreak eldoc-related tests * eglot-tests.el (eglot--eldoc-on-demand): Don't rely on return value of eldoc command. --- eglot-tests.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eglot-tests.el b/eglot-tests.el index 86d2f0c..c6d7ee2 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -422,8 +422,7 @@ Pass TIMEOUT to `eglot--with-timeout'." (defun eglot--eldoc-on-demand () ;; Trick Eldoc 1.1.0 into accepting on-demand calls. - (let ((this-command nil) (last-command 'forward-char)) -(should (eldoc + (eldoc t)) (defun eglot--tests-force-full-eldoc () (let ((origin (current-buffer)))
[elpa] externals/elpa 5f873d2 60/71: Fix #521: Correct paren mismatch blunder introduced by earlier commit
branch: externals/elpa commit 5f873d288e1c5434c1640bef03555ed056cb0d35 Author: João Távora Commit: João Távora Fix #521: Correct paren mismatch blunder introduced by earlier commit Per #512. * eglot.el (eglot-server-programs): properly close parenthesis. --- eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index 023c0df..a4ba1f9 100644 --- a/eglot.el +++ b/eglot.el @@ -122,7 +122,7 @@ language-server/bin/php-language-server.php")) ((tex-mode context-mode texinfo-mode bibtex-mode) . ("digestif")) (erlang-mode . ("erlang_ls" "--transport" "stdio")) -(gdscript-mode . ("localhost" 6008)) +(gdscript-mode . ("localhost" 6008))) "How the command `eglot' guesses the server to start. An association list of (MAJOR-MODE . CONTACT) pairs. MAJOR-MODE is a mode symbol, or a list of mode symbols. The associated
[elpa] externals/elpa 209b227 61/71: Fix #524: provide suitable default to M-x eglot-rename
branch: externals/elpa commit 209b227c4ef9f4ececbcc87c64b8d4b760c52994 Author: Paul M. Rodriguez Commit: GitHub Fix #524: provide suitable default to M-x eglot-rename Copyright-paperwork-exempt: Yes * eglot (eglot-rename): Provide a default value. --- eglot.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eglot.el b/eglot.el index a4ba1f9..64543d7 100644 --- a/eglot.el +++ b/eglot.el @@ -2477,7 +2477,9 @@ is not active." (defun eglot-rename (newname) "Rename the current symbol to NEWNAME." (interactive - (list (read-from-minibuffer (format "Rename `%s' to: " (symbol-at-point) + (list (read-from-minibuffer (format "Rename `%s' to: " (symbol-at-point)) + nil nil nil nil + (symbol-name (symbol-at-point) (unless (eglot--server-capable :renameProvider) (eglot--error "Server can't rename!")) (eglot--apply-workspace-edit
[elpa] externals/elpa f9a11fe 63/71: Per #300: Don't send JSON null (Elisp nil) down the wire
branch: externals/elpa commit f9a11fe2d1b491fde8b4f1815575de7c890d7b38 Author: João Távora Commit: João Távora Per #300: Don't send JSON null (Elisp nil) down the wire * eglot.el (eglot-initialization-options) (eglot-client-capabilities): Use eglot--{}, not nil. --- eglot.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index c752322..60bc56e 100644 --- a/eglot.el +++ b/eglot.el @@ -508,7 +508,7 @@ treated as in `eglot-dbind'." (cl-defgeneric eglot-initialization-options (server) "JSON object to send under `initializationOptions'" - (:method (_s) nil)) ; blank default + (:method (_s) eglot--{})) ; blank default (cl-defgeneric eglot-register-capability (server method id &rest params) "Ask SERVER to register capability METHOD marked with ID." @@ -581,7 +581,7 @@ treated as in `eglot-dbind'." :rangeFormatting`(:dynamicRegistration :json-false) :rename `(:dynamicRegistration :json-false) :publishDiagnostics `(:relatedInformation :json-false)) -:experimental (list +:experimental eglot--{}))) (defclass eglot-lsp-server (jsonrpc-process-connection) ((project-nickname
[elpa] externals/elpa 2172641 65/71: Fix #558: Don't force eglot-strict-mode completely in eglot--dcase
branch: externals/elpa commit 21726416e6e580b20dfa90833c6dab2a8a15ea48 Author: João Távora Commit: João Távora Fix #558: Don't force eglot-strict-mode completely in eglot--dcase Doing so was by design, since there's much ambiguity between the CodeAction and Command objects. But 'disallow-non-standard-keys is not necessary to disambiguate, and proved harmful in this bug. * eglot.el (eglot--dcase): Don't disallow (eglot--check-dspec): Fix docstring. --- eglot.el | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eglot.el b/eglot.el index bd3bb53..b0bd213 100644 --- a/eglot.el +++ b/eglot.el @@ -373,7 +373,7 @@ on unknown notifications and errors on unknown requests. :optional-keys (mapcar #'car optional (defun eglot--check-dspec (interface-name dspec) -"Check if variables in DSPEC " +"Check destructuring spec DSPEC against INTERFACE-NAME." (cl-destructuring-bind (&key required-keys optional-keys &allow-other-keys) (eglot--interface interface-name) (cond ((or required-keys optional-keys) @@ -457,10 +457,14 @@ treated as in `eglot-dbind'." (cond (interface-name (eglot--check-dspec interface-name vars) ;; In this mode, in runtime, we assume - ;; `eglot-strict-mode' is fully on, otherwise we + ;; `eglot-strict-mode' is partially on, otherwise we ;; can't disambiguate between certain types. `(ignore-errors - (eglot--check-object ',interface-name ,obj-once))) + (eglot--check-object + ',interface-name ,obj-once + t + (memq 'disallow-non-standard-keys eglot-strict-mode) + t))) (t ;; In this interface-less mode we don't check ;; `eglot-strict-mode' at all: just check that the object
[elpa] externals/elpa 38971d3 66/71: Fix #367: don't let M-x fill-paragraph break didChange
branch: externals/elpa commit 38971d3c1d647ab6ad839c3b8585394ea8e53b54 Author: João Távora Commit: João Távora Fix #367: don't let M-x fill-paragraph break didChange M-x fill-paragraph represents some paragraph-fillling changes very summarily. Filling 1 // foo 2 bar Into 1 // foo bar Only makes two changes: a deletion of the "// " and a replacement of a newline with a space character. The second change fooled Eglot's fix for #259, by making a change similar to the one it is made to detect and correct. That fix should taget things that happen on the same line, this not being one of those things. * eglot.el (eglot--after-change): Only apply fix to #259 if case-fiddling happens on same line. --- eglot.el | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eglot.el b/eglot.el index b0bd213..aa89ae9 100644 --- a/eglot.el +++ b/eglot.el @@ -1745,10 +1745,15 @@ Records BEG, END and PRE-CHANGE-LENGTH locally." ;; github#259: With `upcase-word' or somesuch, ;; `before-change-functions' always records the whole word's ;; `beg' and `end'. Not only is this longer than needed but - ;; conflicts with the args received here. Detect this using - ;; markers recorded earlier and `pre-change-len', then fix it. + ;; conflicts with the args received here, which encompass just + ;; the parts of the word that changed (if any). We detect this + ;; using markers recorded earlier and at looking + ;; `pre-change-len'. We also ensure that the before bounds + ;; indeed belong to the same line (if we don't, we get could get + ;; #367). (when (and (= b-end b-end-marker) (= b-beg b-beg-marker) -(not (zerop pre-change-length))) +(not (zerop pre-change-length)) +(= (plist-get lsp-beg :line) (plist-get lsp-end :line))) (setq lsp-end (eglot--pos-to-lsp-position end) lsp-beg (eglot--pos-to-lsp-position beg))) (setcar eglot--recent-changes
[elpa] externals/elpa af0e876 68/71: Close #572: use haskell-language-server in eglot-server-programs
branch: externals/elpa commit af0e876040b73de5b8c715cb04fa9a1cb15d03a1 Author: TANIGUCHI Kohei Commit: GitHub Close #572: use haskell-language-server in eglot-server-programs Use haskell-language-server instead of deprecated Haskell IDE Engine https://github.com/haskell/haskell-language-server https://github.com/haskell/haskell-ide-engine#deprecated * README.md: Replace Haskell IDE Engine with haskell-language-server * eglot.el (eglot-server-programs): Replace hie-wrapper with haskell-language-server-wrapper Copyright-paperwork-exempt: yes --- README.md | 4 ++-- eglot.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c45ba28..607291a 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ for the language you're using. Otherwise, it prompts you to enter one. * Bash's [bash-language-server][bash-language-server] * PHP's [php-language-server][php-language-server] * C/C++'s [ccls][ccls] ([cquery][cquery] and [clangd][clangd] also work) -* Haskell's [IDE engine][haskell-ide-engine] +* Haskell's [haskell-language-server][haskell-language-server] * Elm's [elm-language-server][elm-language-server] * Kotlin's [kotlin-language-server][kotlin-language-server] * Go's [gopls][gopls] @@ -512,7 +512,7 @@ Under the hood: [clangd]: https://clang.llvm.org/extra/clangd.html [solargraph]: https://github.com/castwide/solargraph [windows-subprocess-hang]: https://www.gnu.org/software/emacs/manual/html_node/efaq-w32/Subprocess-hang.html -[haskell-ide-engine]: https://github.com/haskell/haskell-ide-engine +[haskell-language-server]: https://github.com/haskell/haskell-language-server [elm-language-server]: https://github.com/elm-tooling/elm-language-server [kotlin-language-server]: https://github.com/fwcd/KotlinLanguageServer [gopls]: https://github.com/golang/go/wiki/gopls diff --git a/eglot.el b/eglot.el index 3ebdd04..e148403 100644 --- a/eglot.el +++ b/eglot.el @@ -108,7 +108,7 @@ language-server/bin/php-language-server.php")) (ruby-mode . ("solargraph" "socket" "--port" :autoport)) -(haskell-mode . ("hie-wrapper" "--lsp")) +(haskell-mode . ("haskell-language-server-wrapper" "--lsp")) (elm-mode . ("elm-language-server")) (kotlin-mode . ("kotlin-language-server")) (go-mode . ("gopls"))
[elpa] externals/rt-liberation updated (6b062b7 -> f682e7b)
yonirabkin pushed a change to branch externals/rt-liberation. from 6b062b7 * rt-liberation.el: bump to 1.31 new 2e9b1f3 * rt-liberation.el: remove old cli code new b2f3f57 * doc/rt-liberation.texinfo: update documentation new d6441dc * rt-liberation-report.el: fix error new 1995685 * rt-liberation-rest.el: fix undefined variable new 965be87 fix broken dependencies new 61dda6f * rt-liberation.el: remove unused code new 7269205 * rt-liberation.el: remove cl and cl-lib requirement new 203ec6a * rt-liberation-gnus.el: avoid compiler warning new 0fc4737 documentation fixes new 84ce235 Syncronize with Stefan's changes new 1000e89 * doc/rt-liberation.texinfo: update manual new 0be03c5 * doc/gpl.texi: fix compilation warning new 05176e8 * rt-liberation.el: version bump new 4e4cb06 add manual to ELPA new f7a290c * doc/developer-release.txt: new file new ed929f5 integrate changes post-ELPA synchronization new 5648253 fix info listing problem new 133559f * dir: fix info listing issues take 2 new 9902111 * dir: shorten the name of the info file new 291a8e3 move to other machine new 700d45e * doc/developer-release.txt: update documentation new 7ddbe07 * NEWS: new a9786cf * NEWS: update new 4097a1c * rt-liberation-rest.el: new function rt-liber-rest-auth new 6098e23 * rt-liberation-rest.el: add requirement new a5d7634 * doc/developer-release.txt: add compile comment new f586e7d * doc/rt-liber.texinfo: update manual new 12d16aa Add lexical binding declaration new 0ee9eba New file: rt-liberation-viewer new 237b11d * rt-liberation-viewer.el: reorganize new 53e56b7 * rt-liberation-viewer.el: history parse new 280fece * rt-liberation-viewer.el: section parsing new ab6c820 * rt-liberation-viewer.el: new 6defec3 * rt-liberation-viewer.el: new bcbf368 * rt-liberation-viewer.el: content parsing new 45275d3 splitting aside code for viewer2 new ec9245d * rt-liberation-viewer.el: start work on formatting new fe58520 * Makefile: neat new 71f0e4c bring the code back new 3b95e84 * rt-liberation.el: reformatting new 79d8eb1 * rt-liberation.el: viewer2 work restarts new 79104c6 * rt-liberation.el: new ac07fea * rt-liberation.el: new c50bb85 * rt-liberation.el: new d86507f * rt-liberation-rest.el: formatting new e7ec418 * rt-liberation-rest.el: check for a non-empty string new 73a2ba0 * rt-liberation.el: find sections new 680e177 * rt-liberation.el: remove leading blank lines new cbfb99c * rt-liberation.el: start making sense of section types new b23df79 * rt-liberation.el: forward and back section movement new 95553c6 * rt-liberation.el: vernacular time delta new f529257 * rt-liberation.el: section display new 1038ecc * rt-liberation.el: fill content new dacb48c * rt-liberation.el: trim down viewer2 key map. new 3a0dfc3 * rt-liberation.el: section data new b1a1dc6 * rt-liberation.el: prep for mail new 44823a0 * rt-liberation.el: gnus integration new bd533b2 fix compiler warnings new a99fc59 * rt-liberation.el: high recenter new d567c59 * rt-liberation.el: fix n/p in viewer2 new fd1e4a9 * rt-liberation.el: add jump to last section new 50eba43 * rt-liberation-rest.el: formatting new 3376123 * rt-liberation-rest.el: better user interaction new b3f34ab update documentation across the board new e72ecd8 * doc/developer-release.txt: new 35f4cd5 * doc/developer-release.txt: new d964a92 * rt-liberation.el: bump to 2.01 new f682e7b Merge branch 'master' into externals/rt-liberation Summary of changes: Makefile |2 + NEWS |9 +- doc/developer-release.txt | 39 +- doc/rt-liber.texinfo | 99 ++--- rt-liber.info | 209 + rt-liberation-gnus.el | 12 +- rt-liberation-multi.el|2 +- rt-liberation-report.el |2 +- rt-liberation-rest.el | 40 +- rt-liberation-storage.el |2 +- rt-liberation-update.el |2 +- rt-liberation.el | 1059 +++-- 12 files changed, 952 insertions(+), 525 deletions(-)
[elpa] externals/rt-liberation 2e9b1f3 01/68: * rt-liberation.el: remove old cli code
branch: externals/rt-liberation commit 2e9b1f39ddf3c8b45aee7090fe23d85fa643d218 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation.el: remove old cli code --- rt-liberation.el | 88 1 file changed, 88 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index b6345ba..aa48cea 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -396,21 +396,6 @@ AFTER date after predicate." continue t)) ticketbase-list)) -;; accept the output of `rt-liber-ticketsql-runner-parser-f' and -;; return a string suitable for an RT "show" query -(defun rt-liber-create-tickets-string (idsublist) - "Create a RT CLI ticket \"show\" string from IDSUBLIST." - (let ((ticket-list (mapcar #'(lambda (e) (car e)) idsublist))) -(if ticket-list - (concat "ticket/" - (if (= (length ticket-list) 1) - (format "%s" (car ticket-list)) - (reduce - #'(lambda (a b) - (format "%s,%s" a b)) - ticket-list))) - (signal 'rt-liber-no-result-from-query-error nil - ;;; ;;; Ticket utilities @@ -930,79 +915,6 @@ and as such always return t." ;;; -;;; Version comparison functions -;;; - -;; rt-liber-version-<: string * string -> t-or-nil -(defun rt-liber-version-< (vnum1 vnum2) - "Test whehther version number VNUM1 is less than VNUM2. -Arguments must be strings Lisp objects, and not numbers. - -Examples: - (rt-liber-version-< \"1.01\" \"1.11\") -=> t - - (rt-liber-version-< \"1.1\" \"1.0.1\") -=> nil" - (rt-liber-version-<- (rt-liber-version-value - (rt-liber-version-read vnum1)) - (rt-liber-version-value - (rt-liber-version-read vnum2 - -;; rt-liber-version-read: string -> list string -(defun rt-liber-version-read (str) - "Tokenize version number STR whenever the syntax class changes. - - Example: - \"1.043.0-1_=+\" \ -==> (\"1\" \".\" \"043\" \".\" \"0\" \"-\" \"1\" \"_=+\")" - (let ((tokens nil) - (start 0) - (re (mapconcat 'identity '("[[:digit:]]+" "[[:punct:]]+") "\\|"))) -(while (and (string-match re (substring str start)) - (> (length str) start)) - (setq tokens (cons (match-string 0 (substring str start)) tokens)) - (setq start (+ start (match-end 0 -(if (< start (length str)) - (error "Unknown character: %s" (substring str start (1+ start -(reverse tokens))) - -;; rt-liber-version-value: list string -> list number -(defun rt-liber-version-value (tokens) - "Convert list of TOKENS to a comparable number list." - (mapcar #'(lambda (tk) - (if (string-match "^0+$" tk) - 1 - (if (string-match "^[[:digit:]]+$" tk) - (if (string-match "^0+" tk) - (1+ (* (string-to-number tk) - (expt 10 -(- (length -(match-string 0 tk)) - (1+ (string-to-number tk))) - (if (string-match "^[[:punct:]]+$" tk) - 0 - ;; else (string-match "[^[:digit:][:punct:]]" tk) - -1 - tokens)) - -;; rt-liber-version-<-: list number -> t-or-nil -(defun rt-liber-version-<- (vals1 vals2) - "Test whether version representation VALS1 is less than VALS2." - (if (and (null vals1) (null vals2)) - nil -(if (null vals2) - nil - (if (null vals1) - t - (if (= (car vals1) (car vals2)) - (rt-liber-version-<- (cdr vals1) (cdr vals2)) - (if (< (car vals1) (car vals2)) - t - nil)) - - -;;; ;;; Entry points ;;;
[elpa] externals/rt-liberation 0fc4737 09/68: documentation fixes
branch: externals/rt-liberation commit 0fc4737bd6fee2b621eb21963e693b2be99831da Author: Yoni Rabkin Commit: Yoni Rabkin documentation fixes --- doc/gpl.texi | 1 + doc/rt-liberation.texinfo | 35 +-- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/doc/gpl.texi b/doc/gpl.texi index dc22d67..48d43f9 100644 --- a/doc/gpl.texi +++ b/doc/gpl.texi @@ -1,4 +1,5 @@ @node Copying, The GNU FDL, Local Storage, Top +@chapter The GNU General Public License. @c The GNU General Public License. @center Version 3, 29 June 2007 diff --git a/doc/rt-liberation.texinfo b/doc/rt-liberation.texinfo index e3f87fe..8b63fc0 100644 --- a/doc/rt-liberation.texinfo +++ b/doc/rt-liberation.texinfo @@ -18,7 +18,7 @@ @quotation Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.1 or +under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free @@ -97,8 +97,6 @@ Ticket Browser - - @c -- @node Introduction @@ -117,8 +115,6 @@ the resulting tickets, viewing the tickets' contents and performing operations on the tickets. - - @c -- @node Installation @@ -182,8 +178,6 @@ TicketSQL language. - - @c -- @node Query Compiler @@ -204,8 +198,6 @@ number of TicketSQL tokens. - - @c -- @node Query Language @@ -285,8 +277,6 @@ in function calls: @end lisp - - @c -- @node Ticket Browser @@ -422,8 +412,6 @@ Set the numerical priority level of the ticket at point. - - @c -- @node Ticket Browser Display @@ -490,8 +478,6 @@ considered high priority if its value is strictly higher than @var{rt-liber-browser-priority-cutoff} - - @c -- @node Ticket Browser Sorting @@ -633,8 +619,6 @@ buffers will be created displaying the query results and named - - @c -- @node Ticket Viewer @@ -752,8 +736,6 @@ Display the associated ticket in the ticket browser. - - @c -- @node Gnus Integration @@ -822,8 +804,6 @@ the Viewer will be able to call into it, @xref{Ticket Viewer}. - - @c -- @node Tracking Updates @@ -859,8 +839,6 @@ time-stamp so that the next invocation will produce the same result. @end defun - - @c -- @node Batch Operations @@ -906,9 +884,6 @@ Set the status of all the marked tickets to ``is-spam'' and delete. @end defun - - - @c -- @node Local Storage @@ -958,8 +933,6 @@ can be extended to associate any arbitrary data with any ticket. - - @c -- @node Concept Index @@ -967,8 +940,6 @@ can be extended to associate any arbitrary data with any ticket. @printindex cp - - @c -- @node Function Index @@ -976,8 +947,6 @@ can be extended to associate any arbitrary data with any ticket. @printindex fn - - @c -- @node Variable Index @@ -985,8 +954,6 @@ can be extended to associate any arbitrary data with any ticket. @printindex vr - - @c -- @node Keybinding Index
[elpa] externals/rt-liberation a5d7634 26/68: * doc/developer-release.txt: add compile comment
branch: externals/rt-liberation commit a5d763421c819fbbc174215d25862b739fae3ee8 Author: Yoni Rabkin Commit: Yoni Rabkin * doc/developer-release.txt: add compile comment --- doc/developer-release.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/developer-release.txt b/doc/developer-release.txt index 78e68da..81b275e 100644 --- a/doc/developer-release.txt +++ b/doc/developer-release.txt @@ -3,6 +3,8 @@ This is an outline of how to make a release for rt-liberation via GNU ELPA. +* compile +Check for and correct compile-time errors and warnings. * version In order for the ELPA system to trigger a release the version number
[elpa] externals/rt-liberation 0be03c5 12/68: * doc/gpl.texi: fix compilation warning
branch: externals/rt-liberation commit 0be03c519f12157a735f3b1c518f00da74c7e1cb Author: Yoni Rabkin Commit: Yoni Rabkin * doc/gpl.texi: fix compilation warning --- doc/gpl.texi | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/gpl.texi b/doc/gpl.texi index dc22d67..48d43f9 100644 --- a/doc/gpl.texi +++ b/doc/gpl.texi @@ -1,4 +1,5 @@ @node Copying, The GNU FDL, Local Storage, Top +@chapter The GNU General Public License. @c The GNU General Public License. @center Version 3, 29 June 2007
[elpa] externals/rt-liberation 280fece 32/68: * rt-liberation-viewer.el: section parsing
branch: externals/rt-liberation commit 280fece769a9fd30e12e5823ab329e7d0e64d7c2 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation-viewer.el: section parsing --- rt-liberation-viewer.el | 41 + 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el index 359e600..327e79f 100644 --- a/rt-liberation-viewer.el +++ b/rt-liberation-viewer.el @@ -31,6 +31,12 @@ (require 'rt-liberation) +(defvar rt-liber-viewer-section-header-regexp + "^# [0-9]+/[0-9]+ (id/[0-9]+/total)") + +(defvar rt-liber-viewer-section-field-regexp + "^\\(.+\\): \\(.+\\)$") + (defconst rt-liber-viewer-font-lock-keywords (let ((header-regexp (regexp-opt '("id: " "Ticket: " "TimeTaken: " "Type: " "Field: " "OldValue: " @@ -53,6 +59,25 @@ (car section-list) (cadr section-list +(defun rt-liber-viewer-parse-section (start end) + (goto-char start) + (when (not (re-search-forward rt-liber-viewer-section-header-regexp + end t)) +(error "invalid section")) + (forward-line 2) + (let (section-field-alist + section-field-end) +(save-excursion + (setq section-field-end + (re-search-forward "\n\n" end nil))) +(while (looking-at rt-liber-viewer-section-field-regexp) + (setq section-field-alist + (append section-field-alist + `((,(match-string-no-properties 1) . + ,(match-string-no-properties 2) + (forward-line)) +( + ;; According to: ;; "https://rt-wiki.bestpractical.com/wiki/REST#Ticket_History"; is of ;; the form: "# / (id//total)" @@ -65,16 +90,24 @@ (goto-char (point-min)) ;; find history detail sections and procude a list of section ;; (start . end) pairs -(let (section-point-list) - (while (re-search-forward "^# [0-9]+/[0-9]+ (id/[0-9]+/total)" (point-max) t) +(let (section-point-list + section-list) + (while (re-search-forward rt-liber-viewer-section-header-regexp (point-max) t) (setq section-point-list (append section-point-list -(list (point) +(list (point-at-bol) (when (not section-point-list) (error "no history detail sections found")) (setq section-point-list (append section-point-list (list (point-max))) section-point-list (rt-liber-viewer-reduce section-point-list #'cons nil)) - section-point-list))) + ;; collect the sections + (setq section-list + (mapcar +(lambda (section-points) + (rt-liber-viewer-parse-section + (car section-points) + (cdr section-points))) +section-point-list) (defun rt-liber-display-ticket-history (ticket-alist &optional assoc-browser) "Display history for ticket.
[elpa] externals/rt-liberation 53e56b7 31/68: * rt-liberation-viewer.el: history parse
branch: externals/rt-liberation commit 53e56b798c77ee4f244688490332d6a93d53be81 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation-viewer.el: history parse --- rt-liberation-viewer.el | 32 1 file changed, 32 insertions(+) diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el index bc0e15d..359e600 100644 --- a/rt-liberation-viewer.el +++ b/rt-liberation-viewer.el @@ -43,6 +43,38 @@ 'font-lock-comment-face))) "Expressions to font-lock for RT ticket viewer.") +(defun rt-liber-viewer-reduce (section-list f acc) + "A Not Invented Here tail-recursive reduce function." + (cond ((null (cdr section-list)) acc) + (t (rt-liber-viewer-reduce (cdr section-list) + f + (append acc (list + (funcall f +(car section-list) +(cadr section-list + +;; According to: +;; "https://rt-wiki.bestpractical.com/wiki/REST#Ticket_History"; is of +;; the form: "# / (id//total)" +(defun rt-liber-viewer-parse-history (ticket-history) + "Parse the string TICKET-HISTORY." + (when (not (stringp ticket-history)) +(error "invalid ticket-history")) + (with-temp-buffer +(insert ticket-history) +(goto-char (point-min)) +;; find history detail sections and procude a list of section +;; (start . end) pairs +(let (section-point-list) + (while (re-search-forward "^# [0-9]+/[0-9]+ (id/[0-9]+/total)" (point-max) t) + (setq section-point-list (append section-point-list +(list (point) + (when (not section-point-list) + (error "no history detail sections found")) + (setq section-point-list (append section-point-list + (list (point-max))) + section-point-list (rt-liber-viewer-reduce section-point-list #'cons nil)) + section-point-list))) (defun rt-liber-display-ticket-history (ticket-alist &optional assoc-browser) "Display history for ticket.
[elpa] externals/rt-liberation bcbf368 35/68: * rt-liberation-viewer.el: content parsing
branch: externals/rt-liberation commit bcbf368acd9156850334bc6085990a17c7065051 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation-viewer.el: content parsing The darn leading spaces are still there. --- rt-liberation-viewer.el | 61 + 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el index e1d499b..d48b9da 100644 --- a/rt-liberation-viewer.el +++ b/rt-liberation-viewer.el @@ -59,25 +59,55 @@ (car section-list) (cadr section-list +;; According to: +;; "https://rt-wiki.bestpractical.com/wiki/REST#Ticket_History_Entry"; +;; id: +;; Ticket: +;; TimeTaken: <...> +;; Type: <...> +;; Field: <...> +;; OldValue: <...> +;; NewValue: <...> +;; Data: <...> +;; Description: <...> + +;; Content: +;; +;; ... +;; + +;; Creator: <...> +;; Created: <...> +;; Attachments: <...> (defun rt-liber-viewer-parse-section (start end) (goto-char start) - (when (not (re-search-forward rt-liber-viewer-section-header-regexp - end t)) + (when (not (re-search-forward + rt-liber-viewer-section-header-regexp + end t)) (error "invalid section")) (forward-line 2) (let (section-field-alist - section-field-end) -(save-excursion - (setq section-field-end - (re-search-forward "\n\n" end nil))) -(while (not (looking-at "^\n")) - (when (looking-at rt-liber-viewer-section-field-regexp) - (setq section-field-alist - (append section-field-alist - `((,(match-string-no-properties 1) . -,(match-string-no-properties 2)) - (forward-line)) -section-field-alist)) + (rt-field-list +'(id Ticket TimeTaken Type Field + OldValue NewValue Data Description + Creator Created))) +;; definitely error out if any of this doesn't work +(setq section-field-alist + (mapcar + (lambda (field-symbol) +(re-search-forward (format "^%s:" (symbol-name field-symbol)) end nil) +(cons field-symbol (buffer-substring (1+ (point)) (point-at-eol + rt-field-list)) +;; content +(goto-char start) +(let ((content-start (re-search-forward "^Content: " end nil)) + (content-end (progn +(re-search-forward "^Creator: " end nil) +(point-at-bol + (append section-field-alist + `(,(cons 'Content + (buffer-substring content-start +content-end))) ;; According to: ;; "https://rt-wiki.bestpractical.com/wiki/REST#Ticket_History"; is of @@ -108,7 +138,8 @@ (rt-liber-viewer-parse-section (car section-points) (cdr section-points))) -section-point-list) +section-point-list)) + section-list))) (defun rt-liber-display-ticket-history (ticket-alist &optional assoc-browser) "Display history for ticket.
[elpa] externals/rt-liberation 79104c6 42/68: * rt-liberation.el:
branch: externals/rt-liberation commit 79104c6512c99083ee89eca061e73be7869ad705 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation.el: --- rt-liberation.el | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/rt-liberation.el b/rt-liberation.el index 5813af4..6d6196c 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -1198,6 +1198,29 @@ ASSOC-BROWSER if non-nil should be a ticket browser." ;;; -- ;;; viewer2 ;;; -- +(defconst rt-liber-viewer-font-lock-keywords + (let ((header-regexp (regexp-opt '("id: " "Ticket: " "TimeTaken: " +"Type: " "Field: " "OldValue: " +"NewValue: " "Data: " +"Description: " "Created: " +"Creator: " "Attachments: ") + t))) +(list + (list (concat "^" header-regexp ".*$") 0 + 'font-lock-comment-face))) + "Expressions to font-lock for RT ticket viewer.") + +(defface rt-liber-ticket-subdued-face + 'class color) (background dark)) + (:foreground "gray33")) +(((class color) (background light)) + (:foreground "gray85")) +(((type tty) (class mono)) + (:inverse-video t)) +(t (:background "Blue"))) + "Face for less important text.") + + (defun rt-liber-viewer-reduce (section-list f acc) "A Not Invented Here tail-recursive reduce function." (cond ((null (cdr section-list)) acc) @@ -1321,7 +1344,7 @@ ASSOC-BROWSER if non-nil should be a ticket browser." type)) (add-text-properties start (point) - `(font-lock-face font-lock-comment-face))) + `(font-lock-face rt-liber-ticket-subdued-face))) (cond ((or (string= type "Status") (string= type "CustomField") ;; (string= type "EmailRecord")
[elpa] externals/rt-liberation 3b95e84 40/68: * rt-liberation.el: reformatting
branch: externals/rt-liberation commit 3b95e84156da397e07a0183a10582c5181afbafb Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation.el: reformatting --- rt-liberation.el | 13 - 1 file changed, 13 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index 143923c..a1e6d62 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -133,7 +133,6 @@ (defvar rt-liber-browser-default-filter-function 'rt-liber-default-filter-f "Default filtering function. - This is a function which accepts the ticket alist as a single argument and returns nil if the ticket needs to be filtered out, dropped or ignored (however you wish to put it.), otherwise the @@ -203,7 +202,6 @@ server.") (status . "Status") (priority . "Priority")) "Mapping between field symbols and RT field strings. - The field symbols provide the programmer with a consistent way of referring to RT fields.") @@ -213,14 +211,12 @@ referring to RT fields.") (open . "open") (new . "new")) "Mapping between status symbols and status strings. - The status symbols provide the programmer with a consistent way of referring to certain statuses. The status strings are the server specific strings.") (defvar rt-liber-debug-log-enable nil "If t then enable logging of communication to a buffer. - Careful! This might create a sizable buffer.") (defvar rt-liber-debug-log-buffer-name "*rt-liber debug log*" @@ -228,19 +224,16 @@ Careful! This might create a sizable buffer.") (defvar rt-liber-ticket-local nil "Buffer local storage for a ticket. - This variable is made buffer local for the ticket history") (defvar rt-liber-assoc-browser nil "Browser associated with a ticket history. - This variable is made buffer local for the ticket history") ;;; ;;; Debug log ;;; - (defun rt-liber-debug-log-write (str) "Write STR to debug log." (when (not (stringp str)) @@ -254,7 +247,6 @@ This variable is made buffer local for the ticket history") ;;; ;;; TicketSQL compiler ;;; - (defun rt-liber-bool-p (sym) "Return t if SYM is a boolean operator, otherwise nil." (member sym '(and or))) @@ -362,7 +354,6 @@ AFTER date after predicate." ;;; ;;; Parse Answer ;;; - (defun rt-liber-parse-answer (answer-string parser-f) "Operate on ANSWER-STRING with PARSER-F." (with-temp-buffer @@ -377,7 +368,6 @@ AFTER date after predicate." ;;; ;;; Ticket list retriever ;;; - (put 'rt-liber-no-result-from-query-error 'error-conditions '(error rt-liber-errors rt-liber-no-result-from-query-error)) @@ -565,8 +555,6 @@ The ticket's priority is compared to the variable '(face font-lock-comment-face))) (newline)) - - (defun rt-liber-ticketlist-browser-redraw (ticketlist &optional query) "Display TICKETLIST. Optionally display QUERY as well." (erase-buffer) @@ -691,7 +679,6 @@ If POINT is nil then called on (point)." ;;; ;;; Ticket browser sorting ;;; - (defun rt-liber-lex-lessthan-p (a b field) "Return t if A is lexicographically less than B in FIELD." (let ((field-a (cdr (assoc field a)))
[elpa] externals/rt-liberation e7ec418 46/68: * rt-liberation-rest.el: check for a non-empty string
branch: externals/rt-liberation commit e7ec4188d9d9b9f3fe89ec49ea49c510d9e3bd7d Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation-rest.el: check for a non-empty string --- rt-liberation-rest.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rt-liberation-rest.el b/rt-liberation-rest.el index 67b099e..860ff88 100644 --- a/rt-liberation-rest.el +++ b/rt-liberation-rest.el @@ -75,7 +75,9 @@ (defun rt-liber-rest-auth () "Try to get the REST credentials." (if (and (stringp rt-liber-rest-username) - (stringp rt-liber-rest-password)) + (stringp rt-liber-rest-password) + (< 0 (length rt-liber-rest-username)) + (< 0 (length rt-liber-rest-password))) t (message "rt-liber: no REST credentials set, so attempting auth-source") (let ((auth-source-found-p
[elpa] externals/rt-liberation cbfb99c 49/68: * rt-liberation.el: start making sense of section types
branch: externals/rt-liberation commit cbfb99c308c09808386c34467530388b7dc9b62e Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation.el: start making sense of section types --- rt-liberation.el | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index 1adee43..9e759dc 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -1332,28 +1332,43 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (creator (alist-get 'Creator section)) (date (alist-get 'Created section)) (type (alist-get 'Type section)) - (content (alist-get 'Content section))) + (content (alist-get 'Content section)) + (oldvalue (alist-get 'OldValue section)) + (newvalue (alist-get 'NewValue section)) + (field (alist-get 'Field section))) (let ((start (point))) (insert - (format "Ticket %s by %s on %s (-N- days ago) (%s)\n" + (format "Ticket %s by %s on %s (-N- days ago) (%s)%s\n" ticket-id creator date - type)) + type + (if (and (string= type "Set") + (string= field "Owner")) + " (owner change)" +""))) (add-text-properties start (point) `(font-lock-face rt-liber-ticket-emph-face)) (add-text-properties start (point) `(rt-liberation-viewer-header t))) -(cond ((or (string= type "Status") - (string= type "CustomField") - ;; (string= type "EmailRecord") - (string= type "Set")) - 'nop-for-now) - (t (insert - (format "\n%s\n" - (rt-liber-viewer2-format-content content))) +(cond ((or (string= type "CustomField") + (string= type "EmailRecord") + (string= type "Set") + (string= type "SetWatcher")) + (insert + (format "\n" field oldvalue newvalue))) + ((string= type "Status") + (insert + (format "\n%s: %s -> %s\n" field oldvalue newvalue))) + ((or (string= type "Create") + (string= type "Comment") + (string= type "CommentEmailRecord")) + + (insert + (format "\n%s\n" + (rt-liber-viewer2-format-content content))) (defun rt-liber-viewer2-display-history (contents) (let ((section-list (rt-liber-viewer-parse-history contents)))
[elpa] externals/rt-liberation a99fc59 59/68: * rt-liberation.el: high recenter
branch: externals/rt-liberation commit a99fc59d344d3819972f87674bf93f90ca0d7c03 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation.el: high recenter --- rt-liberation.el | 27 ++- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index 8b6103c..3c2962f 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -240,6 +240,12 @@ This variable is made buffer local for the ticket history") :type 'string :group 'rt-liber-gnus) +(defvar rt-liber-display-ticket-at-point-f 'rt-liber-viewer2-display-ticket-at-point + "Function for displaying ticket at point in the browser.") + +(defvar rt-liber-viewer2-recenter 4 + "Argument passed to `recenter' in the viewer.") + ;;; ;;; Debug log @@ -655,6 +661,11 @@ If POINT is nil then called on (point)." (let ((ticket-alist (get-text-property (point) 'rt-ticket))) (rt-liber-display-ticket-history ticket-alist (current-buffer +(defun rt-liber-ticket-at-point () + "Display the contents of the ticket at point." + (interactive) + (funcall rt-liber-display-ticket-at-point-f)) + (defun rt-liber-browser-search (id) "Return point where ticket with ID is displayed or nil." (let ((p nil)) @@ -796,7 +807,7 @@ returned as no associated text properties." (define-key map (kbd "q") 'rt-liber-browser-mode-quit) (define-key map (kbd "n") 'rt-liber-next-ticket-in-browser) (define-key map (kbd "p") 'rt-liber-previous-ticket-in-browser) -(define-key map (kbd "RET") 'rt-liber-display-ticket-at-point) +(define-key map (kbd "RET") 'rt-liber-ticket-at-point) (define-key map (kbd "g") 'revert-buffer) (define-key map (kbd "G") 'rt-liber-browser-refresh-and-return) (define-key map (kbd "a") 'rt-liber-browser-assign) @@ -1211,6 +1222,10 @@ ASSOC-BROWSER if non-nil should be a ticket browser." ;;; -- ;;; viewer2 ;;; -- + +;; Comment: The goal is to eventually break this code away to its own +;; file. + (defface rt-liber-ticket-emph-face 'class color) (background dark)) (:foreground "gray53")) @@ -1510,9 +1525,10 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (let ((next (next-single-property-change (point) 'rt-liberation-viewer-header))) -(if next - (goto-char next) - (message "no next section" +(if (not next) + (message "no next section") + (goto-char next) + (recenter rt-liber-viewer2-recenter (defun rt-liber-viewer2-previous-section-in () (interactive) @@ -1522,7 +1538,8 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (if (not prev) (message "no previous section") (goto-char prev) - (forward-line -1 + (forward-line -1) + (recenter rt-liber-viewer2-recenter (defun rt-liber-viewer2-answer () (interactive)
[elpa] externals/rt-liberation fd1e4a9 61/68: * rt-liberation.el: add jump to last section
branch: externals/rt-liberation commit fd1e4a9e61445706d700ee67dd92a8b77911526e Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation.el: add jump to last section --- rt-liberation.el | 12 1 file changed, 12 insertions(+) diff --git a/rt-liberation.el b/rt-liberation.el index d708f43..1117889 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -1535,6 +1535,17 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (recenter rt-liber-viewer2-recenter))) (goto-char (point-at-bol +(defun rt-liber-viewer2-last-section-in () + (interactive) + (goto-char (point-max)) + (let ((last (re-search-backward rt-liber-viewer2-section-regexp + (point-min) + t))) +(if (not last) + (error "no sections found") + (recenter rt-liber-viewer2-recenter) + (goto-char (point-at-bol) + (defun rt-liber-viewer2-previous-section-in () (interactive) (when (looking-at rt-liber-viewer2-section-regexp) @@ -1575,6 +1586,7 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (defconst rt-liber-viewer2-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "q") 'rt-liber-viewer2-mode-quit) +(define-key map (kbd "N") 'rt-liber-viewer2-last-section-in) (define-key map (kbd "n") 'rt-liber-viewer2-next-section-in) (define-key map (kbd "p") 'rt-liber-viewer2-previous-section-in) (define-key map (kbd "V") 'rt-liber-viewer-visit-in-browser)
[elpa] externals/rt-liberation 35f4cd5 66/68: * doc/developer-release.txt:
branch: externals/rt-liberation commit 35f4cd559b93acb458b6bc4d394a65cea91d4998 Author: Yoni Rabkin Commit: Yoni Rabkin * doc/developer-release.txt: --- doc/developer-release.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/developer-release.txt b/doc/developer-release.txt index 484938d..e15282c 100644 --- a/doc/developer-release.txt +++ b/doc/developer-release.txt @@ -38,4 +38,4 @@ Then push that tag to the VCS: * ELPA Push the changes to externals/rt-liberation on elpa.git with: -$ git push elpa elpa:externals/rt-liberation +$ git push elpa elpa:refs/heads/externals/rt-liberation
[elpa] externals/rt-liberation 965be87 05/68: fix broken dependencies
branch: externals/rt-liberation commit 965be87719ab40ef57e8f37fda85c5851bd92e6f Author: Yoni Rabkin Commit: Yoni Rabkin fix broken dependencies --- rt-liberation-rest.el | 38 -- rt-liberation.el | 36 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/rt-liberation-rest.el b/rt-liberation-rest.el index 9b18974..0b52211 100644 --- a/rt-liberation-rest.el +++ b/rt-liberation-rest.el @@ -175,24 +175,6 @@ (re-search-forward rt-ok-regexp (point-max))) (error "bad HTTP response from server" -(defun rt-liber-rest-ticketsql-runner-parser-f () - "Parser function for a textual list of tickets." - (let (idsub-list) -(rt-liber-rest-parse-http-header) -(while (re-search-forward "ticket/\\([0-9].+\\)" (point-max) t) - ;; the output should be compatible with the input to - ;; `rt-liber-create-tickets-string' - (push (list (match-string-no-properties 1) - ".") - idsub-list)) -idsub-list)) - -(defun rt-liber-rest-run-ls-query (query) - "Run an \"ls\" type query against the server with QUERY." - (rt-liber-parse-answer - (rt-liber-rest-query-runner "ls" query) - 'rt-liber-rest-ticketsql-runner-parser-f)) - (defun rt-liber-rest-show-process (response) "Process and return the show query response." (when (not (stringp response)) @@ -227,20 +209,6 @@ (message "done retrieving %d tickets" l))) (buffer-substring (point-min) (point-max -(defun rt-liber-rest-run-show-base-query (idsublist) - "Run \"show\" type query against the server with IDSUBLIST." - (rt-liber-parse-answer - (rt-liber-rest-show-query-runner idsublist) - #'rt-liber-ticket-base-retriever-parser-f)) - -(defun rt-liber-rest-run-ticket-history-base-query (ticket-id) - "Run history query against server for TICKET-ID." - (rt-liber-parse-answer - (rt-liber-rest-query-runner "history" ticket-id) - #'(lambda () - (rt-liber-rest-parse-http-header) - (buffer-substring (point) (point-max) - (defun rt-liber-rest-handle-response (buffer) "Handle the response provided in BUFFER." (with-current-buffer rt-liber-rest-response-buffer @@ -269,12 +237,6 @@ (rt-liber-rest-handle-response rt-liber-rest-response-buffer))) (message "edit command ended at %s" (current-time-string))) -(defun rt-liber-rest-command-set (id field status) - "Set ticket ID status to be STATUS." - (rt-liber-parse-answer - (rt-liber-rest-edit-runner id field status) - 'rt-liber-command-runner-parser-f)) - (provide 'rt-liberation-rest) diff --git a/rt-liberation.el b/rt-liberation.el index aa48cea..ddd6900 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -396,6 +396,42 @@ AFTER date after predicate." continue t)) ticketbase-list)) +(defun rt-liber-rest-ticketsql-runner-parser-f () + "Parser function for a textual list of tickets." + (let (idsub-list) +(rt-liber-rest-parse-http-header) +(while (re-search-forward "ticket/\\([0-9].+\\)" (point-max) t) + (push (list (match-string-no-properties 1) + ".") + idsub-list)) +idsub-list)) + +(defun rt-liber-rest-run-ls-query (query) + "Run an \"ls\" type query against the server with QUERY." + (rt-liber-parse-answer + (rt-liber-rest-query-runner "ls" query) + 'rt-liber-rest-ticketsql-runner-parser-f)) + +(defun rt-liber-rest-run-show-base-query (idsublist) + "Run \"show\" type query against the server with IDSUBLIST." + (rt-liber-parse-answer + (rt-liber-rest-show-query-runner idsublist) + #'rt-liber-ticket-base-retriever-parser-f)) + +(defun rt-liber-rest-run-ticket-history-base-query (ticket-id) + "Run history query against server for TICKET-ID." + (rt-liber-parse-answer + (rt-liber-rest-query-runner "history" ticket-id) + #'(lambda () + (rt-liber-rest-parse-http-header) + (buffer-substring (point) (point-max) + +(defun rt-liber-rest-command-set (id field status) + "Set ticket ID status to be STATUS." + (rt-liber-parse-answer + (rt-liber-rest-edit-runner id field status) + 'rt-liber-command-runner-parser-f)) + ;;; ;;; Ticket utilities
[elpa] externals/rt-liberation 4e4cb06 14/68: add manual to ELPA
branch: externals/rt-liberation commit 4e4cb0625df373243a4bc4262934b2e541c4dd04 Author: Yoni Rabkin Commit: Yoni Rabkin add manual to ELPA --- dir| 18 + rt-liberation.info | 2042 2 files changed, 2060 insertions(+) diff --git a/dir b/dir new file mode 100644 index 000..cdd36a0 --- /dev/null +++ b/dir @@ -0,0 +1,18 @@ +This is the file .../info/dir, which contains the +topmost node of the Info hierarchy, called (dir)Top. +The first time you invoke Info you start off looking at this node. + +File: dir, Node: Top This is the top of the INFO tree + + This (the Directory node) gives a menu of major topics. + Typing "q" exits, "?" lists all Info commands, "d" returns here, + "h" gives a primer for first-timers, + "mEmacs" visits the Emacs manual, etc. + + In Emacs, you can click mouse button 2 on a menu item or cross reference + to select it. + +* Menu: + +Emacs +* rt-liberation: (rt-liber).rt-liberation diff --git a/rt-liberation.info b/rt-liberation.info new file mode 100644 index 000..025c27c --- /dev/null +++ b/rt-liberation.info @@ -0,0 +1,2042 @@ +This is rt-liberation.info, produced by makeinfo version 6.1 from +rt-liberation.texinfo. + +(C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2020 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled "GNU Free Documentation License". +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* rt-liberation: (rt-liber). rt-liberation +END-INFO-DIR-ENTRY + + +File: rt-liberation.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) + +The rt-liberation Manual + + +This is the Manual for the rt-liberation system + + (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2020 Free Software +Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.2 or any later version published by the Free Software + Foundation; with no Invariant Sections, no Front-Cover Texts, and + no Back-Cover Texts. A copy of the license is included in the + section entitled "GNU Free Documentation License". + +* Menu: + +* Introduction::Introduction to rt-liberation. +* Installation::Setup rt-liberation to work on the system. + +Using rt-liberation +* Queries:: Retrieve particular tickets from the server. +* Ticket Browser:: Browse the query results. +* Ticket Viewer:: Interface to query results. + +Extensions +* Gnus Integration::Sending email to the RT server via Gnus. +* Tracking Updates::Keeping up to date with ticket changes. +* Batch Operations::Performing operations on batches of tickets. +* Local Storage:: Associate arbitrary data with tickets. + +Copying and license +* Copying:: The GNU General Public License gives you +permission to redistribute rt-liberation +on certain terms; it also explains that +there is no warranty. + +* The GNU FDL:: The license for this documentation. + +Indices +* Concept Index:: +* Function Index:: +* Variable Index:: +* Keybinding Index:: + + -- The Detailed Node Listing -- + +Queries + +* Query Compiler:: Compiling Emacs Lisp to TicketSQL. +* Query Language:: A description of the Sexp-based language. + +Ticket Browser + +* Ticket Browser Display:: How tickets are displayed in the browser. +* Ticket Browser Sorting:: How tickets are sorted in the browser. +* Ticket Browser Filtering::How to filter tickets out of the browser. +* Multiple Ticket Browsers::More than one ticket browser buffer. + + + +File: rt-liberation.info, Node: Introduction, Next: Installation, Up: Top + +1 Introduction +** + +rt-liberation is a GNU/Emacs package for working with the Request +Tracker (henceforth abbreviated as just "RT") software from Best +Practical Solutions. RT has an interactive Web interface, a command +line interface (the "RT CLI"), and a REST interface. rt-liberation uses +the RT REST interface to communicate with the RT server. + + rt-liberation allows sending search queries to the RT server, +browsing the resulting tickets, viewing the tickets' contents and +performing operations on the tickets. + + +File: rt-liberation.info, Node: Installation, Next: Queries, Prev: Introduction, Up: Top + +2 Installation +** + +rt-liberati
[elpa] externals/rt-liberation ed929f5 16/68: integrate changes post-ELPA synchronization
branch: externals/rt-liberation commit ed929f51cba59b04885938aa19f01a31f80aa52e Author: Yoni Rabkin Commit: Yoni Rabkin integrate changes post-ELPA synchronization --- rt-liberation-rest.el | 46 +- rt-liberation.el | 132 ++ 2 files changed, 39 insertions(+), 139 deletions(-) diff --git a/rt-liberation-rest.el b/rt-liberation-rest.el index 7782665..99f6ce9 100644 --- a/rt-liberation-rest.el +++ b/rt-liberation-rest.el @@ -20,9 +20,7 @@ ;; License along with this program; if not, write to the Free ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ;; MA 02111-1307, USA. -;; -;; Note: Licensed under GPLv2+ and not GPLv3+ in order to be -;; compatible with the license of RT. + ;;; History: ;; @@ -33,9 +31,7 @@ (require 'url) (require 'url-util) -;; (require 'rt-liberation) ; FIXME: Circular dependency -(declare-function rt-liber-parse-answer "rt-liberation" (answer-string parser-f)) -(declare-function rt-liber-ticket-base-retriever-parser-f "rt-liberation" ()) + (defvar rt-liber-rest-debug-buffer-name "*rt-liber-rest debug log*" "Buffer name of debug capture.") @@ -176,24 +172,6 @@ (re-search-forward rt-ok-regexp (point-max))) (error "bad HTTP response from server" ;FIXME: Unused string! -(defun rt-liber-rest-ticketsql-runner-parser-f () - "Parser function for a textual list of tickets." - (let (idsub-list) -(rt-liber-rest-parse-http-header) -(while (re-search-forward "ticket/\\([0-9].+\\)" (point-max) t) - ;; the output should be compatible with the input to - ;; `rt-liber-create-tickets-string' - (push (list (match-string-no-properties 1) - ".") - idsub-list)) -idsub-list)) - -(defun rt-liber-rest-run-ls-query (query) - "Run an \"ls\" type query against the server with QUERY." - (rt-liber-parse-answer - (rt-liber-rest-query-runner "ls" query) - 'rt-liber-rest-ticketsql-runner-parser-f)) - (defun rt-liber-rest-show-process (response) "Process and return the show query response." (when (not (stringp response)) @@ -228,20 +206,6 @@ (message "done retrieving %d tickets" l))) (buffer-substring (point-min) (point-max -(defun rt-liber-rest-run-show-base-query (idsublist) - "Run \"show\" type query against the server with IDSUBLIST." - (rt-liber-parse-answer - (rt-liber-rest-show-query-runner idsublist) - #'rt-liber-ticket-base-retriever-parser-f)) - -(defun rt-liber-rest-run-ticket-history-base-query (ticket-id) - "Run history query against server for TICKET-ID." - (rt-liber-parse-answer - (rt-liber-rest-query-runner "history" ticket-id) - #'(lambda () - (rt-liber-rest-parse-http-header) - (buffer-substring (point) (point-max) - (defun rt-liber-rest-handle-response (buffer) "Handle the response provided in BUFFER." (with-current-buffer buffer @@ -270,12 +234,6 @@ (rt-liber-rest-handle-response response-buffer))) (message "edit command ended at %s" (current-time-string))) -(defun rt-liber-rest-command-set (id field status) - "Set ticket ID status to be STATUS." - (rt-liber-parse-answer - (rt-liber-rest-edit-runner id field status) - 'rt-liber-command-runner-parser-f)) - (provide 'rt-liberation-rest) diff --git a/rt-liberation.el b/rt-liberation.el index 3f6133f..6649bb0 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -395,20 +395,41 @@ AFTER date after predicate." continue t)) ticketbase-list)) -;; accept the output of `rt-liber-ticketsql-runner-parser-f' and -;; return a string suitable for an RT "show" query -(defun rt-liber-create-tickets-string (idsublist) - "Create a RT CLI ticket \"show\" string from IDSUBLIST." - (let ((ticket-list (mapcar #'(lambda (e) (car e)) idsublist))) -(if ticket-list - (concat "ticket/" - (if (= (length ticket-list) 1) - (format "%s" (car ticket-list)) - (cl-reduce - #'(lambda (a b) - (format "%s,%s" a b)) - ticket-list))) - (signal 'rt-liber-no-result-from-query-error nil +(defun rt-liber-rest-ticketsql-runner-parser-f () + "Parser function for a textual list of tickets." + (let (idsub-list) +(rt-liber-rest-parse-http-header) +(while (re-search-forward "ticket/\\([0-9].+\\)" (point-max) t) + (push (list (match-string-no-properties 1) + ".") + idsub-list)) +idsub-list)) + +(defun rt-liber-rest-run-ls-query (query) + "Run an \"ls\" type query against the server with QUERY." + (rt-liber-parse-answer + (rt-liber-rest-query-runner "ls" query) + 'rt-liber-rest-ticketsql-runner-parser-f)) + +(defun rt-liber-rest-run-show-base-query (idsublist) + "Run \"show\" type query against the server with IDSUBLIST." + (rt-liber-parse-answer + (rt-liber-rest-show-query-runner idsublist) + #'rt-liber-ticket-base-retrieve
[elpa] externals/rt-liberation 291a8e3 20/68: move to other machine
branch: externals/rt-liberation commit 291a8e377fab357a99772f814c48075d0e06a028 Author: Yoni Rabkin Commit: Yoni Rabkin move to other machine --- NEWS | 5 + doc/developer-release.txt | 28 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 9a75035..312281f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +New in version 1.31 + +* + + New in version 1.0: * Upgrade to GPLv3 (with the kind permission of the people from diff --git a/doc/developer-release.txt b/doc/developer-release.txt index e976f0b..bab477d 100644 --- a/doc/developer-release.txt +++ b/doc/developer-release.txt @@ -1,13 +1,37 @@ -*- outline -*- -* Notes for preparing a release for rt-liberation +This is an outline of how to make a release for rt-liberation via GNU +ELPA. -** Version +* version In order for the ELPA system to trigger a release the version number in the comment header of rt-liberation.el must be incremented. +* NEWS +Update the NEWS file to tell all of the people the Good News. + + +* push +Push these updates to the git repo. + + +* tag +Tag the release with the ELPA version number: + +$ git tag -a 1.31 -m "1.31" + +Then push that tag to the VCS: + + $ git push --tags origin "1.31" + + +* documentation +Update the manual, compile it, and update the copy of the info file in +the root directory so that ELPA can install it. + + ** Info After each manual update the info file needs to be copied into the root of the project so that ELPA can pick it up.
[elpa] externals/rt-liberation 6098e23 25/68: * rt-liberation-rest.el: add requirement
branch: externals/rt-liberation commit 6098e235bfecff3b21ae0c29d22a28a4ac34f282 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation-rest.el: add requirement --- rt-liberation-rest.el | 1 + 1 file changed, 1 insertion(+) diff --git a/rt-liberation-rest.el b/rt-liberation-rest.el index 6e3409d..fd66341 100644 --- a/rt-liberation-rest.el +++ b/rt-liberation-rest.el @@ -31,6 +31,7 @@ (require 'url) (require 'url-util) +(require 'auth-source) (defvar rt-liber-rest-debug-buffer-name "*rt-liber-rest debug log*"
[elpa] externals/rt-liberation 5648253 17/68: fix info listing problem
branch: externals/rt-liberation commit 564825356cf752c942ade08ca066fb61259abfc7 Author: Yoni Rabkin Commit: Yoni Rabkin fix info listing problem --- doc/rt-liberation.texinfo | 2 +- rt-liberation.info| 46 +++--- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/rt-liberation.texinfo b/doc/rt-liberation.texinfo index 111cfb8..6840a39 100644 --- a/doc/rt-liberation.texinfo +++ b/doc/rt-liberation.texinfo @@ -9,7 +9,7 @@ @dircategory Emacs @direntry -* rt-liberation: (rt-liber). rt-liberation +* rt-liberation: (rt-liberation). Emacs Interface to Request Tracker @end direntry diff --git a/rt-liberation.info b/rt-liberation.info index 025c27c..29153a6 100644 --- a/rt-liberation.info +++ b/rt-liberation.info @@ -12,7 +12,7 @@ Foundation, Inc. section entitled "GNU Free Documentation License". INFO-DIR-SECTION Emacs START-INFO-DIR-ENTRY -* rt-liberation: (rt-liber). rt-liberation +* rt-liberation: (rt-liberation). Emacs Interface to Request Tracker END-INFO-DIR-ENTRY @@ -2016,27 +2016,27 @@ Keybinding Index Tag Table: -Node: Top689 -Node: Introduction2970 -Node: Installation3582 -Node: Queries4566 -Node: Query Compiler5133 -Node: Query Language5779 -Node: Ticket Browser8223 -Node: Ticket Browser Display10700 -Node: Ticket Browser Sorting12696 -Node: Ticket Browser Filtering14651 -Node: Multiple Ticket Browsers16199 -Node: Ticket Viewer17373 -Node: Gnus Integration19550 -Node: Tracking Updates21843 -Node: Batch Operations22925 -Node: Local Storage24110 -Node: Copying25193 -Node: The GNU FDL62747 -Node: Concept Index85144 -Node: Function Index86730 -Node: Variable Index90085 -Node: Keybinding Index90466 +Node: Top715 +Node: Introduction2996 +Node: Installation3608 +Node: Queries4592 +Node: Query Compiler5159 +Node: Query Language5805 +Node: Ticket Browser8249 +Node: Ticket Browser Display10726 +Node: Ticket Browser Sorting12722 +Node: Ticket Browser Filtering14677 +Node: Multiple Ticket Browsers16225 +Node: Ticket Viewer17399 +Node: Gnus Integration19576 +Node: Tracking Updates21869 +Node: Batch Operations22951 +Node: Local Storage24136 +Node: Copying25219 +Node: The GNU FDL62773 +Node: Concept Index85170 +Node: Function Index86756 +Node: Variable Index90111 +Node: Keybinding Index90492 End Tag Table
[elpa] externals/rt-liberation 237b11d 30/68: * rt-liberation-viewer.el: reorganize
branch: externals/rt-liberation commit 237b11d4507ee8b1208cab40eddf9d2c6747a183 Author: Yoni Rabkin Commit: Yoni Rabkin * rt-liberation-viewer.el: reorganize --- rt-liberation-viewer.el | 69 ++--- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/rt-liberation-viewer.el b/rt-liberation-viewer.el index e3b6309..bc0e15d 100644 --- a/rt-liberation-viewer.el +++ b/rt-liberation-viewer.el @@ -36,37 +36,14 @@ "Type: " "Field: " "OldValue: " "NewValue: " "Data: " "Description: " "Created: " -"Creator: " "Attachments: ") t))) +"Creator: " "Attachments: ") + t))) (list (list (concat "^" header-regexp ".*$") 0 'font-lock-comment-face))) "Expressions to font-lock for RT ticket viewer.") -(defun rt-liber-jump-to-latest-correspondence () - "Move point to the newest correspondence section." - (interactive) - (let (latest-point) -(save-excursion - (goto-char (point-max)) - (when (re-search-backward rt-liber-correspondence-regexp - (point-min) t) - (setq latest-point (point -(if latest-point - (progn - (goto-char latest-point) - (rt-liber-next-section-in-viewer)) - (message "no correspondence found" - -(defun rt-liber-viewer-visit-in-browser () - "Visit this ticket in the RT Web interface." - (interactive) - (let ((id (rt-liber-ticket-id-only rt-liber-ticket-local))) -(if id - (browse-url -(concat rt-liber-base-url "Ticket/Display.html?id=" id)) - (error "no ticket currently in view" - (defun rt-liber-display-ticket-history (ticket-alist &optional assoc-browser) "Display history for ticket. @@ -93,6 +70,34 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (setq buffer-read-only t))) (switch-to-buffer new-ticket-buffer))) + +;;; -- +;;; viewer mode functions +;;; -- +(defun rt-liber-jump-to-latest-correspondence () + "Move point to the newest correspondence section." + (interactive) + (let (latest-point) +(save-excursion + (goto-char (point-max)) + (when (re-search-backward rt-liber-correspondence-regexp + (point-min) t) + (setq latest-point (point +(if latest-point + (progn + (goto-char latest-point) + (rt-liber-next-section-in-viewer)) + (message "no correspondence found" + +(defun rt-liber-viewer-visit-in-browser () + "Visit this ticket in the RT Web interface." + (interactive) + (let ((id (rt-liber-ticket-id-only rt-liber-ticket-local))) +(if id + (browse-url +(concat rt-liber-base-url "Ticket/Display.html?id=" id)) + (error "no ticket currently in view" + (defun rt-liber-viewer-mode-quit () "Bury the ticket viewer." (interactive) @@ -129,6 +134,13 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (message "no previous section")) (goto-char (point-at-bol))) +(defun rt-liber-refresh-ticket-history (&optional _ignore-auto _noconfirm) + (interactive) + (if rt-liber-ticket-local + (rt-liber-display-ticket-history rt-liber-ticket-local + rt-liber-assoc-browser) +(error "not viewing a ticket"))) + (defconst rt-liber-viewer-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "q") 'rt-liber-viewer-mode-quit) @@ -165,15 +177,8 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (rt-liber-jump-to-latest-correspondence)) (run-hooks 'rt-liber-viewer-hook)) -(defun rt-liber-refresh-ticket-history (&optional _ignore-auto _noconfirm) - (interactive) - (if rt-liber-ticket-local - (rt-liber-display-ticket-history rt-liber-ticket-local - rt-liber-assoc-browser) -(error "not viewing a ticket"))) ;; wrapper functions around specific functions provided by a backend - (declare-function rt-liber-gnus-compose-reply-to-requestor "rt-liberation-gnus.el")