{"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":4,"created_at":"2015-08-06T20:14:57Z","updated_at":"2015-09-30T03:59:22Z","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/144275411","html_url":"https://github.com/greghendershott/racket-mode/issues/149#issuecomment-144275411","issue_url":"https://api.github.com/repos/greghendershott/racket-mode/issues/149","id":144275411,"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-09-30T03:59:22Z","updated_at":"2015-09-30T03:59:22Z","body":"I'm actually kind of leaning towards doing neither of these.\r\n\r\n- **Clearing before every Run:** It sounds like @acarrico doesn't really want this anymore. For people who do want it, adding the `defadvice` I showed above to `.emacs` does work.\r\n \r\n- **Clearing it manually, when desired:** It's already possible to clear the `*Racket REPL*` buffer in the usual Emacs way:\r\n\r\n    - <kbd>C-x h</kbd> does `mark-whole-buffer` -- what younger apps call \"Select All\" :)\r\n    - <kbd>C-w</kbd> does `kill-region` -- \"Cut\"\r\n\r\n    A new `racket-clear-repl` command would be... only that. It would be super easy for me to add, but I feel like I'd be adding redundancy not value?\r\n\r\n"}}