From: João Távora Date: Thu, 10 May 2018 11:54:35 +0000 (+0100) Subject: Simplify mode-line updating logic X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~596 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f0d4e043b130d9dfaf125957194e4c75111f0773;p=emacs.git Simplify mode-line updating logic * eglot.el (eglot--define-process-var): Simplify. (eglot--short-name, eglot--spinner, eglot--status): Don't auto-update mode-line. (eglot--process-receive): Update it here. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 1ba5324de93..bf0b9e9271e 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -78,11 +78,9 @@ (if (project-current) "" " (Also no current project)")))) (defmacro eglot--define-process-var - (var-sym initval &optional doc mode-line-update-p) + (var-sym initval &optional doc) "Define VAR-SYM as a generalized process-local variable. -INITVAL is the default value. DOC is the documentation. -MODE-LINE-UPDATE-P says to also force a mode line update -after setting it." +INITVAL is the default value. DOC is the documentation." (declare (indent 2)) `(progn (put ',var-sym 'function-documentation ,doc) @@ -94,16 +92,11 @@ after setting it." (let ((def ,initval)) (process-put proc ',var-sym def) def)))) - (gv-define-setter ,var-sym (to-store &optional process) - (let* ((prop ',var-sym)) - ,(let ((form '(let ((proc (or ,process (eglot--current-process-or-lose)))) - (process-put proc ',prop ,to-store)))) - (if mode-line-update-p - `(backquote (prog1 ,form (force-mode-line-update t))) - `(backquote ,form))))))) + (gv-define-setter ,var-sym (to-store process) + `(let ((once ,to-store)) (process-put ,process ',',var-sym once) once)))) (eglot--define-process-var eglot--short-name nil - "A short name for the process" t) + "A short name for the process") (eglot--define-process-var eglot--major-mode nil "The major-mode this server is managing.") @@ -128,11 +121,11 @@ after setting it." (eglot--define-process-var eglot--spinner `(nil nil t) "\"Spinner\" used by some servers. -A list (ID WHAT DONE-P)." t) +A list (ID WHAT DONE-P).") (eglot--define-process-var eglot--status `(:unknown nil) "Status as declared by the server. -A list (WHAT SERIOUS-P)." t) +A list (WHAT SERIOUS-P).") (eglot--define-process-var eglot--contact nil "Method used to contact a server. @@ -531,7 +524,8 @@ is a symbol saying if this is a client or server originated." (apply (cl-first continuations) res) (funcall (cl-first continuations) res))))) (id - (eglot--warn "Ooops no continuation for id %s" id))))) + (eglot--warn "Ooops no continuation for id %s" id))) + (force-mode-line-update t))) (defvar eglot--expect-carriage-return nil)