GithubHelp home page GithubHelp logo

Comments (3)

hvesalai avatar hvesalai commented on August 10, 2024

Hi,

For #1 you can use the newline-and-indent function, which removes any trailing whitespace from the line where you press RET (see README.md on how to do this)

If you insist on not using newline-and-indent, then you can have something like this:

(add-hook 'scala-mode-hook '(lambda ()
  (local-set-key (kbd "RET") '(lambda ()
                                (interactive)
                                (delete-horizontal-space t)
                                (newline) ;; or what ever you like)))

#2 is something that bothers me also. If you would like to make a pull request with a solution, I'd gladly review it.

You could start by looking how the scala-indent:indent-on-scaladoc-asterisk is registered in scala-mode2-map.el and how it is implemented in scala-mode2-indent.el. Then you can create a new function called scala-indent:fix-scaladoc-close that does something like the following:

  • check that you are inside a multiline comment (like the indent-on-scaladoc-asterisk does)
  • using looking-back check for the regexp "^\\s *\\*\\s /", ie. space, one asterisk, one space and /
  • if so, delete the space before the slash

from emacs-scala-mode.

Toxaris avatar Toxaris commented on August 10, 2024

Thanks for the hint for (1), I followed the readme and I'm happy about my more powerful RET so far.

I started to look into the implementation of (2), but I'm concerned about what happens if a line in a comment starts with /. For example:

 /** some text
   * {{{
   * // a comment in a code snippet in a comment in a code snippet in a comment on github :)
   * }}}
   */

In this case, we would not want to delete the space in the third line, but only in the fifth line.

from emacs-scala-mode.

hvesalai avatar hvesalai commented on August 10, 2024

Thank you for the commit. I have merged it and included you in the list of commiters in README.md.

from emacs-scala-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.