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

Minor Fixes in the Emacs extension #1168

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions editors/emacs/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/),
and this project adheres to [Semantic Versioning](https://semver.org/).

## Unreleased

### Added
- Auto scroll to the first goal in the `Goals` buffer in case of many hypothesis
- Check that the Goals and Logs buffers are displayed before displaying logs and goals

### Fixed
- Show the error at the end of file if any. That was not working because navigation stoped at the location of last command and not further (see issue #1111)


### Changed
17 changes: 14 additions & 3 deletions editors/emacs/lambdapi-proofs.el
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,20 @@ This works for both graphical and text displays."
(erase-buffer)
(goto-char (point-max))
(mapc 'insert hypsstr)
(setq saved-point (point))
(mapc (lambda (gstr)
(lp--draw-horizontal-line)
(insert gstr))
goalsstr))
goalsstr)

(let ((goalswin (get-buffer-window goalsbuf)))
(if goalswin
(with-selected-window goalswin
(goto-char (+ 1 saved-point))
(beginning-of-line)
(recenter -1))))

)
(remove-overlays)
(erase-buffer)
(insert "No goals"))
Expand Down Expand Up @@ -174,6 +184,7 @@ This works for both graphical and text displays."
(let ((response (jsonrpc-request server :proof/goals params)))
(if response
(progn
(lambdapi-refresh-window-layout)
(lp-display-goals (plist-get response :goals))
(lp-display-logs (plist-get response :logs)))
(let ((goalsbuf (get-buffer-create "*Goals*"))
Expand Down Expand Up @@ -330,7 +341,7 @@ and 0 if there is no previous command."

(defun lp--next-command-pos (&optional pos)
"Return the position of the next command's terminator
and POS if there is no next command"
and (point-max) if there is no next command to display the last error in logs"
(setq npos (1+ (or pos (point))))
(save-excursion
(let ((term-regex
Expand All @@ -343,7 +354,7 @@ and POS if there is no next command"
(setq npos (re-search-forward term-regex nil t))
(and npos (lp--in-comment-p npos)))
(goto-char npos))
(if npos (max (point-min) (1- npos)) pos))))
(if npos (max (point-min) (1- npos)) (point-max)))))

(defun lp--post-self-insert-function ()
(save-excursion
Expand Down
Loading