unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* small batch of important allout patches
@ 2006-09-18  4:46 Ken Manheimer
  2006-09-19 21:58 ` Chong Yidong
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Manheimer @ 2006-09-18  4:46 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

among other things, this patch fixes a non-terminating loop problem
with exposure annotation in certain cases.

2006-09-18  Ken Manheimer  <ken.manheimer@gmail.com>

	* allout.el (allout-unprotected): Let inhibit-read-only only when
	buffer-read-only isn't set.
	(allout-annotate-hidden): Enable topic annotation during copies
	even when the buffer is read-only, eg for topic copies.  Ensure
	that the loop advances, even when the span extends beyond the
	deletion region.
	(allout-toggle-subtree-encryption): Use
	allout-structure-added-hook rather than
	allout-exposure-changed-hook, as a stronger assertion.
	(allout-keybindings-list): add bindings for
	allout-copy-line-as-kill and allout-copy-topic-as-kill.
	(allout-copy-line-as-kill, allout-copy-topic-as-kill): copy
	wrappers for allout-kill-line and allout-kill-topic.
	(allout-listify-exposed): Position correctly to accumulate lines.

-- 
ken
ken.manheimer@gmail.com
http://myriadicity.net

[-- Attachment #2: allout-patch.txt --]
[-- Type: text/plain, Size: 5256 bytes --]

Index: allout.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/allout.el,v
retrieving revision 1.83
diff -u -u -r1.83 allout.el
--- allout.el	16 Sep 2006 10:24:24 -0000	1.83
+++ allout.el	18 Sep 2006 03:27:09 -0000
@@ -698,9 +698,11 @@
         ("*" allout-rebullet-current-heading)
         ("#" allout-number-siblings)
         ("\C-k" allout-kill-line t)
+        ("\M-k" allout-copy-line-as-kill t)
         ("\C-y" allout-yank t)
         ("\M-y" allout-yank-pop t)
         ("\C-k" allout-kill-topic)
+        ("\M-k" allout-copy-topic-as-kill)
                                         ; Miscellaneous commands:
 	;([?\C-\ ] allout-mark-topic)
         ("@" allout-resolve-xref)
@@ -1279,7 +1281,7 @@
 ;;;_   > allout-unprotected (expr)
 (defmacro allout-unprotected (expr)
   "Enable internal outline operations to alter invisible text."
-  `(let ((inhibit-read-only t)
+  `(let ((inhibit-read-only (if (not buffer-read-only) t))
          (inhibit-field-text-motion t))
      ,expr))
 ;;;_   = allout-mode-hook
@@ -1693,7 +1695,9 @@
 	Topic-oriented Killing and Yanking:
 	----------------------------------
 \\[allout-kill-topic]	allout-kill-topic	Kill current topic, including offspring.
-\\[allout-kill-line]	allout-kill-line	Like kill-line, but reconciles numbering, etc.
+\\[allout-copy-topic-as-kill]	allout-copy-topic-as-kill Copy current topic, including offspring.
+\\[allout-kill-line]	allout-kill-line	kill-line, attending to outline structure.
+\\[allout-copy-line-as-kill]	allout-copy-line-as-kill Copy line but don't delete it.
 \\[allout-yank]	allout-yank		Yank, adjusting depth of yanked topic to
 				depth of heading if yanking into bare topic
 				heading (ie, prefix sans text).
@@ -2087,10 +2091,7 @@
 (defun allout-before-change-handler (beg end)
   "Protect against changes to invisible text.
 
-See allout-overlay-interior-modification-handler for details.
-
-This before-change handler is used only where modification-hooks
-overlay property is not supported."
+See allout-overlay-interior-modification-handler for details."
 
   (if (and (allout-mode-p) undo-in-progress (allout-hidden-p))
       (allout-show-to-offshoot))
@@ -4187,6 +4188,14 @@
                 (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."
+  (interactive)
+  (let ((buffer-read-only t))
+    (condition-case nil
+        (allout-kill-line)
+      (buffer-read-only nil))))
 ;;;_    > allout-kill-topic ()
 (defun allout-kill-topic ()
   "Kill topic together with subtopics.
@@ -4223,11 +4232,20 @@
     (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."
+  (interactive)
+  (let ((buffer-read-only t))
+    (condition-case nil
+        (allout-kill-topic)
+      (buffer-read-only (message "Topic copied...")))))
 ;;;_    > allout-annotate-hidden (begin end)
 (defun allout-annotate-hidden (begin end)
   "Qualify text with properties to indicate exposure status."
 
-  (let ((was-modified (buffer-modified-p)))
+  (let ((was-modified (buffer-modified-p))
+        (buffer-read-only nil))
     (allout-unprotected
      (remove-text-properties begin end '(allout-was-hidden t)))
     (save-excursion
@@ -4237,8 +4255,10 @@
           ;; at or advance to start of next hidden region:
           (if (not (allout-hidden-p))
               (setq next
-                    (next-single-char-property-change (point)
-                                                      'invisible nil end)))
+                    (max (1+ (point))
+                         (next-single-char-property-change (point)
+                                                           'invisible
+                                                           nil end))))
           (if (or (not next) (eq prev next))
               ;; still not at start of hidden area - must not be any left.
               (setq done t)
@@ -5169,7 +5189,8 @@
                          (allout-back-to-visible-text)))
 		      strings))
 	  (when (< (point) next)      ; Resume from after hid text, if any.
-            (line-move 1))
+            (line-move 1)
+            (beginning-of-line))
 	  (setq beg (point)))
 	;; Accumulate list for this topic:
 	(setq strings (nreverse strings))
@@ -5745,8 +5766,8 @@
            ;; Add the is-encrypted bullet qualifier:
            (goto-char after-bullet-pos)
            (insert "*"))))
-      (run-hook-with-args 'allout-exposure-changed-hook
-                          bullet-pos subtree-end nil))))
+      (run-hook-with-args 'allout-structure-added-hook
+                          bullet-pos subtree-end))))
 ;;;_  > allout-encrypt-string (text decrypt allout-buffer key-type for-key
 ;;;                                  fetch-pass &optional retried verifying
 ;;;                                  passphrase)

[-- Attachment #3: ChangeLog-entry.txt --]
[-- Type: text/plain, Size: 783 bytes --]

2006-09-18  Ken Manheimer  <ken.manheimer@gmail.com>

	* allout.el (allout-unprotected): Let inhibit-read-only only when
	buffer-read-only isn't set.
	(allout-annotate-hidden): Enable topic annotation during copies
	even when the buffer is read-only, eg for topic copies.  Ensure
	that the loop advances, even when the span extends beyond the
	deletion region.
	(allout-toggle-subtree-encryption): Use
	allout-structure-added-hook rather than
	allout-exposure-changed-hook, as a stronger assertion.
	(allout-keybindings-list): add bindings for
	allout-copy-line-as-kill and allout-copy-topic-as-kill.
	(allout-copy-line-as-kill, allout-copy-topic-as-kill): copy
	wrappers for allout-kill-line and allout-kill-topic.
	(allout-listify-exposed): Position correctly to accumulate lines.

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: small batch of important allout patches
  2006-09-18  4:46 small batch of important allout patches Ken Manheimer
@ 2006-09-19 21:58 ` Chong Yidong
  0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2006-09-19 21:58 UTC (permalink / raw)
  Cc: Emacs-Devel

"Ken Manheimer" <ken.manheimer@gmail.com> writes:

> among other things, this patch fixes a non-terminating loop problem
> with exposure annotation in certain cases.

I checked this in.  Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-19 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18  4:46 small batch of important allout patches Ken Manheimer
2006-09-19 21:58 ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).