Giter VIP home page Giter VIP logo

org-readwise's Introduction

org-readwise

org-readwise

org-readwise is an Emacs package that integrates the Readwise.io highlight syncing service with Org-mode. It allows you to sync your Readwise highlights and notes into your Org files.

Features

  • Sync highlights and notes from Readwise.io.
  • Output highlights and notes to an Org buffer or a specified file.
  • Supports customizable debug levels for detailed logging.
  • Handles pagination and updates efficiently.

Installation

To install `org-readwise`, you can either use a package manager like `straight.el` or `quelpa`, or clone the repository manually.

Using straight.el

Ensure you have `straight.el` installed and then add the following to your Emacs configuration:

;; Bootstrap straight.el
(let ((bootstrap-file (concat user-emacs-directory "straight/repos/straight.el/bootstrap.el"))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

;; Install org-readwise from GitHub
(use-package org-readwise
  :straight (org-readwise :type git :host github :repo "CountGreven/org-readwise")
  :config
  ;; Ensure auth-source is configured to find your Readwise token
  (setq auth-sources '("~/.authinfo.gpg"))
  
  ;; Set the output location for your highlights (buffer or file)
  (setq org-readwise-output-location "~/org/readwise-highlights.org")
  
  ;; Optionally set the debug level (0 = no debug, 1 = basic debug, 2 = detailed debug)
  (setq org-readwise-debug-level 1))

Using quelpa

Ensure you have `quelpa` installed and then add the following to your Emacs configuration:

;; Install quelpa
(unless (package-installed-p 'quelpa)
  (package-refresh-contents)
  (package-install 'quelpa))

;; Install org-readwise from GitHub using quelpa
(use-package org-readwise
  :quelpa (org-readwise :fetcher github :repo "CountGreven/org-readwise")
  :config
  ;; Ensure auth-source is configured to find your Readwise token
  (setq auth-sources '("~/.authinfo.gpg"))
  
  ;; Set the output location for your highlights (buffer or file)
  (setq org-readwise-output-location "~/org/readwise-highlights.org")
  
  ;; Optionally set the debug level (0 = no debug, 1 = basic debug, 2 = detailed debug)
  (setq org-readwise-debug-level 1))

Manual Installation

To install manually, clone the repository and load the package in your Emacs configuration:

git clone https://github.com/CountGreven/org-readwise.git ~/.emacs.d/org-readwise/

Then add the following to your Emacs configuration:

(add-to-list 'load-path "~/.emacs.d/org-readwise/")
(require 'org-readwise)

;; Ensure auth-source is configured to find your Readwise token
(setq auth-sources '("~/.authinfo.gpg"))

;; Set the output location for your highlights (buffer or file)
(setq org-readwise-output-location "~/org/readwise-highlights.org")

;; Optionally set the debug level (0 = no debug, 1 = basic debug, 2 = detailed debug)
(setq org-readwise-debug-level 1)

Usage

To use `org-readwise`, you need to configure it with your Readwise API token. The token should be stored in one of the files defined in `auth-sources`.

Example configuration:

;; Ensure auth-source is configured to find your Readwise token
(setq auth-sources '("~/.authinfo.gpg"))

;; Set the output location for your highlights (buffer or file)
(setq org-readwise-output-location "~/org/readwise-highlights.org")

;; Optionally set the debug level (0 = no debug, 1 = basic debug, 2 = detailed debug)
(setq org-readwise-debug-level 1)

;; Sync highlights
(org-readwise-sync)

Authinfo Configuration

org-readwise requires an access token for Readwise, which should be stored in your `authinfo.pgp` file.

Example `authinfo.pgp` entry:

machine readwise.io login <your-email> password <your-readwise-token>

Here’s the syntax breakdown:

  • `machine readwise.io`: The host for Readwise API.
  • `login <your-email>`: Your Readwise login email.
  • `password <your-readwise-token>`: Your Readwise access token.

Customization

You can customize the behavior of `org-readwise` through the following variables:

  • `org-readwise-output-location`:
    • Specify where to output the Readwise highlights: ‘buffer or a file path.
    • If set to ‘buffer, an ephemeral buffer called Readwise-Highlights will be created where the highlights will be synced. This buffer will be temporary and is useful for quick reviews or temporary storage.
    • Example: `(setq org-readwise-output-location ‘buffer)` or `(setq org-readwise-output-location “~/org/readwise-highlights.org”)`
  • `org-readwise-debug-level`:
    • Specify the debug level for `org-readwise`.
    • 0 = no debug output, 1 = basic debug output, 2 = detailed debug output.
    • Example: `(setq org-readwise-debug-level 1)`

Timestamp File

org-readwise uses a timestamp file to keep track of the last successful sync. This ensures that only highlights added or updated since the last sync are fetched, reducing the amount of data transferred and processed. The timestamp file location is customizable through `org-readwise-last-sync-time-file`, which defaults to `~/.emacs.d/org-readwise-last-sync`.

You can customize the location of the timestamp file:

;; Set the location of the last sync time file
(setq org-readwise-last-sync-time-file "~/.emacs.d/org-readwise-last-sync")

Usage

To sync your Readwise highlights, run:

M-x org-readwise-sync

This will fetch your highlights and insert them into the specified output location. If using the buffer output, highlights will be displayed in a temporary buffer called `*Readwise Highlights*`.

To sync all highlights regardless of the last sync time, call the function with a universal argument:

C-u M-x org-readwise-sync

Limitations

  • No real-time sync: Manual trigger required for syncing.
  • Single user setup: Designed for single user configurations.
  • Performance: Syncing a large number of highlights can be slow.
  • Customization needed: Advanced configurations might require code adjustments.
  • Overwrites buffer: Currently, the program will overwrite the buffer of highlights with the newly synced highlights.
  • No awareness of moved highlights: The program is not aware if the user moves a highlight, potentially causing duplication or loss of highlights.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.

License

This package is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

org-readwise's People

Contributors

countgreven avatar

Stargazers

 avatar Kevin Brubeck Unhammer avatar otis avatar yibie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.