emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103183: allout.el (allout-after-copy


From: Ken Manheimer
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103183: allout.el (allout-after-copy-or-kill-hook): New hook for extension-specific
Date: Mon, 07 Feb 2011 15:43:36 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103183
committer: Ken Manheimer <address@hidden>
branch nick: trunk
timestamp: Mon 2011-02-07 15:43:36 -0500
message:
  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.
modified:
  lisp/ChangeLog
  lisp/allout.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-02-07 18:58:17 +0000
+++ b/lisp/ChangeLog    2011-02-07 20:43:36 +0000
@@ -1,5 +1,16 @@
 2011-02-07  Ken Manheimer  <address@hidden>
 
+       * 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  <address@hidden>

=== modified file 'lisp/allout.el'
--- a/lisp/allout.el    2011-02-07 18:55:33 +0000
+++ b/lisp/allout.el    2011-02-07 20:43:36 +0000
@@ -1437,6 +1437,13 @@
 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.
@@ -1908,6 +1915,7 @@
 `allout-structure-added-hook'
 `allout-structure-deleted-hook'
 `allout-structure-shifted-hook'
+`allout-after-copy-or-kill-hook'
 
                             Terminology
 
@@ -4382,17 +4390,19 @@
            (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)
+      (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)))))
+        (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."
@@ -4433,15 +4443,14 @@
            (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."
@@ -4494,8 +4503,7 @@
   (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."


reply via email to

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