pmatos / racket-news

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

DrRacket Quickscript of the day #33

Closed spdegabrielle closed 3 years ago

spdegabrielle commented 3 years ago

DrRacket Quickscript of the day

Don't wait for Jack Firth’s resyntax, fix your #t and #f today!

(resyntax is an experimental refactoring tool built on top of syntax-parse.)

#lang racket/base
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;;          [MIT license](http://opensource.org/licenses/MIT) at your option.
(require quickscript)
(script-help-string
 "Replaces all occurrences of #t and #f with #true and #false in the selected text (warning: in strings too!)")
(define-script fix-true-false
  #:label "fix-true-false"
  (λ (selection)
    (regexp-replaces selection '([#px"#t\\b" "#true"] [#px"#f\\b" "#false"]))))

Quickscript is included in DrRacket, and scripts are managed by the Script menu. See the documentation at https://docs.racket-lang.org/quickscript/

Stephen De Gabrielle

spdegabrielle commented 3 years ago

FYI @jackfirth & @metaxal

spdegabrielle commented 3 years ago

@pmatos can the code appear in racket news? The intention is this is a separate ‘article’ in RN.

pmatos commented 3 years ago

Sure - lets try this as a different article this week. :)

pmatos commented 3 years ago

My biggest concern is generally, how long we can keep it up. As in, how many different quickscripts are there? :)

spdegabrielle commented 3 years ago

So many! We can make it a regular feature and run it for the next year easily.

S.

On Tue, 2 Mar 2021 at 14:08, Paulo Matos notifications@github.com wrote:

My biggest concern is generally, how long we can keep it up. As in, how many different quickscripts are there? :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pmatos/racket-news/issues/33#issuecomment-788934223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2MD4MY7AKXMQHW5IS3MLTBTWMZANCNFSM4YJ4YX5A .

--

pmatos commented 3 years ago

OK - lets give it a go.

Metaxal commented 3 years ago

Can you add the following line after the script, if possible:

If you have installed the url2script quickscript, you can use it to install the script above with this link.

If this is a recurrent thing, this line above will appear each time. (url2script eases installation and update of the scripts)

Metaxal commented 3 years ago

But don't bother if that makes RN too bulky because of that, of course!