Emacs Package: s3ed

The s3ed package provides a convenient way to work directly with S3 files from Emacs. It uses the AWS CLI under the hood to provide a couple of commands to browse S3 buckets and edit files as if they were local.

Here’s an example configuration:

(use-package s3ed 
    :if (executable-find "aws") 
    :bind
    ("C-c s f" . s3ed-find-file) 
    ("C-c s s" . s3ed-save-file))

Update: Handling quit signals

After using this package for a bit, I noticed that sometimes I would get into a state where <backspace> in the minibuffer would raise an error. Checking the key binding, I determined this was caused by s3ed and had to do a little digging.

It turns out the s3ed commands bind their own behavior to <backspace> in the minibuffer-local-map. That binding is removed when the command is done… but not if you change your mind and use C-g (keyboard-quit) to quit the minibuffer without completing the command. In that situation the key binding remains, waiting to cause problems the next time you use the minibuffer.

One way to work around the issue is to handle the quit signal to ensure the key binding is removed. I’ve added this to the use-package example above:

:config
(defun my/s3ed-quit-handler (orig &rest args)
  (condition-case nil
      (apply orig args)
    (quit (define-key minibuffer-local-map (kbd "<backspace>") nil))))
(advice-add #'s3ed-find-file :around #'my/s3ed-quit-handler)
(advice-add #'s3ed-save-file :around #'my/s3ed-quit-handler)

With that everything is working well, and s3ed remains a great utility in my Emacs toolbox.

Contents

@glucas on Mastodon