Communick News
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
xenodium@alien.topB to EmacsEnglish · 3 years ago

Emacs Swift module is wonderful for macOS native UX integrations

alien.top

message-square
13
link
fedilink
4

Emacs Swift module is wonderful for macOS native UX integrations

alien.top

xenodium@alien.topB to EmacsEnglish · 3 years ago
message-square
13
link
fedilink
alert-triangle
You must log in or register to comment.
  • xenodium@alien.topBOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 years ago

    A year ago, u/vsavchenko announced https://www.reddit.com/r/emacs/comments/wemj1z/writing_emacs_dynamic_modules_in_swift. I had been meaning to try it out for some time. Finally had the chance and it’s really neat!

    For example, most of the sharing logic from the experiment in the screen grab is below:

    try env.defun(
      "macos-module--share",
      with: """
        Share files in ARG1.
    
        ARG1 must be a vector (not a list) of file paths.
        """
    ) { (env: Environment, files: [String]) in
      let urls = files.map { URL(fileURLWithPath: $0) }
    
      let picker = NSSharingServicePicker(items: urls)
      guard let view = NSApp.mainWindow?.contentView else {
        return
      }
    
      let x = try env.funcall("macos--emacs-point-x") as Int
      let y = try env.funcall("macos--emacs-point-y") as Int
    
      let rect = NSRect(
        x: x + 15, y: Int(view.bounds.height) - y + 15, width: 1, height: 1
      )
      picker.show(relativeTo: rect, of: view, preferredEdge: .maxY)
    
      return
    }
    
    • vsavchenko@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 years ago

      Nice that you had a chance to try it. Would be amazing to hear your feedback and maybe some improvement ideas!

      • xenodium@alien.topBOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 years ago

        So far, in the small experiments I’ve done, it’s been fantastic. Thank you! You’ve also done a wonderful job with the documentation https://savchenkovaleriy.github.io/emacs-swift-module/documentation/emacsswiftmodule

        I’ll file issues if I run into any troubles.

        Apart from https://github.com/roife/emt (which reminded me to look at your project), I haven’t seen other integrations. I’d love to see what others are doing. What are you using it for?

        So far, I’m replacing my previous implementations of reveal in finder (w/ selection) and sharing, with a snappy module implementation. Good times :)

        Thanks again for the thorough work on it.

  • Mamonimoni@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 years ago

    Love it!

  • Fit_Extent712@alien.topB
    link
    fedilink
    arrow-up
    1
    ·
    3 years ago

    font?

    • xenodium@alien.topBOP
      link
      fedilink
      arrow-up
      1
      ·
      3 years ago

      https://xenodium.com/my-emacs-eye-candy

      • Drone30389@alien.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 years ago

        I like that Nyan Cat line counter.

        • xenodium@alien.topBOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          3 years ago

          It’s been a solid companion for many years :)

      • rowini30@alien.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 years ago

        Thanks for that write-up. Lots of interesting stuff there.

        • xenodium@alien.topBOP
          link
          fedilink
          arrow-up
          1
          ·
          3 years ago

          👍

  • konrad1977@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 years ago

    This is really nice, I totally missed that you can use swift code in a module. Thanks for sharing.

    • xenodium@alien.topBOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 years ago

      I hope this post brings more visibility to u/vsavchenko’s https://github.com/SavchenkoValeriy/emacs-swift-module and spark more more integrations. u/divinedominion got ideas https://mastodon.social/@ctietze/111470001921901575 Maybe Maps https://xenodium.com/hey-emacs-where-did-i-take-that-photo?

  • Psionikus@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 years ago

    Xenodium’s Github repo for the dynamic module needs more stars and links so more people find it

    I’ll be collecting dynamic modules while deciding how to make a template for elisp repo kit (Rust).

Emacs

emacs

Subscribe from Remote Instance

You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !emacs@communick.news
lock
Community locked: only moderators can create posts. You can still comment on posts.

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

  • Windows
  • Mac OS X
  • GNU/Linux and BSD (Just get it from your distribution’s package manager)

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for “emacs” and “vi” link to each other. We good.

Emacs Resources

  • Emacs Wiki
  • WikEmacs
  • Emacs Reference (PDF)
  • Learning & Mastering Emacs
  • Weekly tips/tricks/etc threads

Emacs Tutorials

  • Beginner’s Guide to Emacs
  • Absolute Beginner’s Guide to Emacs
  • How to Learn Emacs: A Hand-drawn One-pager for Beginners

Useful Emacs configuration files and distributions

  • Better Defaults
  • Example configurations

Quick pain-saver tip

  • Put the Caps Lock key to better use!
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1 user / 6 months
  • 14 local subscribers
  • 414 subscribers
  • 572 Posts
  • 2.35K Comments
  • Modlog
  • mods:
  • rglullis
  • raphael
  • BE: 0.19.20
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org