emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/idris-mode a971194d56 14/18: Merge pull request #582 from


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode a971194d56 14/18: Merge pull request #582 from keram/notes-error-buffer-code-cleanup
Date: Thu, 8 Dec 2022 05:59:08 -0500 (EST)

branch: elpa/idris-mode
commit a971194d568c54d1d7d4f7a966f02e700b83bab3
Merge: b39a08790e 68fe8e115f
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #582 from keram/notes-error-buffer-code-cleanup
    
    Make idris-compiler-notes-mode derived from special-mode and
---
 idris-commands.el      | 11 +++++++----
 idris-warnings-tree.el | 48 ++++++++++++++++++++----------------------------
 inferior-idris.el      |  5 ++---
 3 files changed, 29 insertions(+), 35 deletions(-)

diff --git a/idris-commands.el b/idris-commands.el
index f69f2d00b6..780fb65505 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -252,10 +252,7 @@ A prefix argument forces loading but only up to the 
current line."
                   (idris-update-loaded-region result))))
            (lambda (_condition)
              (when (member 'warnings-tree idris-warnings-printing)
-               (idris-list-compiler-notes)
-               (if idris-stay-in-current-window-on-compiler-error
-                 (display-buffer idris-notes-buffer-name)
-                 (pop-to-buffer idris-notes-buffer-name)))))))
+               (idris-list-compiler-notes))))))
     (error "Cannot find file for current buffer")))
 
 (defun idris-view-compiler-log ()
@@ -927,6 +924,12 @@ type-correct, so loading will fail."
   (interactive)
   (idris-hole-list-show (car (idris-eval '(:metavariables 80)))))
 
+(defun idris-list-compiler-notes ()
+  "Show the compiler notes in tree view."
+  (interactive)
+  (with-temp-message "Preparing compiler note tree..."
+    (idris-compiler-notes-list-show (reverse idris-raw-warnings))))
+
 (defun idris-kill-buffers ()
   (idris-warning-reset-all)
   (setq idris-currently-loaded-buffer nil)
diff --git a/idris-warnings-tree.el b/idris-warnings-tree.el
index 4f897efd39..2236e8b417 100644
--- a/idris-warnings-tree.el
+++ b/idris-warnings-tree.el
@@ -33,32 +33,24 @@
 (require 'idris-common-utils)
 
 (defvar idris-notes-buffer-name (idris-buffer-name :notes)
-  "The name of the buffer containing Idris errors")
-
-(defun idris-list-compiler-notes ()
-  "Show the compiler notes in tree view."
-  (interactive)
-  (with-temp-message "Preparing compiler note tree..."
-    (let ((notes (reverse idris-raw-warnings))
-          (buffer (get-buffer-create idris-notes-buffer-name)))
-      (with-current-buffer buffer
-        (idris-compiler-notes-mode)
-        (setq buffer-read-only nil)
-        (erase-buffer)
-        (if (null notes)
-            nil
-          (let ((root (idris-compiler-notes-to-tree notes)))
-            (idris-tree-insert root "")
-            (insert "\n")
-            (message "Press q to close, return or mouse on error to navigate 
to source")
-            (setq buffer-read-only t)
-            (goto-char (point-min))
-            notes
-            (display-buffer idris-notes-buffer-name)
-          ))))))
+  "The name of the buffer containing Idris errors.")
 
 (defvar idris-tree-printer 'idris-tree-default-printer)
 
+(defun idris-compiler-notes-list-show (notes)
+  (if (null notes)
+      nil ;; See https://github.com/idris-hackers/idris-mode/pull/148 TODO: 
revisit
+    (with-current-buffer (get-buffer-create idris-notes-buffer-name)
+      (idris-compiler-notes-mode)
+      (let ((buffer-read-only nil)
+            (root (idris-compiler-notes-to-tree notes)))
+        (erase-buffer)
+        (idris-tree-insert root "")
+        (insert "\n\n")
+        (message "Press q to close, return or mouse on error to navigate to 
source")
+        (goto-char (point-min))))
+    (display-buffer idris-notes-buffer-name)))
+
 (defun idris-tree-for-note (note)
   (let* ((buttonp (> (length (nth 0 note)) 0)) ;; if empty source location
          (button-text `(,(format "%s line %s col %s:" (nth 0 note) (nth 1 
note) (nth 2 note))
@@ -82,7 +74,6 @@
 
 (defvar idris-compiler-notes-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "q") 'idris-notes-quit)
     ;;; Allow buttons to be clicked with the left mouse button in the compiler 
notes
     (define-key map [follow-link] 'mouse-face)
     (cl-loop for keyer
@@ -101,11 +92,12 @@
 
 (defun idris-notes-quit ()
   (interactive)
-  (idris-kill-buffer :notes))
+  (idris-kill-buffer idris-notes-buffer-name))
+
 
-(define-derived-mode idris-compiler-notes-mode fundamental-mode 
"Compiler-Notes"
-  "Idris compiler notes
-     \\{idris-compiler-notes-mode-map}
+(define-derived-mode idris-compiler-notes-mode special-mode "Compiler-Notes"
+  "Major mode for displaying Idris compiler notes.
+\\{idris-compiler-notes-mode-map}
 Invokes `idris-compiler-notes-mode-hook'."
   (setq-local prop-menu-item-functions '(idris-context-menu-items)))
 
diff --git a/inferior-idris.el b/inferior-idris.el
index 6f077adde7..02e21d6d86 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -355,7 +355,7 @@ or FAILURE-CONT in failure case."
 (defvar idris-stack-eval-tags nil
   "List of stack-tags of continuations waiting on the stack.")
 
-(autoload 'idris-list-compiler-notes "idris-warnings-tree.el")
+(autoload 'idris-list-compiler-notes "idris-commands.el")
 (defun idris-eval (sexp &optional no-errors)
   "Evaluate EXPR on the inferior Idris and return the result,
 ignoring intermediate output. If `NO-ERRORS' is non-nil, don't
@@ -380,8 +380,7 @@ Idris error."
           (if no-errors
               (throw tag (list #'identity nil))
             (when (member 'warnings-tree idris-warnings-printing)
-              (when (idris-list-compiler-notes)
-                (pop-to-buffer (idris-buffer-name :notes))))
+              (idris-list-compiler-notes))
             (throw tag (list #'error "%s (synchronous Idris evaluation 
failed)" condition)))))
        (let ((debug-on-quit t)
              (inhibit-quit nil))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]