Limiting length of ENSIME server buffer; hook for this buffer

54 Views Asked by At

I want to limit the length of the *inferior-ensime-server-...* buffer to a few thousand lines.

This looks promising, from https://stackoverflow.com/a/11255400/1007926, but does not work in this case:

(add-hook 'compilation-filter-hook 'comint-truncate-buffer)
(setq comint-buffer-maximum-size 2000)

Is there an ENSIME server buffer hook that I can use in place of 'compilation-filter-hook?

Maybe these hooks can be used to truncate the buffer occasionally: https://github.com/ensime/ensime-emacs/blob/master/ensime-mode.el

2

There are 2 best solutions below

0
On

It worked for me, I did a M-x customize-group ensime-server and then, in ensime-server-logback I had to set the path to the logback.xml as a string: "/home/user/.sbt/0.13/plugins/logback.xml". This is my logback:

<configuration>
  <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
    <resetJUL>true</resetJUL>
  </contextListener>
  <appender name="file" class="ch.qos.logback.core.FileAppender">
    <file>it.log</file>
    <append>false</append>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} %-5level %X{akkaSource} %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
  <root level="WARN">
    <appender-ref ref="file" />
  </root>
  <logger name="org.ensime" level="WARN" />
  <logger name="akka" level="WARN" />
</configuration>
1
On

you can always supply your own logback.xml file by customising ensime-server-logback and then doing your own filtering.

https://github.com/ensime/ensime-emacs/blob/aafff027f40ea58e22538272edd0a5b676821978/ensime-vars.el#L85