emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/allout.el


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/lisp/allout.el
Date: Fri, 02 Dec 2005 09:09:54 -0500

Index: emacs/lisp/allout.el
diff -c emacs/lisp/allout.el:1.63 emacs/lisp/allout.el:1.64
*** emacs/lisp/allout.el:1.63   Sun Oct 23 08:23:25 2005
--- emacs/lisp/allout.el        Fri Dec  2 14:09:53 2005
***************
*** 80,88 ****
  (provide 'allout)
  
  ;;;_* Dependency autoloads
- (eval-when-compile 'cl)                 ; otherwise, flet compilation fouls
  (eval-when-compile (progn (require 'pgg)
!                           (require 'pgg-gpg)))
  (autoload 'pgg-gpg-symmetric-key-p "pgg-gpg"
    "True if decoded armor MESSAGE-KEYS has symmetric encryption indicator.")
  
--- 80,90 ----
  (provide 'allout)
  
  ;;;_* Dependency autoloads
  (eval-when-compile (progn (require 'pgg)
!                           (require 'pgg-gpg)
!                         (fset 'allout-real-isearch-abort
!                               (symbol-function 'isearch-abort))
!                         ))
  (autoload 'pgg-gpg-symmetric-key-p "pgg-gpg"
    "True if decoded armor MESSAGE-KEYS has symmetric encryption indicator.")
  
***************
*** 585,592 ****
  is nil.
  
  Operations potentially causing edits include allout encryption routines.
! See the docstring for `allout-toggle-current-subtree-encryption' for
! details."
    :type 'boolean
    :group 'allout)
  (make-variable-buffer-local 'allout-enable-file-variable-adjustment)
--- 587,593 ----
  is nil.
  
  Operations potentially causing edits include allout encryption routines.
! For details, see `allout-toggle-current-subtree-encryption's docstring."
    :type 'boolean
    :group 'allout)
  (make-variable-buffer-local 'allout-enable-file-variable-adjustment)
***************
*** 606,611 ****
--- 607,616 ----
      (if here (insert msg))
      (message "%s" msg)
      msg))
+ ;;;_  : Mode activation (defined here because it's referenced early)
+ ;;;_   = allout-mode
+ (defvar allout-mode nil "Allout outline mode minor-mode flag.")
+ (make-variable-buffer-local 'allout-mode)
  ;;;_  : Topic header format
  ;;;_   = allout-regexp
  (defvar allout-regexp ""
***************
*** 898,904 ****
  
  First arg is NAME of variable affected.  Optional second arg is list
  containing allout-mode-specific VALUE to be imposed on named
! variable, and to be registered.  (It's a list so you can specify
  registrations of null values.)  If no value is specified, the
  registered value is returned (encapsulated in the list, so the caller
  can distinguish nil vs no value), and the registration is popped
--- 903,909 ----
  
  First arg is NAME of variable affected.  Optional second arg is list
  containing allout-mode-specific VALUE to be imposed on named
! variable, and to be registered.  \(It's a list so you can specify
  registrations of null values.)  If no value is specified, the
  registered value is returned (encapsulated in the list, so the caller
  can distinguish nil vs no value), and the registration is popped
***************
*** 1033,1038 ****
--- 1038,1049 ----
  This is used to decrypt the topic that was currently being edited, if it
  was encrypted automatically as part of a file write or autosave.")
  (make-variable-buffer-local 'allout-after-save-decrypt)
+ ;;;_   > allout-mode-p ()
+ ;; Must define this macro above any uses, or byte compilation will lack
+ ;; proper def, if file isn't loaded - eg, during emacs build!
+ (defmacro allout-mode-p ()
+   "Return t if `allout-mode' is active in current buffer."
+   'allout-mode)
  ;;;_   > allout-write-file-hook-handler ()
  (defun allout-write-file-hook-handler ()
    "Implement `allout-encrypt-unencrypted-on-saves' policy for file writes."
***************
*** 1061,1067 ****
      nil)
  ;;;_   > allout-auto-save-hook-handler ()
  (defun allout-auto-save-hook-handler ()
!   "Implement `allout-encrypt-unencrypted-on-saves' policy for auto saves."
  
    (if (and (allout-mode-p) allout-encrypt-unencrypted-on-saves)
        ;; Always implement 'except-current policy when enabled.
--- 1072,1078 ----
      nil)
  ;;;_   > allout-auto-save-hook-handler ()
  (defun allout-auto-save-hook-handler ()
!   "Implement `allout-encrypt-unencrypted-on-saves' policy for auto save."
  
    (if (and (allout-mode-p) allout-encrypt-unencrypted-on-saves)
        ;; Always implement 'except-current policy when enabled.
***************
*** 1082,1088 ****
        t
      (goto-char (car allout-after-save-decrypt))
      (let ((was-modified (buffer-modified-p)))
!       (allout-toggle-current-subtree-encryption)
        (if (not was-modified)
            (set-buffer-modified-p nil)))
      (goto-char (cadr allout-after-save-decrypt))
--- 1093,1099 ----
        t
      (goto-char (car allout-after-save-decrypt))
      (let ((was-modified (buffer-modified-p)))
!       (allout-toggle-subtree-encryption)
        (if (not was-modified)
            (set-buffer-modified-p nil)))
      (goto-char (cadr allout-after-save-decrypt))
***************
*** 1090,1102 ****
    )
  
  ;;;_ #2 Mode activation
- ;;;_  = allout-mode
- (defvar allout-mode () "Allout outline mode minor-mode flag.")
- (make-variable-buffer-local 'allout-mode)
- ;;;_  > allout-mode-p ()
- (defmacro allout-mode-p ()
-   "Return t if `allout-mode' is active in current buffer."
-   'allout-mode)
  ;;;_  = allout-explicitly-deactivated
  (defvar allout-explicitly-deactivated nil
    "If t, `allout-mode's last deactivation was deliberate.
--- 1101,1106 ----
***************
*** 1297,1303 ****
  encryption, encryption with a mistaken passphrase, forgetting which
  passphrase was used, and other practical pitfalls.
  
! See the `allout-toggle-current-subtree-encryption' function and
  `allout-encrypt-unencrypted-on-saves' customization variable for details.
  
                 HOT-SPOT Operation
--- 1301,1307 ----
  encryption, encryption with a mistaken passphrase, forgetting which
  passphrase was used, and other practical pitfalls.
  
! See `allout-toggle-current-subtree-encryption' function docstring and
  `allout-encrypt-unencrypted-on-saves' customization variable for details.
  
                 HOT-SPOT Operation
***************
*** 1404,1415 ****
                     (or (and (listp toggle)(car toggle))
                         toggle)))
                                       ; Activation specifically demanded?
!        (explicit-activation (or
!                             ;;
!                             (and toggle
                                   (or (symbolp toggle)
!                                      (and (natnump toggle)
!                                           (not (zerop toggle)))))))
         ;; allout-mode already called once during this complex command?
         (same-complex-command (eq allout-v18/19-file-var-hack
                                  (car command-history)))
--- 1408,1417 ----
                     (or (and (listp toggle)(car toggle))
                         toggle)))
                                       ; Activation specifically demanded?
!        (explicit-activation (and toggle
                                   (or (symbolp toggle)
!                                      (and (wholenump toggle)
!                                           (not (zerop toggle))))))
         ;; allout-mode already called once during this complex command?
         (same-complex-command (eq allout-v18/19-file-var-hack
                                  (car command-history)))
***************
*** 3714,3727 ****
              (setq file-name
                    (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t)
                        (buffer-substring (match-beginning 1) (match-end 1))))))
!         (setq file-name
!               (if (not (= (aref file-name 0) ?:))
!                   (expand-file-name file-name)
!                                         ; A registry-files ref, strip the `:'
!                                         ; and try to follow it:
!                 (let ((reg-ref (reference-registered-file
!                                 (substring file-name 1) nil t)))
!                   (if reg-ref (car (cdr reg-ref))))))
          (if (or (file-exists-p file-name)
                  (if (file-writable-p file-name)
                      (y-or-n-p (format "%s not there, create one? "
--- 3716,3722 ----
              (setq file-name
                    (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t)
                        (buffer-substring (match-beginning 1) (match-end 1))))))
!         (setq file-name (expand-file-name file-name))
          (if (or (file-exists-p file-name)
                  (if (file-writable-p file-name)
                      (y-or-n-p (format "%s not there, create one? "
***************
*** 4851,4863 ****
  ;;;_ #8 Encryption
  ;;;_  > allout-toggle-current-subtree-encryption (&optional fetch-pass)
  (defun allout-toggle-current-subtree-encryption (&optional fetch-pass)
!   "Encrypt clear text or decrypt encoded topic contents \(body and subtopics.)
  
  Optional FETCH-PASS universal argument provokes key-pair encryption with
  single universal argument.  With doubled universal argument \(value = 16),
  it forces prompting for the passphrase regardless of availability from the
  passphrase cache.  With no universal argument, the appropriate passphrase
! for the is obtained from the cache, if available, else from the user.
  
  Currently only GnuPG encryption is supported.
  
--- 4846,4858 ----
  ;;;_ #8 Encryption
  ;;;_  > allout-toggle-current-subtree-encryption (&optional fetch-pass)
  (defun allout-toggle-current-subtree-encryption (&optional fetch-pass)
!   "Encrypt clear or decrypt encoded text of visibly-containing topic's 
contents.
  
  Optional FETCH-PASS universal argument provokes key-pair encryption with
  single universal argument.  With doubled universal argument \(value = 16),
  it forces prompting for the passphrase regardless of availability from the
  passphrase cache.  With no universal argument, the appropriate passphrase
! is obtained from the cache, if available, else from the user.
  
  Currently only GnuPG encryption is supported.
  
***************
*** 4915,4920 ****
--- 4910,4937 ----
  enabled \(see the `allout-passphrase-hint-handling' docstring for details),
  the hint string is stored in the local-variables section of the file, and
  solicited whenever the passphrase is changed."
+   (interactive "P")
+   (save-excursion
+     (allout-back-to-current-heading)
+     (allout-toggle-subtree-encryption)
+     )
+   )
+ ;;;_  > allout-toggle-subtree-encryption (&optional fetch-pass)
+ (defun allout-toggle-subtree-encryption (&optional fetch-pass)
+   "Encrypt clear text or decrypt encoded topic contents \(body and subtopics.)
+ 
+ Optional FETCH-PASS universal argument provokes key-pair encryption with
+ single universal argument.  With doubled universal argument \(value = 16),
+ it forces prompting for the passphrase regardless of availability from the
+ passphrase cache.  With no universal argument, the appropriate passphrase
+ is obtained from the cache, if available, else from the user.
+ 
+ Currently only GnuPG encryption is supported.
+ 
+ \**NOTE WELL** that the encrypted text must be ascii-armored.  For gnupg
+ encryption, include the option ``armor'' in your ~/.gnupg/gpg.conf file.
+ 
+ See `allout-toggle-current-subtree-encryption' for more details."
  
    (interactive "P")
    (save-excursion
***************
*** 5022,5027 ****
--- 5039,5047 ----
  
    (require 'pgg)
  
+   (if (not (fboundp 'pgg-encrypt-symmetric))
+       (error "Allout encryption depends on a newer version of pgg"))
+ 
    (let* ((scheme (upcase
                    (format "%s" (or pgg-scheme pgg-default-scheme "GPG"))))
           (for-key (and (equal key-type 'keypair)
***************
*** 5498,5504 ****
                    ;; we had to wait for this 'til now so prior topics are
                    ;; encrypted, any relevant text shifts are in place:
                    editing-point (marker-position current-mark)))
!         (allout-toggle-current-subtree-encryption)
          (if (not was-modified)
              (set-buffer-modified-p nil))
          )
--- 5518,5524 ----
                    ;; we had to wait for this 'til now so prior topics are
                    ;; encrypted, any relevant text shifts are in place:
                    editing-point (marker-position current-mark)))
!         (allout-toggle-subtree-encryption)
          (if (not was-modified)
              (set-buffer-modified-p nil))
          )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]