1

I keep project info in .org file together with passwords.

When I share a screen it is annoying to show passwords in a buffer accidentally.

I want to keep .org file in plain text format but mark some parts to be obfuscated or hidden or encrypted:

This is a normal text.
user: me
password: MAGIC{XXXX}

I want to be able to copy content marked as MAGIC as a plain text without a prompt for the decryption master password.

UPDATE I saw http://doc.norang.ca/org-mode.html#HandlingEncryption It encrypts entire section of org file and displays it in plain when prompted.

Displaying of passwords is dangerous. I want to hide them visually and without any manual instructions.

0

Partial solution that hides passwords, but does not enctrypt:


(defvar mypasshide-prefix-re "^pass: *")

(defun mypasshide--toggle-display (overlay hide)
  "Hide or reveal region. Signature follows convention for
`reveal-toggle-invisible' from `reveal' mode."
  (if hide
      (overlay-put overlay 'display (propertize "****" 'face 'warning))
    (overlay-put overlay 'display nil)))

(defun mypasshide--hide ()
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward mypasshide-prefix-re nil t)
      (let* ((beg (match-end 0))
            (end (line-end-position))
            (overlay (make-overlay beg end)))
        (mypasshide--toggle-display overlay t)
        (overlay-put overlay 'reveal-toggle-invisible #'mypasshide--toggle-display)
        ))))

(define-minor-mode mypasshide-mode
  "Hide passwords after `mypasshide-prefix-re' and activate
`reveal-mode'. Disabling is not implemented."
  :group 'reveal
  (if mypasshide-mode
      (progn
        (mypasshide--hide)
        (reveal-mode))))

(provide 'mypasshide)

I activated it as (add-hook 'org-mode-hook #'mypasshide-mode).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.