Coder Social home page Coder Social logo

keyweeusr / org-epa-gpg Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 80 KB

Enable toggling inline images in org-mode for epa-enabled / encrypted files

License: GNU General Public License v3.0

Emacs Lisp 98.61% Makefile 1.39%
emacs emacs-lisp emacs-package org-mode org epa gpg gpg-encryption easypg

org-epa-gpg's Introduction

org-epa-gpg

This is a patch that attempts to fix image inlining (C-c C-x C-v) in the org-mode for images that are encrypted AND end with ".gpg" extension.

Install and run

For installation simply issue this command, it'll download the lisp module from this repo directly under the latest stable tag (or replace the tag version with master for the latest code).

(let ((file (make-temp-file "" nil ".el")))
(url-copy-file
 "https://raw.githubusercontent.com/KeyWeeUsr/org-epa-gpg/3.0.0/org-epa-gpg.el"
 file t)
(package-install-file file))

To start, add these mandatory lines to your config file:

(use-package org-epa-gpg
  :ensure t
  :after epa-file
  :config (org-epa-gpg-enable))

Notes on purging

The cleaning of the decrypted content (in /tmp via (make-temp-file) ) is currently done via patching (org-remove-inline-images) with a custom hook (so that it's purged on (C-c C-x C-v) untoggling and via attaching to multiple standard hooks.

Attempted

What I attempted to make it less insane:

  • purge the files right after decrypting and loading -> this causes an empty rectangle to be shown in the buffer
  • hook to standard hooks such as:
    • buffer-list-update-hook -> basically kills Emacs by making it frozen due to too many updates and the initial startup with few hundreds of buffers opened is a time to go for a coffee
    • change-major-mode / after-change-major-mode-hook / org-mode-hook -> is unreliable from security perspective due to being too slow

Current behavior

So I added the purging to these hooks so that an action of "going away" from the org buffer or from Emacs alone, which would potentially endanger the unencrypted data, would also purge them. It's also trying to minimize their overall presence too org-epa-gpg-purging-hooks.

A timer could possibly be added with a very short interval, but it doesn't seem feasible if the amount of images is more than a few (large Org documents) due to 1:1 (image:purger) relationship in `list-timers' possibly hogging Emacs down readability-/resource-wise. Or at least, if turned on by default.

org-epa-gpg's People

Contributors

keyweeusr avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

emacsmirror

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.