From 5c46df52b1661f0bea70bc84e7ca1846eb1e035a Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Mon, 21 Jan 2019 15:06:35 +0100 Subject: [PATCH] Update magit-todos. Signed-off-by: Andreas Gerler --- .../magit-todos-pkg.el | 2 - .../magit-todos-autoloads.el | 0 .../magit-todos-pkg.el | 2 + .../magit-todos.el | 50 +++++++++++++++++-- 4 files changed, 48 insertions(+), 6 deletions(-) delete mode 100644 elpa/magit-todos-20181220.458/magit-todos-pkg.el rename elpa/{magit-todos-20181220.458 => magit-todos-20190114.1450}/magit-todos-autoloads.el (100%) create mode 100644 elpa/magit-todos-20190114.1450/magit-todos-pkg.el rename elpa/{magit-todos-20181220.458 => magit-todos-20190114.1450}/magit-todos.el (94%) diff --git a/elpa/magit-todos-20181220.458/magit-todos-pkg.el b/elpa/magit-todos-20181220.458/magit-todos-pkg.el deleted file mode 100644 index d405b5da..00000000 --- a/elpa/magit-todos-20181220.458/magit-todos-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "magit-todos" "20181220.458" "Show source file TODOs in Magit" '((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) :commit "4383f95ea434b41131313eadffe77c2fe8369c5d" :keywords '("magit" "vc") :authors '(("Adam Porter" . "adam@alphapapa.net")) :maintainer '("Adam Porter" . "adam@alphapapa.net") :url "http://github.com/alphapapa/magit-todos") diff --git a/elpa/magit-todos-20181220.458/magit-todos-autoloads.el b/elpa/magit-todos-20190114.1450/magit-todos-autoloads.el similarity index 100% rename from elpa/magit-todos-20181220.458/magit-todos-autoloads.el rename to elpa/magit-todos-20190114.1450/magit-todos-autoloads.el diff --git a/elpa/magit-todos-20190114.1450/magit-todos-pkg.el b/elpa/magit-todos-20190114.1450/magit-todos-pkg.el new file mode 100644 index 00000000..dfe52493 --- /dev/null +++ b/elpa/magit-todos-20190114.1450/magit-todos-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "magit-todos" "20190114.1450" "Show source file TODOs in Magit" '((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) :commit "14e5347c98f42166ad7061b8663d368bb0d4fba4" :keywords '("magit" "vc") :authors '(("Adam Porter" . "adam@alphapapa.net")) :maintainer '("Adam Porter" . "adam@alphapapa.net") :url "http://github.com/alphapapa/magit-todos") diff --git a/elpa/magit-todos-20181220.458/magit-todos.el b/elpa/magit-todos-20190114.1450/magit-todos.el similarity index 94% rename from elpa/magit-todos-20181220.458/magit-todos.el rename to elpa/magit-todos-20190114.1450/magit-todos.el index ede0f768..0baf563b 100644 --- a/elpa/magit-todos-20181220.458/magit-todos.el +++ b/elpa/magit-todos-20190114.1450/magit-todos.el @@ -4,7 +4,7 @@ ;; Author: Adam Porter ;; URL: http://github.com/alphapapa/magit-todos -;; Package-Version: 20181220.458 +;; Package-Version: 20190114.1450 ;; Version: 1.2-pre ;; Package-Requires: ((emacs "25.2") (async "1.9.2") (dash "2.13.0") (f "0.17.2") (hl-todo "1.9.0") (magit "2.13.0") (pcre2el "1.8") (s "1.12.0")) ;; Keywords: magit, vc @@ -615,10 +615,13 @@ This function should be called from inside a ‘magit-status’ buffer." ;; Manual updates: Insert section to remind user (let ((magit-insert-section--parent magit-root-section)) (magit-insert-section (todos) - (magit-insert-heading (concat "TODOs (0)" reminder))) + (magit-insert-heading (concat (propertize "TODOs" 'face 'magit-section-heading) + " (0)" reminder))) (insert "\n"))) (let ((section (magit-todos--insert-groups :type 'todos - :heading (format "TODOs (%s)%s" num-items reminder) + :heading (format "%s (%s)%s" + (propertize "TODOs" 'face 'magit-section-heading) + num-items reminder) :group-fns group-fns :items items :depth 0))) @@ -848,11 +851,50 @@ This is a copy of `async-start-process' that does not override (with-current-buffer buf (set-process-query-on-exit-flag proc nil) (set (make-local-variable 'async-callback) finish-func) - (set-process-sentinel proc #'async-when-done) + (set-process-sentinel proc #'magit-todos--async-when-done) (unless (string= name "emacs") (set (make-local-variable 'async-callback-for-process) t)) proc))) +(defun magit-todos--async-when-done (proc &optional _change) + "Process sentinel used to retrieve the value from the child process. + +This is a copy of `async-when-done' that does not raise an error +if the process's buffer has already been deleted." + ;; I wish it weren't necessary to copy this function here, but at the moment it seems like the + ;; only reasonable way to work around this problem of `async-when-done' trying to select deleted + ;; buffers. I already tried not deleting the buffers, but then I got bug reports about that and + ;; had to revert it. I don't know if I'm encountering a bug in my code, in `async', or in Emacs + ;; itself, because it seems that `async-when-done' is being called on the wrong buffers: When I'm + ;; connected with `matrix-client', and when I have a Magit status buffer opened with + ;; `magit-todos-mode' active, then when one of the `url' process buffers from Matrix gets its + ;; sentinel called, I get an error from `async-when-done' trying to select the already-deleted + ;; `rg' scanner buffer! It's as if Emacs is mixing up the process buffers. I really don't know + ;; what's going on. But maybe I can work around it by copying this function and checking whether + ;; the process's buffer is alive. + (when (and (eq 'exit (process-status proc)) + (buffer-live-p (process-buffer proc))) + (with-current-buffer (process-buffer proc) + (let ((async-current-process proc)) + (if (= 0 (process-exit-status proc)) + (if async-callback-for-process + (if async-callback + (prog1 + (funcall async-callback proc) + (unless async-debug + (kill-buffer (current-buffer)))) + (set (make-local-variable 'async-callback-value) proc) + (set (make-local-variable 'async-callback-value-set) t)) + (goto-char (point-max)) + (backward-sexp) + (async-handle-result async-callback (read (current-buffer)) + (current-buffer))) + (set (make-local-variable 'async-callback-value) + (list 'error + (format "Async process '%s' failed with exit code %d" + (process-name proc) (process-exit-status proc)))) + (set (make-local-variable 'async-callback-value-set) t)))))) + ;;;;; Formatters (defun magit-todos--format-plain (item) -- 2.47.3