Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add features: use goal count information printed at top of goals buffer in modeline, clear the goal window when proof is skipped (abort, admitted...). #755

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

axe1d
Copy link

@axe1d axe1d commented Mar 31, 2024

In response to issues #605 and #168, I moved the information of current goal to the goals buffer modeline (to save some space and visibility basically), and cleared the goals buffer when encountering skip proof tactics like Abort. or Admitted. in Coq.

@Matafou
Copy link
Contributor

Matafou commented Apr 3, 2024

The change is nice. A few remarks here and there. 2 questions:

  • should we remove the code that displays this information in the scritpting buffer then?
  • the coq-test-coqtop-unavailable.el fix seems unrelated but real. @hendriktews, @erikmd should we fix this?

@axe1d
Copy link
Author

axe1d commented Apr 3, 2024

The change is nice. A few remarks here and there. 2 questions:

  • should we remove the code that displays this information in the scritpting buffer then?
  • the coq-test-coqtop-unavailable.el fix seems unrelated but real. @hendriktews, @erikmd should we fix this?

Thanks for your answer.

  • For the scripting buffer code process, my method is a bit messy but that was a first idea of solution. I parse the info from the goals buffer, move it to the modeline, and then create an overlay to make the info invisible in the buffer. I could dig more into code to outpass the intermediate processing.
  • For the coq-test-coqtop-unavailable.el test, that is totally unrelated, I just wanted to make sure the project was compiled on my config so I made it break. I should merge my commits for a cleaner PR.
    Don't hesitate if you have other advices of enhancement for this issue.

@@ -18,7 +18,7 @@
(setq coq-prog-name "unavailable-program")

;; ensure coq-prog-name cannot be found
(should (not (locate-file coq-prog-name exec-path)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned earlier, I wanted to appropriate this project by making sure my building was fine, so I broke a simple test first. But now I think my PR should be a bit cleaner.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for?

@hendriktews
Copy link
Collaborator

* the `coq-test-coqtop-unavailable.el` fix seems unrelated but real. @hendriktews, @erikmd should we fix this?

The error is related to this PR, it was introduced in the first commit f6a425f.

@Matafou
Copy link
Contributor

Matafou commented Apr 5, 2024

The PR should first be cleaned up (useless files, then reduced to one commit imho.

@axe1d
Copy link
Author

axe1d commented Apr 7, 2024

The PR should first be cleaned up (useless files, then reduced to one commit imho.

I thank you all for taking the time for reviewing my PR (which is my first ever, that's why it was a bit messy, and I apologize for that). I think it is a bit cleaner, and I welcome any advice on how to improve it before it can be merged (if it's needed of course).

@@ -79,6 +79,63 @@ May enable proof-by-pointing or similar features.
;;
;; Goals buffer processing
;;

;; update *goals* buffer modeline
(defun coq-parse-goals-info (goals-output)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PG is a generic interface for proof assistants, see https://proofgeneral.github.io/doc/master/userman/Introducing-Proof-General/#Introducing-Proof-General, which does not only support Coq, see https://proofgeneral.github.io/doc/master/userman/Introducing-Proof-General/#Supported-proof-assistants . Assistant specific code should therefore go into the assistant specific directory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Matafou Can you recomment where this code should be added in the coq subdir?

(funcall pg-insert-text-function string))
(when (not (string-equal string ""))
(funcall pg-insert-text-function string)
(coq-parse-goals-info string))
Copy link
Collaborator

@hendriktews hendriktews Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure that calling a Coq specific function here will break any other proof assistant. Please add the mode line update to a suitable hook, such that it is only called when PG is instanciated for Coq.

@@ -1486,6 +1486,7 @@ Besides stuff that is not yet documented here, this function
and sections.
- enters some commands and their spans in some database (with for
me unknown purpose)"
(reset-goals-modeline) ; Erase goal buffer when a proof is closed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here is inconsistent with your documentation of reset-goals-modeline.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this call does not break other assistants, but it should not be called for all assistants. Please check if you can find a suitable hook to add this call.

@hendriktews
Copy link
Collaborator

I have the impression that the "clear goal window" part that is mentioned in the title of this PR is not present in the patch anymore. Can you confirm this? (I also suspect that this aspect did not work in your previous version, at least not for Admitted, as I don't remember that you have changed that the goals-reset-after-admitted is expected to fail, as it was before I merged PR #748 -- but I guess this suspicion is completely irrelevant now.)

@hendriktews
Copy link
Collaborator

I am not convinced every user will be fond of this change. The mode line is usually crowded and often it is truncated and some parts are not visible. Maybe this change should therefore be customizable, @erikmd @Matafou what is your opinion here?

@Matafou
Copy link
Contributor

Matafou commented Apr 16, 2024

My opinion is that everything should be customizable, but I don't always apply it to myself. I think the current goal counter (on the scripting buffer) is not customizable either.

@axe1d
Copy link
Author

axe1d commented Apr 18, 2024

Hi everyone, I modified my feature for Coq-only implementation, moved my functions to the coq subdir, and adapted the modeline update only when PG is instantiated for Coq. My goal here is to offer the possibility to users to custom the modeline as mentioned in #605. I thank you all again for this precise review of my code.

@Matafou
Copy link
Contributor

Matafou commented Sep 5, 2024

I have been thinking about this PR a bit more and I think we should not merge it.

  1. This feature (having the number of goals in the modeline) already exists: the number of goals is already printed in the modeline of the script buffer. If we want to move it to the goals buffer we should reuse and modify/clean/optionalize the existing code.

See

PG/coq/coq.el

Line 3121 in 734bcdb

(defvar coq-modeline-string2 ")")
and following, in particular the line:

(add-hook 'proof-shell-handle-delayed-output-hook #'coq-update-minor-mode-alist)

Feel free to submit a new PR adapting this part of the code.

  1. The "clear buffer" stuff should go in a separate PR.

Remark on the code: Testing the name of the prover in the generic code is not the way PG is supposed to be configured. Specific provers should not appear in the generic part.

If noone object I shll close this PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants