2011-02-07 Ken Manheimer <ken.manheimer@gmail.com>
+ * allout.el (allout-after-copy-or-kill-hook): New hook for
+ extension-specific processing of killed text.
+ (allout-mode): Include new allout-after-copy-or-kill-hook among
+ mentioned hooks.
+ (allout-kill-line) (allout-kill-topic): Ensure that processing
+ after kill happens even if barf-if-buffer-read-only is raised.
+ Include new allout-after-copy-or-kill-hook among that subsequent
+ processing.
+ (allout-deannotate-hidden): Actually remove the annotation text
+ properties.
+
* allout.el (allout-listify-exposed): Copy text sans text properties.
2011-02-07 Michael Albinus <michael.albinus@gmx.de>
that native allout routines do not control.
This hook might be invoked multiple times by a single command.")
+;;;_ = allout-after-copy-or-kill-hook
+(defvar allout-after-copy-or-kill-hook nil
+ "*Hook that's run after copying outline text.
+
+Functions on the hook should take two arguments:
+
+ START, END -- integers indicating the span containing the copied text.")
;;;_ = allout-outside-normal-auto-fill-function
(defvar allout-outside-normal-auto-fill-function nil
"Value of normal-auto-fill-function outside of allout mode.
`allout-structure-added-hook'
`allout-structure-deleted-hook'
`allout-structure-shifted-hook'
+`allout-after-copy-or-kill-hook'
Terminology
(depth (allout-depth)))
(allout-annotate-hidden beg end)
- (if (and (not beg-hidden) (not end-hidden))
- (allout-unprotected (kill-line arg))
- (kill-line arg))
- (allout-deannotate-hidden beg end)
-
- (if allout-numbered-bullet
- (save-excursion ; Renumber subsequent topics if needed:
- (if (not (save-match-data (looking-at allout-regexp)))
- (allout-next-heading))
- (allout-renumber-to-depth depth)))
- (run-hook-with-args 'allout-structure-deleted-hook depth (point)))))
+ (unwind-protect
+ (if (and (not beg-hidden) (not end-hidden))
+ (allout-unprotected (kill-line arg))
+ (kill-line arg))
+ (run-hook-with-args 'allout-after-copy-or-kill-hook beg end)
+ (allout-deannotate-hidden beg end)
+
+ (if allout-numbered-bullet
+ (save-excursion ; Renumber subsequent topics if needed:
+ (if (not (save-match-data (looking-at allout-regexp)))
+ (allout-next-heading))
+ (allout-renumber-to-depth depth)))
+ (run-hook-with-args 'allout-structure-deleted-hook depth (point))))))
;;;_ > allout-copy-line-as-kill ()
(defun allout-copy-line-as-kill ()
"Like allout-kill-topic, but save to kill ring instead of deleting."
(forward-char 1)))
(allout-annotate-hidden beg (setq end (point)))
- (unwind-protect
+ (unwind-protect ; for possible barf-if-buffer-read-only.
(allout-unprotected (kill-region beg end))
- (if buffer-read-only
- ;; eg, during copy-as-kill.
- (allout-deannotate-hidden beg end)))
+ (allout-deannotate-hidden beg end)
+ (run-hook-with-args 'allout-after-copy-or-kill-hook beg end)
- (save-excursion
- (allout-renumber-to-depth depth))
- (run-hook-with-args 'allout-structure-deleted-hook depth (point))))
+ (save-excursion
+ (allout-renumber-to-depth depth))
+ (run-hook-with-args 'allout-structure-deleted-hook depth (point)))))
;;;_ > allout-copy-topic-as-kill ()
(defun allout-copy-topic-as-kill ()
"Like `allout-kill-topic', but save to kill ring instead of deleting."
(allout-unprotected
(let ((inhibit-read-only t)
(buffer-undo-list t))
- ;(remove-text-properties begin end '(allout-was-hidden t))
- )))
+ (remove-text-properties begin end '(allout-was-hidden t)))))
;;;_ > allout-hide-by-annotation (begin end)
(defun allout-hide-by-annotation (begin end)
"Translate text properties indicating exposure status into actual exposure."