pmatos / racket-news

Repository for the Racket News Website
https://racket-news.com
11 stars 2 forks source link

DrRacket Quickscript of the day #53

Closed spdegabrielle closed 3 years ago

spdegabrielle commented 3 years ago

DrRacket Quickscript of the day

Quickscript (featured project of issue 38) provides an easy way to extend DrRacket with small Racket scripts to automate some actions in the editor, while avoiding the need to restart DrRacket. In this new section, contributed by Stephen De Gabrielle, we will be highlighting some of the most interesting scripts out there. Do you have a favourite script? Share it with us!

I'd like to thank Thorsten Blum for this weeks quickscript 'Remove trailing whitespace' that removes trailing spaces from the selected text:

#lang racket/base
(require quickscript racket/string)
(define-script whitespace
  #:label "Remove trailing whitespace"
  (λ (selection)
    (let ([linebreak (string #\newline)])
      (string-join
       (map (λ (line)
              (string-trim line #px"\\s+" #:left? #f))
            (string-split selection linebreak))
       linebreak))))

published at https://github.com/toblux/quickscript-user-scripts

Installation: you can paste this into a new script via the menu: Scripts > Manage > New

Get started at the Racket Wiki: Quickscript Scripts for DrRacket

Full documentation at https://docs.racket-lang.org/quickscript/.

spdegabrielle commented 3 years ago

EMBARGO removed on approval from Thorsten Blum via slack

Metaxal commented 3 years ago

May be worth saying that it removes the trailing spaces in the selected text. (Otherwise one may try it without selecting anything and wonder why it 'fails'.)

toblux commented 3 years ago

I've just published the script at https://github.com/toblux/quickscript-user-scripts if that helps.

spdegabrielle commented 3 years ago

@pmatos this is PRESS READY now 😀

pmatos commented 3 years ago

Thanks. Publishing tomorrow.

On 10 June 2021 20:00:24 CEST, Stephen De Gabrielle @.> wrote: @. this is PRESS READY now 😀

-- > You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub:

https://github.com/pmatos/racket-news/issues/53#issuecomment-858846339