Skip to content

jsigman/unison-sync-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

unison-sync-mode

An Emacs package that integrates Unison file synchronization into your Emacs workflow.

Table of Contents

Features

  • Automatically sync files using Unison when saving in Emacs
  • Queue multiple sync commands to avoid conflicts
  • Exclude specific files or patterns from synchronization
  • Support for one-way synchronization
  • Force sync with ignorearchives flag
  • Detailed output buffer for sync operations

Installation

With straight.el

To install unison-sync-mode using straight.el, add the following to your Emacs configuration:

(straight-use-package
 '(unison-sync-mode :type git :host github :repo "jsigman/unison-sync-mode"))

If you prefer using use-package with straight.el:

(use-package unison-sync-mode
  :straight (:type git :host github :repo "jsigman/unison-sync-mode"))

Manual

  1. Clone this repository:
    git clone https://github.com/jsigman/unison-sync-mode.git
        
  2. Add the following to your .emacs or init.el file:
    (add-to-list 'load-path "/path/to/unison-sync-mode")
    (require 'unison-sync-mode)
        

Configuration

To use unison-sync-mode, you need to set up directory local variables for your project. Create a .dir-locals.el file in your project root with the following content:

((nil . ((unison-root1 . "/path/to/local/directory")
         (unison-root2 . "/path/to/remote/directory")
         (unison-excluded . ("*.tmp" "*.log"))
         (unison-one-way-sync . nil))))

Adjust the paths and excluded patterns according to your needs.

Usage

Once configured, unison-sync-mode will be automatically enabled for files in directories where unison-root1 and unison-root2 are set.

When unison-sync-mode is active:

  • Files will be synchronized using Unison every time you save.
  • The mode lighter “Unison-Sync” will be displayed in the mode line.

Available Functions

  • unison-sync-mode: Toggle the minor mode on/off manually.
  • unison-sync-force: Force a sync operation with the -ignorearchives flag.

Customization

You can customize the following variables:

  • unison-one-way-sync: Set to non-nil to perform one-way synchronization from unison-root1 to unison-root2.
  • unison-sync-auto-enable: Set to nil if you want to manually enable the mode instead of having it automatically enabled when root directories are set.

Example:

(setq unison-one-way-sync t)
(setq unison-sync-auto-enable nil)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

About

An emacs mode for syncing directories with Unison

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published