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. 4c8d64c0b9e62df788953


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 4c8d64c0b9e62df7889530caef5019e200de8de8
Date: Mon, 11 Aug 2014 17:40:03 +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  4c8d64c0b9e62df7889530caef5019e200de8de8 (commit)
       via  6da54fae3d0871c993a5d16b912b8b586e8770cb (commit)
      from  0da29134c929c52229bdd8eb43a0f32bbea22e06 (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 4c8d64c0b9e62df7889530caef5019e200de8de8
Author: Mosè Giordano <address@hidden>
Date:   Mon Aug 11 19:35:41 2014 +0200

    Keep error overview window if View command is run.
    
    * tex-buf.el (TeX-command): Keep the frame and the buffer
    associate to the error overview if the command to be run is View.

diff --git a/ChangeLog b/ChangeLog
index dbd0e53..806e013 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-08-11  Mosè Giordano  <address@hidden>
 
+       * tex-buf.el (TeX-command): Keep the frame and the buffer
+       associate to the error overview if the command to be run is View.
+
        * latex.el (LaTeX-auto-insert-label): New customizable variable.
        (LaTeX-label): Use it.
 
diff --git a/tex-buf.el b/tex-buf.el
index 722afed..ea62e11 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -362,11 +362,12 @@ asked if it is positive, and suppressed if it is not."
                                    nil nil)))
 
     ;; Kill the frame and buffer associated to the error overview before 
running
-    ;; the command.
-    (if (frame-live-p TeX-error-overview-frame)
-       (delete-frame TeX-error-overview-frame))
-    (if (get-buffer TeX-error-overview-buffer-name)
-       (kill-buffer TeX-error-overview-buffer-name))
+    ;; the command, but keep them if the command to be run is View.
+    (unless (string= name "View")
+      (if (frame-live-p TeX-error-overview-frame)
+                  (delete-frame TeX-error-overview-frame))
+     (if (get-buffer TeX-error-overview-buffer-name)
+        (kill-buffer TeX-error-overview-buffer-name)))
 
     ;; Now start the process
     (setq file (funcall file))

commit 6da54fae3d0871c993a5d16b912b8b586e8770cb
Author: Mosè Giordano <address@hidden>
Date:   Mon Aug 11 18:22:12 2014 +0200

    Manage auto insertion of labels.
    
    * latex.el (LaTeX-auto-insert-label): New customizable variable.
    (LaTeX-label): Use it.
    
    * doc/auctex.texi (Environments): Document
    `LaTeX-auto-insert-label'.
    
    * doc/changes.texi: Mention `LaTeX-auto-insert-label'.  Fix a
    couple of bad-boxes in the PDF output of the manual.

diff --git a/ChangeLog b/ChangeLog
index 2be1b61..dbd0e53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-08-11  Mosè Giordano  <address@hidden>
+
+       * latex.el (LaTeX-auto-insert-label): New customizable variable.
+       (LaTeX-label): Use it.
+
+       * doc/auctex.texi (Environments): Document
+       `LaTeX-auto-insert-label'.
+
+       * doc/changes.texi: Mention `LaTeX-auto-insert-label'.  Fix a
+       couple of bad-boxes in the PDF output of the manual.
+
 2014-07-25  Tassilo Horn  <address@hidden>
 
        * latex.el (LaTeX-largest-level-set): Adapt
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 7261705..37c7366 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -848,6 +848,40 @@ prefix argument), the current environment is modified and 
no new
 environment is inserted.
 @end deffn
 
address@hidden helps you adding labels to environments which use them, such
+as @samp{equation}, @samp{figure}, @samp{table}, address@hidden  When you
+insert one of the supported environments with @kbd{C-c C-e}, you will be
+automatically prompted for a label.  If you want to select the
+environments for which to automatically insert or not the label,
+customize the @code{LaTeX-auto-insert-label} variable.
address@hidden LaTeX-auto-insert-label
+Control whether @code{LaTeX-environment} (@kbd{C-c C-e}) should insert a
+label.  If nil, never inserts a label, if t always inserts a label and
+this the default.
+
+This variable may also be a cons cell, to whitelist or blacklist the
+environments for which a label should or should not be inserted.  The
+car can be either nil or t.  In the former case,
address@hidden never inserts labels except for the
+environments listed in the cdr; in the latter case
address@hidden always inserts labels except for the
+environments listed in the cdr.  In any cases, you can manually insert
+at point a label inside an environment with @kbd{C-c C-m label
address@hidden, as usual.
+
+For example, the value
address@hidden
+(t . "equation")
address@hidden lisp
+makes @AUCTeX{} always prompt you for a label except for the
address@hidden environment.  Instead with the value
address@hidden
+(nil . "caption" "figure")
address@hidden lisp
+you will be prompted for a label only for @samp{caption} and
address@hidden environments.
address@hidden defopt
+
 As a default selection, @AUCTeX{} will suggest the environment last
 inserted or, as the first choice the value of the variable
 @code{LaTeX-default-environment}.
diff --git a/doc/changes.texi b/doc/changes.texi
index b408b47..3ce9d34 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -26,7 +26,7 @@ by the TeX compiler can be opened with @kbd{M-x 
TeX-error-overview
 
 @item
 Style file authors are encouraged to distinguish common from expert
-macros/environments, and mark the latter using
+macros and environments, and mark the latter using
 @code{TeX-declare-expert-macros} and
 @code{LaTeX-declare-expert-environments}.
 
@@ -53,9 +53,10 @@ non-nil.  Completion for class options of the standard 
@LaTeX{} classes
 is provided as well.
 
 @item
-New user options @code{LaTeX-default-author}, @code{TeX-date-format},
address@hidden, @code{LaTeX-fontspec-arg-font-search},
-and @code{LaTeX-fontspec-font-list-default}.  A new possible value
+New user options @code{LaTeX-default-author},
address@hidden,
address@hidden, @code{TeX-date-format}, and
address@hidden  A new possible value
 (@code{show-all-optional-args}) for
 @code{TeX-insert-macro-default-style} was added.  The default value of
 @code{TeX-source-correlate-method} has been changed.
@@ -127,6 +128,10 @@ per file basis using the @code{TeX-command-extra-options} 
option.
 @item
 Now @kbd{C-c C-e document @key{RET}}, in an empty document, prompts for
 @samp{\usepackage} macros in addition to @samp{\documentclass}.
+
address@hidden
+You can customize for which environments a label should be automatically
+inserted or not through the user option @code{LaTeX-auto-insert-label}.
 @end itemize
 
 @heading News since 11.87
diff --git a/latex.el b/latex.el
index c798cda..d1ac41f 100644
--- a/latex.el
+++ b/latex.el
@@ -835,6 +835,28 @@ the label inserted, or nil if no label was inserted."
   :group 'LaTeX-label
   :type 'function)
 
+(defcustom LaTeX-auto-insert-label t
+  "Control whether `LaTeX-label' function should insert a label.
+If nil, never inserts a label, if t always inserts a label.
+
+This variable may also be a cons cell, to whitelist or blacklist
+the environments for which a label should or should not be
+inserted.  The CAR can be either nil or t.  In the former case,
+`LaTeX-label' never inserts labels except for the environments
+listed in the CDR; in the latter case `LaTeX-label' always
+inserts labels except for the environments listed in the CDR."
+  :group 'LaTeX-label
+  :type '(choice (const :tag "Insert labels" t)
+                (const :tag "Do not insert labels" nil)
+                (cons :tag "Whitelist or blacklist environments"
+                      (choice
+                       (const
+                        :tag "Insert labels except for environments..." t)
+                       (const
+                        :tag "Do not insert labels except for environments..."
+                        nil))
+                      (repeat (string :tag "Environment")))))
+
 (defcustom LaTeX-figure-label "fig:"
   "*Default prefix to figure labels."
   :group 'LaTeX-label
@@ -923,39 +945,51 @@ either the prefix or a symbol referring to one."
 
 (defun LaTeX-label (environment)
   "Insert a label for ENVIRONMENT at point.
-If `LaTeX-label-function' is a valid function, LaTeX label will transfer the
-job to this function."
-  (let (label)
-    (if (and (boundp 'LaTeX-label-function)
-            LaTeX-label-function
-            (fboundp LaTeX-label-function))
-
-       (setq label (funcall LaTeX-label-function environment))
-      (let ((prefix
-            (or (cdr (assoc environment LaTeX-label-alist))
-                (if (assoc environment LaTeX-section-list)
-                    (if (stringp LaTeX-section-label)
-                        LaTeX-section-label
-                      (and (listp LaTeX-section-label)
-                           (cdr (assoc environment LaTeX-section-label))))
-                  ""))))
-       (when prefix
-         (when (symbolp prefix)
-           (setq prefix (symbol-value prefix)))
-         ;; Use completing-read as we do with `C-c C-m \label RET'
-         (setq label (completing-read
-                      (TeX-argument-prompt t nil "What label")
-                      (LaTeX-label-list) nil nil prefix))
-         ;; No label or empty string entered?
-         (if (or (string= prefix label)
-                 (string= "" label))
-             (setq label nil)
-           (insert TeX-esc "label" TeX-grop label TeX-grcl))))
-      (if label
-         (progn
-           (LaTeX-add-labels label)
-           label)
-       nil))))
+`LaTeX-auto-insert-label' controls whether the label should
+actually be inserted.  If `LaTeX-label-function' is a valid
+function, LaTeX label will transfer the job to this function."
+  (if (cond
+       ;; `LaTeX-auto-insert-label' is boolean.
+       ((booleanp LaTeX-auto-insert-label)
+       LaTeX-auto-insert-label)
+       ;; `LaTeX-auto-insert-label' is a whitelist or a blacklist.
+       ((consp LaTeX-auto-insert-label)
+       (if (member environment (cdr LaTeX-auto-insert-label))
+           (null (car LaTeX-auto-insert-label))
+         (car LaTeX-auto-insert-label)))
+       ;; In any other cases, insert the label.
+       (t))
+      (let (label)
+       (if (and (boundp 'LaTeX-label-function)
+                LaTeX-label-function
+                (fboundp LaTeX-label-function))
+
+           (setq label (funcall LaTeX-label-function environment))
+         (let ((prefix
+                (or (cdr (assoc environment LaTeX-label-alist))
+                    (if (assoc environment LaTeX-section-list)
+                        (if (stringp LaTeX-section-label)
+                            LaTeX-section-label
+                          (and (listp LaTeX-section-label)
+                               (cdr (assoc environment LaTeX-section-label))))
+                      ""))))
+           (when prefix
+             (when (symbolp prefix)
+               (setq prefix (symbol-value prefix)))
+             ;; Use completing-read as we do with `C-c C-m \label RET'
+             (setq label (completing-read
+                          (TeX-argument-prompt t nil "What label")
+                          (LaTeX-label-list) nil nil prefix))
+             ;; No label or empty string entered?
+             (if (or (string= prefix label)
+                     (string= "" label))
+                 (setq label nil)
+               (insert TeX-esc "label" TeX-grop label TeX-grcl))))
+         (if label
+             (progn
+               (LaTeX-add-labels label)
+               label)
+           nil)))))
 
 (defun LaTeX-env-figure (environment)
   "Create ENVIRONMENT with \\caption and \\label commands."

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

Summary of changes:
 ChangeLog        |   14 +++++++
 doc/auctex.texi  |   34 ++++++++++++++++++
 doc/changes.texi |   13 +++++--
 latex.el         |  100 ++++++++++++++++++++++++++++++++++++------------------
 tex-buf.el       |   11 +++---
 5 files changed, 130 insertions(+), 42 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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