{"action":"created","issue":{"url":"https://api.github.com/repos/greghendershott/racket-mode/issues/149","labels_url":"https://api.github.com/repos/greghendershott/racket-mode/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/greghendershott/racket-mode/issues/149/comments","events_url":"https://api.github.com/repos/greghendershott/racket-mode/issues/149/events","html_url":"https://github.com/greghendershott/racket-mode/issues/149","id":99515662,"number":149,"title":"Option to clear the REPL like DrRacket does","user":{"login":"greghendershott","id":265119,"avatar_url":"https://avatars.githubusercontent.com/u/265119?v=3","gravatar_id":"","url":"https://api.github.com/users/greghendershott","html_url":"https://github.com/greghendershott","followers_url":"https://api.github.com/users/greghendershott/followers","following_url":"https://api.github.com/users/greghendershott/following{/other_user}","gists_url":"https://api.github.com/users/greghendershott/gists{/gist_id}","starred_url":"https://api.github.com/users/greghendershott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greghendershott/subscriptions","organizations_url":"https://api.github.com/users/greghendershott/orgs","repos_url":"https://api.github.com/users/greghendershott/repos","events_url":"https://api.github.com/users/greghendershott/events{/privacy}","received_events_url":"https://api.github.com/users/greghendershott/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/greghendershott/racket-mode/labels/enhancement","name":"enhancement","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-08-06T20:14:57Z","updated_at":"2015-10-02T20:17:05Z","closed_at":null,"body":"As suggested by acarrico on `#racket`.  On each `racket-run`, clear the `*Racket REPL*` buffer of old output.  (In that case, perhaps do `(banner)` to show Racket version info each time, like DrRacket does, too?)\r\n\r\nI actually like the status quo behavior (surprise :)). I like to accumulate history; sometimes I'll refer back to it. If/when it becomes too much, I just <kbd>C-x h</kbd>and <kbd>C-w</kbd>.\r\n\r\nHowever I can understand someone preferring the proposed behavior. Probably it would be easy to add as an option.\r\n\r\n---\r\n\r\nMeanwhile, people could add this behavior in their Emacs init file by advising `racket-run`. Although I never use advice so I'm not sure the following is correct, it seemed to work:\r\n\r\n```cl\r\n(defadvice racket-run (before my/before-racket-run)\r\n  \"Advice to clear the Racket REPL buffer before each `racket-run', like DrRacket.\"\r\n  (pcase (get-buffer \"*Racket REPL*\")\r\n    (buf (with-current-buffer buf\r\n           (delete-region (point-min) (point-max))))))\r\n(ad-activate #'racket-run)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/greghendershott/racket-mode/issues/comments/145144157","html_url":"https://github.com/greghendershott/racket-mode/issues/149#issuecomment-145144157","issue_url":"https://api.github.com/repos/greghendershott/racket-mode/issues/149","id":145144157,"user":{"login":"greghendershott","id":265119,"avatar_url":"https://avatars.githubusercontent.com/u/265119?v=3","gravatar_id":"","url":"https://api.github.com/users/greghendershott","html_url":"https://github.com/greghendershott","followers_url":"https://api.github.com/users/greghendershott/followers","following_url":"https://api.github.com/users/greghendershott/following{/other_user}","gists_url":"https://api.github.com/users/greghendershott/gists{/gist_id}","starred_url":"https://api.github.com/users/greghendershott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greghendershott/subscriptions","organizations_url":"https://api.github.com/users/greghendershott/orgs","repos_url":"https://api.github.com/users/greghendershott/repos","events_url":"https://api.github.com/users/greghendershott/events{/privacy}","received_events_url":"https://api.github.com/users/greghendershott/received_events","type":"User","site_admin":false},"created_at":"2015-10-02T20:17:05Z","updated_at":"2015-10-02T20:17:05Z","body":"> I tried setting `compilation-messages-start` to nil when the buffer is empty. That fixes the problem. But I'm not sure if it's correct. Even if it's correct, I'm not sure if it's sufficient to solve similar problems we haven't noticed yet.\r\n\r\nI did find a similar problem: When you start the Racket REPL for the very first time on a file that contains an error, `next-error` doesn't work. Same ultimate reason, `compilation-messages-start` ends up \"below\" the error messages. But can't use a simple \"buffer is empty\" test, in this case.\r\n\r\nI have a another work-around but was hitting an edge case that puzzled me, before I had to give up last night. Will try again, soon.\r\n"}}