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.

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.

None yet

3 participants