Skip to content

utop-mode utop-erase-buffer? #508

@sebeaumont

Description

@sebeaumont

For what it may be worth when working very long sessions playing in utop... and accumulating huge read-only *utop* buffer in emacs; I managed to make the following work without destroying the session/buffer state (maybe there's more to consider, since I couldn't find such a thing I hacked this up) - so far it seems to work for me YMMV of course. Have I missed a trick or potentially broken anything? I did think to guard this with 'edit state...

(use-package utop
  :ensure t
  :preface
  (defun utop-erase-buffer ()
    "Erase the utop buffer contents..."
    (interactive)
    (with-current-buffer (utop-buffer)
      (utop-perform 
       (erase-buffer)
       (utop-insert-prompt (utop-default-prompt)))))
  :hook
  ((utop-mode . company-mode))
  :bind
  (:map utop-mode-map
        ("C-c C-d" . utop-erase-buffer)
        ("C-<down>" . utop-history-goto-next)
        ("C-<up>" . utop-history-goto-prev)
        ("S-<return>" . utop-eval-input-auto-end)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions