Function: allout-encrypt-decrypted

allout-encrypt-decrypted is an interactive and byte-compiled function defined in allout.el.gz.

Signature

(allout-encrypt-decrypted)

Documentation

Encrypt topics pending encryption except those containing exemption point.

If a topic that is currently being edited was encrypted, we return a list containing the location of the topic and the location of the cursor just before the topic was encrypted. This can be used, eg, to decrypt the topic and exactly resituate the cursor if this is being done as part of a file save. See allout-encrypt-unencrypted-on-saves for more info.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_  > allout-encrypt-decrypted ()
(defun allout-encrypt-decrypted ()
  "Encrypt topics pending encryption except those containing exemption point.

If a topic that is currently being edited was encrypted, we return a list
containing the location of the topic and the location of the cursor just
before the topic was encrypted.  This can be used, eg, to decrypt the topic
and exactly resituate the cursor if this is being done as part of a file
save.  See `allout-encrypt-unencrypted-on-saves' for more info."

  (interactive "p")
  (save-match-data
    (save-excursion
      (let* ((current-mark (point-marker))
             (current-mark-position (marker-position current-mark))
             was-modified
             bo-subtree
             editing-topic editing-point)
        (goto-char (point-min))
        (while (allout-next-topic-pending-encryption)
          (setq was-modified (buffer-modified-p))
          (when (save-excursion
                  (and (boundp 'allout-encrypt-unencrypted-on-saves)
                       allout-encrypt-unencrypted-on-saves
                       (setq bo-subtree (re-search-forward "$"))
                       (not (allout-hidden-p))
                       (>= current-mark (point))
                       (allout-end-of-current-subtree)
                       (<= current-mark (point))))
            (setq editing-topic (point)
                  ;; we had to wait for this 'til now so prior topics are
                  ;; encrypted, any relevant text shifts are in place:
                  editing-point (- current-mark-position
                                   (allout-count-trailing-whitespace-region
                                    bo-subtree current-mark-position))))
          (allout-toggle-subtree-encryption)
          (if (not was-modified)
              (set-buffer-modified-p nil))
          )
        (if (not was-modified)
            (set-buffer-modified-p nil))
        (if editing-topic (list editing-topic editing-point))
        )
      )
    )
  )