auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 01730ec53a8f81a2eaa53


From: Berend de Boer
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 01730ec53a8f81a2eaa53a5ad2e70b003a479aec
Date: Tue, 21 Jan 2014 04:10:42 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  01730ec53a8f81a2eaa53a5ad2e70b003a479aec (commit)
      from  59c80eb0431a76b732fe2e2cfadcbd75da33a2d7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 01730ec53a8f81a2eaa53a5ad2e70b003a479aec
Author: Berend de Boer <address@hidden>
Date:   Tue Jan 21 17:10:35 2014 +1300

    Distinguish between numbered and unnumbered sections.

diff --git a/context-en.el b/context-en.el
index aba1d8c..865ca71 100644
--- a/context-en.el
+++ b/context-en.el
@@ -140,17 +140,25 @@
 ;; the level is used to find the section name, so the alternative
 ;; names are never found. Have to start using the section name instead
 ;; of the number.
-(defvar ConTeXt-section-list-en
+(defvar ConTeXt-numbered-section-list-en
   '(("part" 0)
     ("chapter" 1)
     ("section" 2)
     ("subsection" 3)
     ("subsubsection" 4))
-  ;; ("title" 1)
-  ;; ("subject" 2)
-  ;; ("subsubject" 3)
-  ;; ("subsubsubject" 4)
-  "List of the names of ConTeXt sections for its en interface.")
+  "List of the names of ConTeXt numbered sections for its en interface.")
+
+(defvar ConTeXt-unnumbered-section-list-en
+  '(("title" 1)
+    ("subject" 2)
+    ("subsubject" 3)
+    ("subsubsubject" 4))
+  "List of the names of ConTeXt unnumbered sections for its en interface.")
+
+(defvar ConTeXt-section-list-en
+  (append ConTeXt-numbered-section-list-en ConTeXt-unnumbered-section-list-en)
+)
+
 
 (defvar ConTeXt-text-en "text"
   "The ConTeXt en interface body text group.")
diff --git a/context.el b/context.el
index 3a2622b..89fa9b0 100644
--- a/context.el
+++ b/context.el
@@ -301,12 +301,12 @@ The following variables can be set to customize:
                      ((< val 0)
                       (ConTeXt-up-section (- val)))
                      (t val)))
-        (name (ConTeXt-section-name level))
+        (name (ConTeXt-numbered-section-name level))
         (toc nil)
         (title "")
         (done-mark (make-marker)))
     (newline)
-    (run-hooks 'ConTeXt-section-hook)
+    (run-hooks 'ConTeXt-numbered-section-hook)
     (newline)
     (if (marker-position done-mark)
        (goto-char (marker-position done-mark)))
@@ -356,31 +356,53 @@ section."
                                        nil t)))
        (ConTeXt-up-section (1- arg))))))
 
-(defvar ConTeXt-section-list ()
+(defvar ConTeXt-numbered-section-list ()
   "ConTeXt-XX-section-list where XX is the current interface.")
 
-(defun ConTeXt-section-name (level)
+(defvar ConTeXt-unnumbered-section-list ()
+  "ConTeXt-XX-section-list where XX is the current interface.")
+
+(defvar ConTeXt-section-list
+  (append ConTeXt-numbered-section-list ConTeXt-unnumbered-section-list)
+)
+
+(defun ConTeXt-numbered-section-name (level)
+  "Return the name of the section corresponding to LEVEL."
+  (let ((entry (TeX-member level ConTeXt-numbered-section-list
+                          (function (lambda (a b) (equal a (nth 1 b)))))))
+    (if entry
+       (nth 0 entry)
+      nil)))
+
+(defun ConTeXt-unnumbered-section-name (level)
   "Return the name of the section corresponding to LEVEL."
-  (let ((entry (TeX-member level ConTeXt-section-list
+  (let ((entry (TeX-member level ConTeXt-unnumbered-section-list
                           (function (lambda (a b) (equal a (nth 1 b)))))))
     (if entry
        (nth 0 entry)
       nil)))
 
-(defun ConTeXt-section-level (name)
+(defun ConTeXt-numbered-section-level (name)
   "Return the level of the section NAME."
-  (let ((entry (TeX-member name ConTeXt-section-list
-                          (function (lambda (a b) (equal a (nth 0 b)))))))
+  (let ((entry (TeX-member name ConTeXt-numbered-section-list
+                           (function (lambda (a b) (equal a (nth 0 b)))))))
+    (if entry
+        (nth 1 entry)
+      nil)))
 
+(defun ConTeXt-unnumbered-section-level (name)
+  "Return the level of the section NAME."
+  (let ((entry (TeX-member name ConTeXt-numbered-section-list
+                           (function (lambda (a b) (equal a (nth 0 b)))))))
     (if entry
-       (nth 1 entry)
+        (nth 1 entry)
       nil)))
 
 
 ;;; Section Hooks.
 
-(defcustom ConTeXt-section-hook
-  '(ConTeXt-section-heading
+(defcustom ConTeXt-numbered-section-hook
+  '(ConTeXt-numbered-section-heading
     ConTeXt-section-title
     ConTeXt-section-ref
     ConTeXt-section-section)
@@ -409,8 +431,8 @@ ConTeXt-section-ref: Insert a reference for this section 
command.
 
 To get a full featured `ConTeXt-section' command, insert
 
- (setq ConTeXt-section-hook
-                        '(ConTeXt-section-heading
+ (setq ConTeXt-numbered-section-hook
+                        '(ConTeXt-numbered-section-heading
                                 ConTeXt-section-title
                                 ConTeXt-section-section
                                 ConTeXt-section-ref))
@@ -419,18 +441,75 @@ in your .emacs file."
   :group 'ConTeXt-macro
   :type 'hook
   :options
-  '(ConTeXt-section-heading
+  '(ConTeXt-numbered-section-heading
     ConTeXt-section-title
     ConTeXt-section-ref
     ConTeXt-section-section))
 
-(defun ConTeXt-section-heading ()
+(defcustom ConTeXt-unnumbered-section-hook
+  '(ConTeXt-unnumbered-section-heading
+    ConTeXt-section-title
+    ConTeXt-section-ref
+    ConTeXt-section-section)
+  "List of hooks to run when a new section is inserted.
+
+The following variables are set before the hooks are run
+
+level - numeric section level, see the documentation of `ConTeXt-section'.
+name - name of the sectioning command, derived from `level'.
+title - The title of the section, default to an empty string.
+`done-mark' - Position of point afterwards, default nil (meaning end).
+
+The following standard hook exist -
+
+ConTeXt-section-heading: Query the user about the name of the
+sectioning command.  Modifies `level' and `name'.
+
+ConTeXt-section-title: Query the user about the title of the
+section.  Modifies `title'.
+
+ConTeXt-section-section: Insert ConTeXt section command according to
+`name', `title', and `reference'.  If `title' is an empty string,
+`done-mark' will be placed at the point they should be inserted.
+
+ConTeXt-section-ref: Insert a reference for this section command.
+
+To get a full featured `ConTeXt-section' command, insert
+
+ (setq ConTeXt-unnumbered-section-hook
+                        '(ConTeXt-unnumbered-section-heading
+                                ConTeXt-section-title
+                                ConTeXt-section-section
+                                ConTeXt-section-ref))
+
+in your .emacs file."
+  :group 'ConTeXt-macro
+  :type 'hook
+  :options
+  '(ConTeXt-unnumbered-section-heading
+    ConTeXt-section-title
+    ConTeXt-section-ref
+    ConTeXt-section-section))
+
+(defun ConTeXt-numbered-section-heading ()
+  "Hook to prompt for ConTeXt section name.
+Insert this hook into `ConTeXt-numbered-section-hook' to allow the user to 
change
+the name of the sectioning command inserted with `\\[ConTeXt-section]'."
+  (let ((string (completing-read
+                (concat "Select level: (default " name ") ")
+                ConTeXt-numbered-section-list
+                nil nil nil)))
+    ;; Update name
+    (if (not (zerop (length string)))
+       (setq name string))))
+
+(defun ConTeXt-unnumbered-section-heading ()
   "Hook to prompt for ConTeXt section name.
-Insert this hook into `ConTeXt-section-hook' to allow the user to change
+Insert this hook into `ConTeXt-unnumbered-section-hook' to allow the user to 
change
 the name of the sectioning command inserted with `\\[ConTeXt-section]'."
   (let ((string (completing-read
                 (concat "Select level: (default " name ") ")
-                ConTeXt-section-list
+                ConTeXt-unnumbered-section-list
                 nil nil nil)))
     ;; Update name
     (if (not (zerop (length string)))
@@ -438,7 +517,7 @@ the name of the sectioning command inserted with 
`\\[ConTeXt-section]'."
 
 (defun ConTeXt-section-title ()
   "Hook to prompt for ConTeXt section title.
-Insert this hook into `ConTeXt-section-hook' to allow the user to change
+Insert this hook into `ConTeXt-(un)numbered-section-hook' to allow the user to 
change
 the title of the section inserted with `\\[ConTeXt-section]."
   (setq title (read-string "What title: ")))
 
@@ -912,7 +991,8 @@ If OPTIONAL, only insert it if not empty, and then use 
square brackets."
    "[][]\\|"  ; display math delimitors (is this applicable to ConTeXt??)
    (ConTeXt-environment-start-name) "\\|"
    (ConTeXt-environment-stop-name) "\\|"
-   (mapconcat 'car ConTeXt-section-list "\\b\\|") "\\b\\|"
+   (mapconcat 'car ConTeXt-numbered-section-list "\\b\\|") "\\b\\|"
+   (mapconcat 'car ConTeXt-unnumbered-section-list "\\b\\|") "\\b\\|"
    (mapconcat 'identity ConTeXt-extra-paragraph-commands "\\b\\|")
    "\\b\\|"
    (mapconcat 'identity ConTeXt-item-list "\\b\\|") "\\b\\)"))
@@ -936,7 +1016,8 @@ header is at the start of a line."
    (regexp-quote TeX-esc)
    "\\("
    (mapconcat 'ConTeXt-environment-full-start-name ConTeXt-section-block-list 
"\\|") "\\|"
-   (mapconcat 'car ConTeXt-section-list "\\|")
+   (mapconcat 'car ConTeXt-numbered-section-list "\\|")
+   (mapconcat 'car ConTeXt-unnumbered-section-list "\\|")
    "\\)\\b"
    (if TeX-outline-extra
        "\\|"
@@ -1314,7 +1395,8 @@ else.  There might be text before point."
 
 ;; section menu entries
 
-(defvar ConTeXt-section-menu-name "Section  (C-c C-s)")
+(defvar ConTeXt-numbered-section-menu-name "Numbered section  (C-c C-s)")
+(defvar ConTeXt-unnumbered-section-menu-name "Unnumbered section")
 
 (defun ConTeXt-section-enable-symbol (level)
   "Symbol used to enable section LEVEL in the menu bar."
@@ -1326,17 +1408,29 @@ else.  There might be text before point."
     (set (ConTeXt-section-enable-symbol level)
         (>= level ConTeXt-largest-level))))
 
-(defun ConTeXt-section-menu (level)
-  "Insert section from menu."
-  (let ((ConTeXt-section-hook (delq 'ConTeXt-section-heading
-                                   (copy-sequence ConTeXt-section-hook))))
+(defun ConTeXt-numbered-section-menu (level)
+  "Insert numbered section from menu."
+  (let ((ConTeXt-numbered-section-hook (delq 'ConTeXt-numbered-section-heading
+                                   (copy-sequence 
ConTeXt-numbered-section-hook))))
+    (ConTeXt-section level)))
+
+(defun ConTeXt-unnumbered-section-menu (level)
+  "Insert unnumbered section from menu."
+  (let ((ConTeXt-unnumbered-section-hook (delq 
'ConTeXt-unnumbered-section-heading
+                                   (copy-sequence 
ConTeXt-unnumbered-section-hook))))
     (ConTeXt-section level)))
 
-(defun ConTeXt-section-menu-entry (entry)
-  "Create an ENTRY for the section menu."
+(defun ConTeXt-numbered-section-menu-entry (entry)
+  "Create an ENTRY for the numbered section menu."
   (let ((enable (ConTeXt-section-enable-symbol (nth 1 entry))))
     (set enable t)
-    (vector (car entry) (list 'ConTeXt-section-menu (nth 1 entry)) enable)))
+    (vector (car entry) (list 'ConTeXt-numbered-section-menu (nth 1 entry)) 
enable)))
+
+(defun ConTeXt-unnumbered-section-menu-entry (entry)
+  "Create an ENTRY for the unnumbered section menu."
+  (let ((enable (ConTeXt-section-enable-symbol (nth 1 entry))))
+    (set enable t)
+    (vector (car entry) (list 'ConTeXt-unnumbered-section-menu (nth 1 entry)) 
enable)))
 
 
 ;; etexshow support
@@ -1368,7 +1462,8 @@ else.  There might be text before point."
    `("ConTeXt"
      (,ConTeXt-project-structure-menu-name)
      (,ConTeXt-section-block-menu-name)
-     (,ConTeXt-section-menu-name)
+     (,ConTeXt-numbered-section-menu-name)
+     (,ConTeXt-unnumbered-section-menu-name)
      ["Add Table of Contents to Emacs Menu" (imenu-add-to-menubar "TOC") t]
      "-"
      ["Macro ..." TeX-insert-macro
@@ -1467,10 +1562,14 @@ else.  There might be text before point."
                           (mapcar 'ConTeXt-section-block-menu-entry
                                   ConTeXt-section-block-list)))
        (message "Updating section menu...")
-       (easy-menu-change '("ConTeXt") ConTeXt-section-menu-name
+       (easy-menu-change '("ConTeXt") ConTeXt-numbered-section-menu-name
+                         (LaTeX-split-long-menu
+                          (mapcar 'ConTeXt-numbered-section-menu-entry
+                                  ConTeXt-numbered-section-list)))
+       (easy-menu-change '("ConTeXt") ConTeXt-unnumbered-section-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-section-menu-entry
-                                  ConTeXt-section-list)))
+                          (mapcar 'ConTeXt-unnumbered-section-menu-entry
+                                  ConTeXt-unnumbered-section-list)))
        (message "Updating...done")
        (and menu (easy-menu-return-item ConTeXt-mode-menu menu))
        )))
@@ -1481,7 +1580,7 @@ else.  There might be text before point."
   "Command line option for texexec to use nonstopmode.")
 
 (defun ConTeXt-expand-options ()
-  "Expand options for texexec command."
+  "Expand options for context command."
   (concat
    (let ((engine (eval (nth 4 (assq TeX-engine (TeX-engine-alist))))))
      (when engine
@@ -1508,6 +1607,8 @@ else.  There might be text before point."
     ConTeXt-other-macro-list
     ConTeXt-project-structure-list
     ConTeXt-section-block-list
+    ConTeXt-numbered-section-list
+    ConTeXt-unnumbered-section-list
     ConTeXt-section-list
     ConTeXt-text
     ConTeXt-item-list
@@ -1651,7 +1752,7 @@ Special commands:
 
 Entering `context-mode' calls the value of `text-mode-hook',
 then the value of `TeX-mode-hook', and then the value
-of context-mode-hook."
+of ConTeXt-mode-hook."
   (interactive)
   (context-guess-current-interface)
   (require (intern (concat "context-" ConTeXt-current-interface)))

-----------------------------------------------------------------------

Summary of changes:
 context-en.el |   20 +++++--
 context.el    |  169 +++++++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 149 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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