unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* New allout revisions
@ 2006-03-13 17:52 Ken Manheimer
  2006-03-13 17:56 ` Ken Manheimer
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ken Manheimer @ 2006-03-13 17:52 UTC (permalink / raw)


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

attached is a ChangeLog and patch for some refinements of allout.el. 
the most signficant changes are marking some commonly used allout file
local variables as safe, according to the new system, and
establishment of a custom variable for the default allout layout spec.
 see the ChangeLog for more details.

(in crafting the allout-default-layout custom variable type i was
blocked by what seems to be a limit in the customization type
protocol.  the layout spec allows for nested expressions that are
themselves layout specs, and so the type form is self-recurrent.  i
see no way, however to declare self-recurrent or even
indirectly-recurrent type definitions.  is there a way, in the current
custom types system?)
--
ken manheimer
ken.manheimer@gmail.com
http://myriadicity.net

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

2006-03-13  Ken Manheimer  <ken.manheimer@gmail.com>

	* allout.el: Increment version to 2.2.1 in file commentary.

        (allout-version): Increment to 2.2.1.

        (allout-default-layout): New customization variable, used when the
        file lacks a specific allout-layout.  Customization type is
        substantial, but punts on recursively nested layout expressions
        since i se no way to have self-recurrent customization types.

        (allout-mode): Incorporate allout-default-layout as fallback for
        allout-layout.

	(allout-layout): Mark as 'safe-local-variable', and refer mention
	fallback to `allout-default-layout' in absence of a specified value.
	(allout-passphrase-verifier-string)
	(allout-passphrase-hint-string): Mark as 'safe-local-variable'.

	(allout-file-passphrase-verifier-string): Obsolete variable, removed.

	(allout-get-encryption-passphrase-verifier): Use correct name of
	passphrase verifier in docstring.








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

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

	* allout.el: Increment version to 2.2.1 in file commentary.

        (allout-version): Increment to 2.2.1.

        (allout-default-layout): New customization variable, used when the
        file lacks a specific allout-layout.  Customization type is
        substantial, but punts on recursively nested layout expressions
        since i se no way to have self-recurrent customization types.

        (allout-mode): Incorporate allout-default-layout as fallback for
        allout-layout.

	(allout-layout): Mark as 'safe-local-variable', and refer mention
	fallback to `allout-default-layout' in absence of a specified value.
	(allout-passphrase-verifier-string)
	(allout-passphrase-hint-string): Mark as 'safe-local-variable'.

	(allout-file-passphrase-verifier-string): Obsolete variable, removed.

	(allout-get-encryption-passphrase-verifier): Use correct name of
	passphrase verifier in docstring.







[-- 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] 5+ messages in thread

* Re: New allout revisions
  2006-03-13 17:52 New allout revisions Ken Manheimer
@ 2006-03-13 17:56 ` Ken Manheimer
  2006-03-13 18:04 ` Ken Manheimer
  2006-03-13 18:11 ` Luc Teirlinck
  2 siblings, 0 replies; 5+ messages in thread
From: Ken Manheimer @ 2006-03-13 17:56 UTC (permalink / raw)


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

dang - i sent the wrong copy of the ChangeLog in my last message -
attached is the current one - please use this instead...

On 3/13/06, Ken Manheimer <ken.manheimer@gmail.com> wrote:
> attached is a ChangeLog and patch for some refinements of allout.el.
> the most signficant changes are marking some commonly used allout file
> local variables as safe, according to the new system, and
> establishment of a custom variable for the default allout layout spec.
>  see the ChangeLog for more details.
>
> (in crafting the allout-default-layout custom variable type i was
> blocked by what seems to be a limit in the customization type
> protocol.  the layout spec allows for nested expressions that are
> themselves layout specs, and so the type form is self-recurrent.  i
> see no way, however to declare self-recurrent or even
> indirectly-recurrent type definitions.  is there a way, in the current
> custom types system?)
> --
> ken manheimer
> ken.manheimer@gmail.com
> http://myriadicity.net
>
>
>


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

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

2006-03-13  Ken Manheimer  <ken.manheimer@gmail.com>

	* allout.el: Increment version to 2.2.1 in file commentary.

        (allout-version): Increment to 2.2.1.

        (allout-default-layout): New customization variable, used when the
        file lacks a specific allout-layout.  Customization type is
        substantive except when it comes to recursively nested layout
        expressions, because i see no way to have self-recurrent, or even
        indirectly recurrent customization types.  I punt by using a
        generic list.

        (allout-mode): Incorporate allout-default-layout as fallback for
        allout-layout.

	(allout-layout): Mark as 'safe-local-variable', and refer mention
	fallback to `allout-default-layout' in absence of a specified value.
	(allout-passphrase-verifier-string)
	(allout-passphrase-hint-string): Mark as 'safe-local-variable'.

	(allout-file-passphrase-verifier-string): Obsolete variable, removed.

	(allout-get-encryption-passphrase-verifier): Use correct name of
	passphrase verifier in docstring.


[-- Attachment #3: 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] 5+ messages in thread

* Re: New allout revisions
  2006-03-13 17:52 New allout revisions Ken Manheimer
  2006-03-13 17:56 ` Ken Manheimer
@ 2006-03-13 18:04 ` Ken Manheimer
  2006-03-13 18:11 ` Luc Teirlinck
  2 siblings, 0 replies; 5+ messages in thread
From: Ken Manheimer @ 2006-03-13 18:04 UTC (permalink / raw)


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

lets try this again - attached are the ChangeLog and patch for
allout.el refinements described below.  sorry about the previous
false-starts!

On 3/13/06, Ken Manheimer <ken.manheimer@gmail.com> wrote:
> attached is a ChangeLog and patch for some refinements of allout.el.
> the most signficant changes are marking some commonly used allout file
> local variables as safe, according to the new system, and
> establishment of a custom variable for the default allout layout spec.
>  see the ChangeLog for more details.
>
> (in crafting the allout-default-layout custom variable type i was
> blocked by what seems to be a limit in the customization type
> protocol.  the layout spec allows for nested expressions that are
> themselves layout specs, and so the type form is self-recurrent.  i
> see no way, however to declare self-recurrent or even
> indirectly-recurrent type definitions.  is there a way, in the current
> custom types system?)

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

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

2006-03-13  Ken Manheimer  <ken.manheimer@gmail.com>

	* allout.el: Increment version to 2.2.1 in file commentary.

        (allout-version): Increment to 2.2.1.

        (allout-default-layout): New customization variable, used when the
        file lacks a specific allout-layout.  Customization type is
        substantive except when it comes to recursively nested layout
        expressions, because i see no way to have self-recurrent, or even
        indirectly recurrent customization types.  I punt by using a
        generic list.

        (allout-mode): Incorporate allout-default-layout as fallback for
        allout-layout.

	(allout-layout): Mark as 'safe-local-variable', and refer mention
	fallback to `allout-default-layout' in absence of a specified value.
	(allout-passphrase-verifier-string)
	(allout-passphrase-hint-string): Mark as 'safe-local-variable'.

	(allout-file-passphrase-verifier-string): Obsolete variable, removed.

	(allout-get-encryption-passphrase-verifier): Use correct name of
	passphrase verifier in docstring.




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

--- allout.el	03 Mar 2006 06:37:54 -0500	1.69
+++ allout.el	13 Mar 2006 12:29:57 -0500	
@@ -6,7 +6,7 @@
 ;; Author: Ken Manheimer <ken dot manheimer at gmail dot com>
 ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com>
 ;; Created: Dec 1991 - first release to usenet
-;; Version: 2.2
+;; Version: 2.2.1
 ;; Keywords: outlines wp languages
 
 ;; This file is part of GNU Emacs.
@@ -126,38 +126,69 @@
                 (const :tag "Mode only" "activate")
                 (const :tag "Off" nil))
   :group 'allout)
-;;;_  = allout-layout
-(defvar allout-layout nil
-  "*Layout specification and provisional mode trigger for allout outlines.
-
-Buffer-specific.
-
-A list value specifies a default layout for the current buffer, to be
-applied upon activation of `allout-mode'.  Any non-nil value will
-automatically trigger `allout-mode' \(provided `allout-init' has been called
-to enable this behavior).
-
-See the docstring for `allout-init' for details on setting up for
-auto-mode-activation, and for `allout-expose-topic' for the format of
-the layout specification.
-
-You can associate a particular outline layout with a file by setting
-this var via the file's local variables.  For example, the following
-lines at the bottom of an Emacs Lisp file:
+;;;_  = allout-default-layout
+(defcustom allout-default-layout '(-2 : 0)
+  "*Default allout outline layout specification.
+
+This setting specifies the outline exposure to use when
+`allout-layout' has the local value `t'.  This docstring describes the
+layout specifications.
+
+A list value specifies a default layout for the current buffer,
+to be applied upon activation of `allout-mode'.  Any non-nil
+value will automatically trigger `allout-mode', provided
+`allout-init' has been called to enable this behavior.
+
+The types of elements in the layout specification are:
+
+ integer - dictate the relative depth to open the corresponding topic(s),
+           where:
+         - negative numbers force the topic to be closed before opening
+           to the absolute value of the number, so all siblings are open
+           only to that level.
+         - positive numbers open to the relative depth indicated by the
+           number, but do not force already opened subtopics to be closed.
+         - 0 means to close topic - hide all subitems.
+ :   - repeat spec - apply the preceeding element to all siblings at
+       current level, *up to* those siblings that would be covered by specs
+       following the `:' on the list.  Ie, apply to all topics at level but
+       trailing ones accounted for by trailing specs.  \(Only the first of
+       multiple colons at the same level is honored - later ones are ignored.)
+ *   - completely exposes the topic, including bodies
+ +   - exposes all subtopics, but not the bodies
+ -   - exposes the body of the corresponding topic, but not subtopics
+ list - a nested layout spec, to be applied intricately to its
+        corresponding item(s)
 
-;;;Local variables:
-;;;allout-layout: \(0 : -1 -1 0)
-;;;End:
+Examples:
+ '(-2 : 0)
+	Collapse the top-level topics to show their children and
+        grandchildren, but completely collapse the final top-level topic.
+ '(-1 () : 1 0)
+	Close the first topic so only the immediate subtopics are shown,
+        leave the subsequent topics exposed as they are until the second
+	second to last topic, which is exposed at least one level, and
+        completely close the last topic.
+ '(-2 : -1 *)
+        Expose children and grandchildren of all topics at current
+	level except the last two; expose children of the second to
+	last and completely expose the last one, including its subtopics.
 
-will, modulo the above-mentioned conditions, cause the mode to be
-activated when the file is visited, followed by the equivalent of
-`\(allout-expose-topic 0 : -1 -1 0)'.  \(This is the layout used for
-the allout.el source file.)
+See `allout-expose-topic' for more about the exposure process.
 
 Also, allout's mode-specific provisions will make topic prefixes default
 to the comment-start string, if any, of the language of the file.  This
-is modulo the setting of `allout-use-mode-specific-leader', which see.")
-(make-variable-buffer-local 'allout-layout)
+is modulo the setting of `allout-use-mode-specific-leader', which see."
+  :type '(repeat
+          (choice integer
+                  (const :tag ": (repeat prior)" :)
+                  (const :tag "* (completely expose)" *)
+                  (const :tag "+ (expose all offspring, headlines only)" +)
+                  (const :tag "- (expose topic body but not offspring" -)
+                  (restricted-sexp :tag "Nested layout expression"
+                                   :match-alternatives (listp))))
+  :group 'allout)
+
 ;;;_  = allout-show-bodies
 (defcustom allout-show-bodies nil
   "*If non-nil, show entire body when exposing a topic, rather than
@@ -590,7 +621,7 @@
 ;;;_ #1 Internal Outline Formatting and Configuration
 ;;;_  : Version
 ;;;_   = allout-version
-(defvar allout-version "2.2"
+(defvar allout-version "2.2.1"
   "Version of currently loaded outline package.  \(allout.el)")
 ;;;_   > allout-version
 (defun allout-version (&optional here)
@@ -604,6 +635,36 @@
 ;;;_   = allout-mode
 (defvar allout-mode nil "Allout outline mode minor-mode flag.")
 (make-variable-buffer-local 'allout-mode)
+;;;_   = allout-layout nil
+(defvar allout-layout nil            ; LEAVE GLOBAL VALUE NIL - see docstring.
+  "Buffer-specific setting for allout layout.
+
+In buffers where this is non-nil \(and if `allout-init' has been run, to
+enable this behavior), `allout-mode' will be automatically activated.  The
+layout dictated by the value will be used to set the initial exposure when
+`allout-mode' is activated.
+
+\*You should not setq-default this variable non-nil unless you want every
+visited file to be treated as an allout file.*
+
+The value would typically be set by a file local variable.  For
+example, the following lines at the bottom of an Emacs Lisp file:
+
+;;;Local variables:
+;;;allout-layout: \(0 : -1 -1 0)
+;;;End:
+
+dictate activation of `allout-mode' mode when the file is visited
+\(presuming allout-init was already run), followed by the
+equivalent of `\(allout-expose-topic 0 : -1 -1 0)'.  \(This is
+the layout used for the allout.el source file.)
+
+`allout-default-layout' describes the specification format.
+`allout-layout' can additionally have the value `t', in which
+case the value of `allout-default-layout' is used.")
+(make-variable-buffer-local 'allout-layout)
+(put 'allout-layout 'safe-local-variable t)
+
 ;;;_  : Topic header format
 ;;;_   = allout-regexp
 (defvar allout-regexp ""
@@ -973,11 +1034,6 @@
   "Horrible hack used to prevent invalid multiple triggering of outline
 mode from prop-line file-var activation.  Used by `allout-mode' function
 to track repeats.")
-;;;_   = allout-file-passphrase-verifier-string
-(defvar allout-file-passphrase-verifier-string nil
-  "Name for use as a file variable for verifying encryption passphrase
-across sessions.")
-(make-variable-buffer-local 'allout-file-passphrase-verifier-string)
 ;;;_   = allout-passphrase-verifier-string
 (defvar allout-passphrase-verifier-string nil
   "Setting used to test solicited encryption passphrases against the one
@@ -993,6 +1049,7 @@
 the emacs buffer state, if file variable adjustments are enabled.  See
 `allout-enable-file-variable-adjustment' for details about that.")
 (make-variable-buffer-local 'allout-passphrase-verifier-string)
+(put 'allout-passphrase-verifier-string 'safe-local-variable t)
 ;;;_   = allout-passphrase-hint-string
 (defvar allout-passphrase-hint-string ""
   "Variable used to retain reminder string for file's encryption passphrase.
@@ -1004,6 +1061,7 @@
 state, if file variable adjustments are enabled.  See
 `allout-enable-file-variable-adjustment' for details about that.")
 (make-variable-buffer-local 'allout-passphrase-hint-string)
+(put 'allout-passphrase-hint-string 'safe-local-variable t)
 (setq-default allout-passphrase-hint-string "")
 ;;;_   = allout-after-save-decrypt
 (defvar allout-after-save-decrypt nil
@@ -1578,30 +1636,33 @@
       (allout-infer-body-reindent))
      )					; cond
 
-    (if (and do-layout
-	     allout-auto-activation
-	     (listp allout-layout)
-	     (and (not (eq allout-auto-activation 'activate))
-		  (if (eq allout-auto-activation 'ask)
-		      (if (y-or-n-p (format "Expose %s with layout '%s'? "
-					    (buffer-name)
-					    allout-layout))
-			  t
-			(message "Skipped %s layout." (buffer-name))
-			nil)
-		    t)))
-	(save-excursion
-	  (message "Adjusting '%s' exposure..." (buffer-name))
-	  (goto-char 0)
-	  (allout-this-or-next-heading)
-	  (condition-case err
-	      (progn
-		(apply 'allout-expose-topic (list allout-layout))
-		(message "Adjusting '%s' exposure... done." (buffer-name)))
-	    ;; Problem applying exposure - notify user, but don't
-	    ;; interrupt, eg, file visit:
-	    (error (message "%s" (car (cdr err)))
-		   (sit-for 1)))))
+    (let ((use-layout (if (listp allout-layout)
+                          allout-layout
+                        allout-default-layout)))
+      (if (and do-layout
+               allout-auto-activation
+               use-layout
+               (and (not (eq allout-auto-activation 'activate))
+                    (if (eq allout-auto-activation 'ask)
+                        (if (y-or-n-p (format "Expose %s with layout '%s'? "
+                                              (buffer-name)
+                                              use-layout))
+                            t
+                          (message "Skipped %s layout." (buffer-name))
+                          nil)
+                      t)))
+          (save-excursion
+            (message "Adjusting '%s' exposure..." (buffer-name))
+            (goto-char 0)
+            (allout-this-or-next-heading)
+            (condition-case err
+                (progn
+                  (apply 'allout-expose-topic (list use-layout))
+                  (message "Adjusting '%s' exposure... done." (buffer-name)))
+              ;; Problem applying exposure - notify user, but don't
+              ;; interrupt, eg, file visit:
+              (error (message "%s" (car (cdr err)))
+                     (sit-for 1))))))
     allout-mode
     )					; let*
   )  					; defun
@@ -1660,7 +1721,7 @@
             (if (not
                  (yes-or-no-p
                   (substitute-command-keys
-                   (concat "Modify this concealed text?  (\"no\" aborts,"
+                   (concat "Modify concealed text?  (\"no\" just aborts,"
                            " \\[keyboard-quit] also reconceals) "))))
                 (progn (goto-char start)
                        (error "Concealed-text change refused.")))
@@ -1676,7 +1737,7 @@
 
 This before-change handler is used only where modification-hooks
 overlay property is not supported."
-  (if (not allout-mode)
+  (if (not (allout-mode-p))
       nil
     (allout-overlay-interior-modification-handler nil nil beg end nil)))
 ;;;_  > allout-isearch-end-handler (&optional overlay)
@@ -2561,7 +2622,6 @@
 return to regular interpretation of self-insert characters."
 
   (if (not (allout-mode-p))
-      ;; Shouldn't be invoked if not in allout-mode, but just in case:
       nil
     ;; Hot-spot navigation provisions:
     (if (and (eq this-command 'self-insert-command)
@@ -2595,7 +2655,7 @@
 		      this-command mapped-binding)))))))
 ;;;_   > allout-find-file-hook ()
 (defun allout-find-file-hook ()
-  "Activate `allout-mode' when `allout-auto-activation', `allout-layout' non-nil.
+  "Activate `allout-mode' on non-nil `allout-auto-activation', `allout-layout'.
 
 See `allout-init' for setup instructions."
   (if (and allout-auto-activation
@@ -3415,7 +3475,7 @@
   (if (or (not (allout-mode-p))
           (not (bolp))
           (not (looking-at allout-regexp)))
-      ;; Above conditions do not obtain - just do a regular kill:
+      ;; Just do a regular kill:
       (kill-line arg)
     ;; Ah, have to watch out for adjustments:
     (let* ((beg (point))
@@ -5298,7 +5358,7 @@
 (defun allout-get-encryption-passphrase-verifier ()
   "Return text of the encrypt passphrase verifier, unmassaged, or nil if none.
 
-Derived from value of `allout-file-passphrase-verifier-string'."
+Derived from value of `allout-passphrase-verifier-string'."
 
   (let ((verifier-string (and (boundp 'allout-passphrase-verifier-string)
                               allout-passphrase-verifier-string)))
@@ -5457,7 +5517,7 @@
       (insert (concat "Dummy outline topic header - see"
                       "`allout-mode' docstring: `^Hm'."))
       (allout-adjust-file-variable
-       "allout-layout" (format "%s" (or allout-layout '(-1 : 0)))))))
+       "allout-layout" (or allout-layout '(-1 : 0))))))
 ;;;_  > allout-file-vars-section-data ()
 (defun allout-file-vars-section-data ()
   "Return data identifying the file-vars section, or nil if none.
@@ -5708,13 +5768,7 @@
 
 With argument ARG not nil or 1, move forward ARG - 1 lines first.
 If point reaches the beginning or end of buffer, it stops there.
-To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
-
-This function does not move point across a field boundary unless that
-would move point to a different line than the original, unconstrained
-result.  If N is nil or 1, and a front-sticky field starts at point,
-the point does not move.  To ignore field boundaries bind
-`inhibit-field-text-motion' to t."
+To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
       (interactive "p")
       (or arg (setq arg 1))
       (if (/= arg 1)
@@ -5730,7 +5784,7 @@
           (skip-chars-backward "^\n"))
         (vertical-motion 0)
         (if (/= orig (point))
-            (goto-char (constrain-to-field (point) orig (/= arg 1) t nil)))))
+            (goto-char orig))))
 )
 ;;;_  > move-end-of-line if necessary - older emacs, xemacs
 (if (not (fboundp 'move-end-of-line))
@@ -5741,13 +5795,7 @@
 
 With argument ARG not nil or 1, move forward ARG - 1 lines first.
 If point reaches the beginning or end of buffer, it stops there.
-To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
-
-This function does not move point across a field boundary unless that
-would move point to a different line than the original, unconstrained
-result.  If N is nil or 1, and a rear-sticky field ends at point,
-the point does not move.  To ignore field boundaries bind
-`inhibit-field-text-motion' to t."
+To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
       (interactive "p")
       (or arg (setq arg 1))
       (let ((orig (point))
@@ -5777,8 +5825,7 @@
                   (setq arg 1)
                 (setq done t)))))
         (if (/= orig (point))
-            (goto-char (constrain-to-field (point) orig (/= arg 1) t
-                                           nil)))))
+            (goto-char orig))))
   )
 ;;;_  > line-move-invisible-p if necessary
 (if (not (fboundp 'line-move-invisible-p))



[-- 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] 5+ messages in thread

* Re: New allout revisions
  2006-03-13 17:52 New allout revisions Ken Manheimer
  2006-03-13 17:56 ` Ken Manheimer
  2006-03-13 18:04 ` Ken Manheimer
@ 2006-03-13 18:11 ` Luc Teirlinck
  2006-03-13 19:48   ` Ken Manheimer
  2 siblings, 1 reply; 5+ messages in thread
From: Luc Teirlinck @ 2006-03-13 18:11 UTC (permalink / raw)
  Cc: emacs-devel

Ken Manheimer wrote:

   (in crafting the allout-default-layout custom variable type i was
   blocked by what seems to be a limit in the customization type
   protocol.  the layout spec allows for nested expressions that are
   themselves layout specs, and so the type form is self-recurrent.  i
   see no way, however to declare self-recurrent or even
   indirectly-recurrent type definitions.  is there a way, in the current
   custom types system?)

Did you read `(elisp)Defining New Types'?

Sincerely,

Luc.

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

* Re: New allout revisions
  2006-03-13 18:11 ` Luc Teirlinck
@ 2006-03-13 19:48   ` Ken Manheimer
  0 siblings, 0 replies; 5+ messages in thread
From: Ken Manheimer @ 2006-03-13 19:48 UTC (permalink / raw)
  Cc: emacs-devel

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

new patch and changelog attached, with self-recursive type
functionality added for allout-default-layout.

(thanks, luc - that was exactly what i was seeking!  and helped
doubly, because it lead me to realize i didn't have the emacs 22
manual on my info path, when i went looking for that node.)

On 3/13/06, Luc Teirlinck <teirllm@dms.auburn.edu> wrote:
> Ken Manheimer wrote:
>
>    (in crafting the allout-default-layout custom variable type i was
>    blocked by what seems to be a limit in the customization type
>    protocol.  the layout spec allows for nested expressions that are
>    themselves layout specs, and so the type form is self-recurrent.  i
>    see no way, however to declare self-recurrent or even
>    indirectly-recurrent type definitions.  is there a way, in the current
>    custom types system?)
>
> Did you read `(elisp)Defining New Types'?

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

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

2006-03-13  Ken Manheimer  <ken.manheimer@gmail.com>

	* allout.el: Increment version to 2.2.1 in file commentary.

        (allout-version): Increment to 2.2.1.

        (allout-default-layout): New customization variable, used when the
        file lacks a specific allout-layout.  Uses allout-layout-type for
        recursively nested definition.

        (allout-layout-type): Widget defining allout layouts, necessary for
        self-recursive definition.

        (allout-mode): Incorporate allout-default-layout as fallback for
        allout-layout.

	(allout-layout): Mark as 'safe-local-variable', and refer mention
	fallback to `allout-default-layout' in absence of a specified value.
	(allout-passphrase-verifier-string)
	(allout-passphrase-hint-string): Mark as 'safe-local-variable'.

	(allout-file-passphrase-verifier-string): Obsolete variable, removed.

	(allout-get-encryption-passphrase-verifier): Use correct name of
	passphrase verifier in docstring.




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

--- allout.el	03 Mar 2006 06:37:54 -0500	1.69
+++ allout.el	13 Mar 2006 14:29:41 -0500	
@@ -6,7 +6,7 @@
 ;; Author: Ken Manheimer <ken dot manheimer at gmail dot com>
 ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail dot com>
 ;; Created: Dec 1991 - first release to usenet
-;; Version: 2.2
+;; Version: 2.2.1
 ;; Keywords: outlines wp languages
 
 ;; This file is part of GNU Emacs.
@@ -126,38 +126,72 @@
                 (const :tag "Mode only" "activate")
                 (const :tag "Off" nil))
   :group 'allout)
-;;;_  = allout-layout
-(defvar allout-layout nil
-  "*Layout specification and provisional mode trigger for allout outlines.
-
-Buffer-specific.
-
-A list value specifies a default layout for the current buffer, to be
-applied upon activation of `allout-mode'.  Any non-nil value will
-automatically trigger `allout-mode' \(provided `allout-init' has been called
-to enable this behavior).
-
-See the docstring for `allout-init' for details on setting up for
-auto-mode-activation, and for `allout-expose-topic' for the format of
-the layout specification.
-
-You can associate a particular outline layout with a file by setting
-this var via the file's local variables.  For example, the following
-lines at the bottom of an Emacs Lisp file:
+;;;_  = allout-default-layout
+(defcustom allout-default-layout '(-2 : 0)
+  "*Default allout outline layout specification.
+
+This setting specifies the outline exposure to use when
+`allout-layout' has the local value `t'.  This docstring describes the
+layout specifications.
+
+A list value specifies a default layout for the current buffer,
+to be applied upon activation of `allout-mode'.  Any non-nil
+value will automatically trigger `allout-mode', provided
+`allout-init' has been called to enable this behavior.
+
+The types of elements in the layout specification are:
+
+ integer - dictate the relative depth to open the corresponding topic(s),
+           where:
+         - negative numbers force the topic to be closed before opening
+           to the absolute value of the number, so all siblings are open
+           only to that level.
+         - positive numbers open to the relative depth indicated by the
+           number, but do not force already opened subtopics to be closed.
+         - 0 means to close topic - hide all subitems.
+ :   - repeat spec - apply the preceeding element to all siblings at
+       current level, *up to* those siblings that would be covered by specs
+       following the `:' on the list.  Ie, apply to all topics at level but
+       trailing ones accounted for by trailing specs.  \(Only the first of
+       multiple colons at the same level is honored - later ones are ignored.)
+ *   - completely exposes the topic, including bodies
+ +   - exposes all subtopics, but not the bodies
+ -   - exposes the body of the corresponding topic, but not subtopics
+ list - a nested layout spec, to be applied intricately to its
+        corresponding item(s)
 
-;;;Local variables:
-;;;allout-layout: \(0 : -1 -1 0)
-;;;End:
+Examples:
+ '(-2 : 0)
+	Collapse the top-level topics to show their children and
+        grandchildren, but completely collapse the final top-level topic.
+ '(-1 () : 1 0)
+	Close the first topic so only the immediate subtopics are shown,
+        leave the subsequent topics exposed as they are until the second
+	second to last topic, which is exposed at least one level, and
+        completely close the last topic.
+ '(-2 : -1 *)
+        Expose children and grandchildren of all topics at current
+	level except the last two; expose children of the second to
+	last and completely expose the last one, including its subtopics.
 
-will, modulo the above-mentioned conditions, cause the mode to be
-activated when the file is visited, followed by the equivalent of
-`\(allout-expose-topic 0 : -1 -1 0)'.  \(This is the layout used for
-the allout.el source file.)
+See `allout-expose-topic' for more about the exposure process.
 
 Also, allout's mode-specific provisions will make topic prefixes default
 to the comment-start string, if any, of the language of the file.  This
-is modulo the setting of `allout-use-mode-specific-leader', which see.")
-(make-variable-buffer-local 'allout-layout)
+is modulo the setting of `allout-use-mode-specific-leader', which see."
+  :type 'allout-layout-type
+  :group 'allout)
+;;;_  : allout-layout-type
+(define-widget 'allout-layout-type 'lazy
+  "Allout layout format customization basic building blocks."
+  :type '(repeat
+          (choice (integer :tag "integer (<= zero is strict)")
+                  (const :tag ": (repeat prior)" :)
+                  (const :tag "* (completely expose)" *)
+                  (const :tag "+ (expose all offspring, headlines only)" +)
+                  (const :tag "- (expose topic body but not offspring)" -)
+                  (allout-layout-type :tag "<Nested layout>"))))
+
 ;;;_  = allout-show-bodies
 (defcustom allout-show-bodies nil
   "*If non-nil, show entire body when exposing a topic, rather than
@@ -590,7 +624,7 @@
 ;;;_ #1 Internal Outline Formatting and Configuration
 ;;;_  : Version
 ;;;_   = allout-version
-(defvar allout-version "2.2"
+(defvar allout-version "2.2.1"
   "Version of currently loaded outline package.  \(allout.el)")
 ;;;_   > allout-version
 (defun allout-version (&optional here)
@@ -604,6 +638,36 @@
 ;;;_   = allout-mode
 (defvar allout-mode nil "Allout outline mode minor-mode flag.")
 (make-variable-buffer-local 'allout-mode)
+;;;_   = allout-layout nil
+(defvar allout-layout nil            ; LEAVE GLOBAL VALUE NIL - see docstring.
+  "Buffer-specific setting for allout layout.
+
+In buffers where this is non-nil \(and if `allout-init' has been run, to
+enable this behavior), `allout-mode' will be automatically activated.  The
+layout dictated by the value will be used to set the initial exposure when
+`allout-mode' is activated.
+
+\*You should not setq-default this variable non-nil unless you want every
+visited file to be treated as an allout file.*
+
+The value would typically be set by a file local variable.  For
+example, the following lines at the bottom of an Emacs Lisp file:
+
+;;;Local variables:
+;;;allout-layout: \(0 : -1 -1 0)
+;;;End:
+
+dictate activation of `allout-mode' mode when the file is visited
+\(presuming allout-init was already run), followed by the
+equivalent of `\(allout-expose-topic 0 : -1 -1 0)'.  \(This is
+the layout used for the allout.el source file.)
+
+`allout-default-layout' describes the specification format.
+`allout-layout' can additionally have the value `t', in which
+case the value of `allout-default-layout' is used.")
+(make-variable-buffer-local 'allout-layout)
+(put 'allout-layout 'safe-local-variable t)
+
 ;;;_  : Topic header format
 ;;;_   = allout-regexp
 (defvar allout-regexp ""
@@ -973,11 +1037,6 @@
   "Horrible hack used to prevent invalid multiple triggering of outline
 mode from prop-line file-var activation.  Used by `allout-mode' function
 to track repeats.")
-;;;_   = allout-file-passphrase-verifier-string
-(defvar allout-file-passphrase-verifier-string nil
-  "Name for use as a file variable for verifying encryption passphrase
-across sessions.")
-(make-variable-buffer-local 'allout-file-passphrase-verifier-string)
 ;;;_   = allout-passphrase-verifier-string
 (defvar allout-passphrase-verifier-string nil
   "Setting used to test solicited encryption passphrases against the one
@@ -993,6 +1052,7 @@
 the emacs buffer state, if file variable adjustments are enabled.  See
 `allout-enable-file-variable-adjustment' for details about that.")
 (make-variable-buffer-local 'allout-passphrase-verifier-string)
+(put 'allout-passphrase-verifier-string 'safe-local-variable t)
 ;;;_   = allout-passphrase-hint-string
 (defvar allout-passphrase-hint-string ""
   "Variable used to retain reminder string for file's encryption passphrase.
@@ -1004,6 +1064,7 @@
 state, if file variable adjustments are enabled.  See
 `allout-enable-file-variable-adjustment' for details about that.")
 (make-variable-buffer-local 'allout-passphrase-hint-string)
+(put 'allout-passphrase-hint-string 'safe-local-variable t)
 (setq-default allout-passphrase-hint-string "")
 ;;;_   = allout-after-save-decrypt
 (defvar allout-after-save-decrypt nil
@@ -1578,30 +1639,33 @@
       (allout-infer-body-reindent))
      )					; cond
 
-    (if (and do-layout
-	     allout-auto-activation
-	     (listp allout-layout)
-	     (and (not (eq allout-auto-activation 'activate))
-		  (if (eq allout-auto-activation 'ask)
-		      (if (y-or-n-p (format "Expose %s with layout '%s'? "
-					    (buffer-name)
-					    allout-layout))
-			  t
-			(message "Skipped %s layout." (buffer-name))
-			nil)
-		    t)))
-	(save-excursion
-	  (message "Adjusting '%s' exposure..." (buffer-name))
-	  (goto-char 0)
-	  (allout-this-or-next-heading)
-	  (condition-case err
-	      (progn
-		(apply 'allout-expose-topic (list allout-layout))
-		(message "Adjusting '%s' exposure... done." (buffer-name)))
-	    ;; Problem applying exposure - notify user, but don't
-	    ;; interrupt, eg, file visit:
-	    (error (message "%s" (car (cdr err)))
-		   (sit-for 1)))))
+    (let ((use-layout (if (listp allout-layout)
+                          allout-layout
+                        allout-default-layout)))
+      (if (and do-layout
+               allout-auto-activation
+               use-layout
+               (and (not (eq allout-auto-activation 'activate))
+                    (if (eq allout-auto-activation 'ask)
+                        (if (y-or-n-p (format "Expose %s with layout '%s'? "
+                                              (buffer-name)
+                                              use-layout))
+                            t
+                          (message "Skipped %s layout." (buffer-name))
+                          nil)
+                      t)))
+          (save-excursion
+            (message "Adjusting '%s' exposure..." (buffer-name))
+            (goto-char 0)
+            (allout-this-or-next-heading)
+            (condition-case err
+                (progn
+                  (apply 'allout-expose-topic (list use-layout))
+                  (message "Adjusting '%s' exposure... done." (buffer-name)))
+              ;; Problem applying exposure - notify user, but don't
+              ;; interrupt, eg, file visit:
+              (error (message "%s" (car (cdr err)))
+                     (sit-for 1))))))
     allout-mode
     )					; let*
   )  					; defun
@@ -1660,7 +1724,7 @@
             (if (not
                  (yes-or-no-p
                   (substitute-command-keys
-                   (concat "Modify this concealed text?  (\"no\" aborts,"
+                   (concat "Modify concealed text?  (\"no\" just aborts,"
                            " \\[keyboard-quit] also reconceals) "))))
                 (progn (goto-char start)
                        (error "Concealed-text change refused.")))
@@ -1676,7 +1740,7 @@
 
 This before-change handler is used only where modification-hooks
 overlay property is not supported."
-  (if (not allout-mode)
+  (if (not (allout-mode-p))
       nil
     (allout-overlay-interior-modification-handler nil nil beg end nil)))
 ;;;_  > allout-isearch-end-handler (&optional overlay)
@@ -2561,7 +2625,6 @@
 return to regular interpretation of self-insert characters."
 
   (if (not (allout-mode-p))
-      ;; Shouldn't be invoked if not in allout-mode, but just in case:
       nil
     ;; Hot-spot navigation provisions:
     (if (and (eq this-command 'self-insert-command)
@@ -2595,7 +2658,7 @@
 		      this-command mapped-binding)))))))
 ;;;_   > allout-find-file-hook ()
 (defun allout-find-file-hook ()
-  "Activate `allout-mode' when `allout-auto-activation', `allout-layout' non-nil.
+  "Activate `allout-mode' on non-nil `allout-auto-activation', `allout-layout'.
 
 See `allout-init' for setup instructions."
   (if (and allout-auto-activation
@@ -3415,7 +3478,7 @@
   (if (or (not (allout-mode-p))
           (not (bolp))
           (not (looking-at allout-regexp)))
-      ;; Above conditions do not obtain - just do a regular kill:
+      ;; Just do a regular kill:
       (kill-line arg)
     ;; Ah, have to watch out for adjustments:
     (let* ((beg (point))
@@ -5298,7 +5361,7 @@
 (defun allout-get-encryption-passphrase-verifier ()
   "Return text of the encrypt passphrase verifier, unmassaged, or nil if none.
 
-Derived from value of `allout-file-passphrase-verifier-string'."
+Derived from value of `allout-passphrase-verifier-string'."
 
   (let ((verifier-string (and (boundp 'allout-passphrase-verifier-string)
                               allout-passphrase-verifier-string)))
@@ -5457,7 +5520,7 @@
       (insert (concat "Dummy outline topic header - see"
                       "`allout-mode' docstring: `^Hm'."))
       (allout-adjust-file-variable
-       "allout-layout" (format "%s" (or allout-layout '(-1 : 0)))))))
+       "allout-layout" (or allout-layout '(-1 : 0))))))
 ;;;_  > allout-file-vars-section-data ()
 (defun allout-file-vars-section-data ()
   "Return data identifying the file-vars section, or nil if none.
@@ -5708,13 +5771,7 @@
 
 With argument ARG not nil or 1, move forward ARG - 1 lines first.
 If point reaches the beginning or end of buffer, it stops there.
-To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
-
-This function does not move point across a field boundary unless that
-would move point to a different line than the original, unconstrained
-result.  If N is nil or 1, and a front-sticky field starts at point,
-the point does not move.  To ignore field boundaries bind
-`inhibit-field-text-motion' to t."
+To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
       (interactive "p")
       (or arg (setq arg 1))
       (if (/= arg 1)
@@ -5730,7 +5787,7 @@
           (skip-chars-backward "^\n"))
         (vertical-motion 0)
         (if (/= orig (point))
-            (goto-char (constrain-to-field (point) orig (/= arg 1) t nil)))))
+            (goto-char orig))))
 )
 ;;;_  > move-end-of-line if necessary - older emacs, xemacs
 (if (not (fboundp 'move-end-of-line))
@@ -5741,13 +5798,7 @@
 
 With argument ARG not nil or 1, move forward ARG - 1 lines first.
 If point reaches the beginning or end of buffer, it stops there.
-To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
-
-This function does not move point across a field boundary unless that
-would move point to a different line than the original, unconstrained
-result.  If N is nil or 1, and a rear-sticky field ends at point,
-the point does not move.  To ignore field boundaries bind
-`inhibit-field-text-motion' to t."
+To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
       (interactive "p")
       (or arg (setq arg 1))
       (let ((orig (point))
@@ -5777,8 +5828,7 @@
                   (setq arg 1)
                 (setq done t)))))
         (if (/= orig (point))
-            (goto-char (constrain-to-field (point) orig (/= arg 1) t
-                                           nil)))))
+            (goto-char orig))))
   )
 ;;;_  > line-move-invisible-p if necessary
 (if (not (fboundp 'line-move-invisible-p))



[-- 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] 5+ messages in thread

end of thread, other threads:[~2006-03-13 19:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-13 17:52 New allout revisions Ken Manheimer
2006-03-13 17:56 ` Ken Manheimer
2006-03-13 18:04 ` Ken Manheimer
2006-03-13 18:11 ` Luc Teirlinck
2006-03-13 19:48   ` Ken Manheimer

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).