Skip to content

lorniu/dropbox.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT

A Dropbox Client for Emacs

This package provides a seamless way to interact with your Dropbox files directly within Emacs. It aims to offer a simple and efficient user experience by leveraging Dired for file management and employing asynchronous operations with caching for improved responsiveness.

While other clients like pavpanchekha/dropbox.el exist, this package was developed to address my personal needs, anyone else can take it as an alternative approach.

Install & Setup

Put the dropbox.el into your load-path. Or using use-package like this:

(use-package dropbox
  :vc (:url "https://github.com/lorniu/dropbox.el"))

(use-package dropbox
  :vc (:url "https://github.com/lorniu/dropbox.el")
  :config
  (setq dropbox-config-file "~/.dropbox")
  (setq dropbox-http-backend (pdd-curl-backend)))

Before you can access your Dropbox files, you need an auth configuration file (dropbox-config-file):

  • The ~/.dropbox generated by dropbox_uploader.sh can be reused, it's compatible. Do nothing if it exists
  • If you don't have a ~/.dropbox file, run M-x dropbox-gen-config, following the guide to generate one

Usage

Once authenticated, you can interact with your Dropbox files.

Accessing Files

  • Open Remote Path: Use M-x find-file (C-x C-f) with the special /db: prefix to open a remote Dropbox directory or file.
    • Example: C-x C-f /db:/Apps/MyEmacsApp/notes.org
    • Example: C-x C-f /db:/Photos/2023/
  • Search and Open: Use M-x dropbox-find to search for a file in your Dropbox and open it directly.

Editing Remote Files

Remote files are opened in local Emacs buffers. Edit the buffer as you normally would. When you save the buffer (C-x C-s), the changes are automatically uploaded and synchronized with the remote file on Dropbox.

Dired Mode Operations

When you open a remote Dropbox directory (e.g., /db:/path/to/folder/), it will be displayed in Dired mode. You can perform many standard Dired operations, which will be applied to your remote Dropbox files. e.g.:

  • +: Create a new directory on Dropbox
  • C-x C-f path-not-exist.txt: Create new file (sync when save)
  • RET: Open current file at point
    • With prefix C-u, open and cache to disk. The next time it will be opened from cache directly
    • Some files (according to dropbox-cache-disk-url-regexp) will auto cached into disk when be opened
    • Delete the cache on disk with dropbox-clear-cache-on-disk if necessary (with prefix C-u to clear all)
  • C: Copie file or directory between Dropbox and local
    • File copy from remote to local is also called download, from local to remote is also called upload
    • Directory copy from remote to local and named as *.zip, will be auto compressed and downloaded as a single file
  • R: Rename or move files/directories. The logic is similar to the C (Copy) command
  • D: Delete the marked remote file(s) or directory

Other commands

  • dropbox-browser: Open the current Dropbox directory (or your Dropbox root if not in a Dropbox Dired buffer) in your default web browser.
  • dropbox-revisions: In a Dired mode or a remote file buffer, invoke this command will popup a buffer to view and operate the revisions (diff, download, restore and so on).
  • dropbox-shared-link/dropbox-shared-link-revoke: Generate/revoke a link for current remote file/dir, which can be shared with others.
  • dropbox-download-link: Generate a temporary link for current remote file, which can be used by download tool like curl.

Miscellaneous

Issues and PRs are welcome. Enjoy.

About

Dropbox Client for Emacs

Resources

License

Stars

Watchers

Forks

Packages

No packages published