[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 2a642a4 19/80: Add support for ChangeLog entries
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 2a642a4 19/80: Add support for ChangeLog entries for LaTeX files |
Date: |
Wed, 16 Oct 2019 11:07:09 -0400 (EDT) |
branch: externals/auctex
commit 2a642a45814b57243a6c78aa876211175afc992e
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Add support for ChangeLog entries for LaTeX files
* tex.el (TeX-current-defun-name): New function returning the name
of current sectioning command when `C-x 4 a' is invoked.
* latex.el (LaTeX-common-initialization): Set a local version
`add-log-current-defun-function' to `TeX-current-defun-name'.
---
latex.el | 8 ++++++--
tex.el | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 58 insertions(+), 3 deletions(-)
diff --git a/latex.el b/latex.el
index 898eec8..6a96cb4 100644
--- a/latex.el
+++ b/latex.el
@@ -1,6 +1,6 @@
;;; latex.el --- Support for LaTeX documents.
-;; Copyright (C) 1991, 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1993-2019 Free Software Foundation, Inc.
;; Maintainer: address@hidden
;; Keywords: tex
@@ -6516,7 +6516,11 @@ function would return non-nil and `(match-string 1)'
would return
;; emacs 24.4.
(when (and LaTeX-electric-left-right-brace
(boundp 'electric-pair-mode))
- (set (make-local-variable 'electric-pair-mode) nil)))
+ (set (make-local-variable 'electric-pair-mode) nil))
+
+ ;; Initialization of `add-log-current-defun-function':
+ (set (make-local-variable 'add-log-current-defun-function)
+ #'TeX-current-defun-name))
(defun LaTeX-imenu-create-index-function ()
"Imenu support function for LaTeX."
diff --git a/tex.el b/tex.el
index f469a6c..6c2cbb6 100644
--- a/tex.el
+++ b/tex.el
@@ -1,6 +1,6 @@
;;; tex.el --- Support for TeX documents.
-;; Copyright (C) 1985-1987, 1991, 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1991, 1993-2019 Free Software Foundation, Inc.
;; Maintainer: address@hidden
;; Keywords: tex
@@ -6575,6 +6575,57 @@ Used as function for validating a variable's
`safe-local-variable' property."
(setq lst (cdr lst)))
all-strings)))
+;; add-log.el: This function is a variation of
+;; `tex-current-defun-name' defined in `tex-mode.el'. In `latex.el',
+;; the variable `add-log-current-defun-function' is set to this
+;; function.
+(defun TeX-current-defun-name ()
+ "Return the name of the TeX section/paragraph/chapter at point, or nil."
+ (save-excursion
+ (let (s1 e1 s2 e2)
+ ;; If we are now precisely at the beginning of a sectioning
+ ;; command, move forward and make sure `re-search-backward'
+ ;; finds this one rather than the previous one:
+ (or (eobp) (progn
+ (when (looking-at-p "\\\\")
+ (forward-char))
+ (unless (eolp)
+ (forward-sexp))))
+ ;; Search backward for sectioning command. If
+ ;; `LaTeX-section-label' is buffer-local, assume that a style
+ ;; has changed the value and recalculate the string. Otherwise
+ ;; take the standard one:
+ (when (re-search-backward
+ (if (local-variable-p 'LaTeX-section-label)
+ (concat (regexp-opt
+ (remove "part" (mapcar #'car LaTeX-section-label)))
+ "\\*?")
+ "\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)\\*?")
+ nil t)
+ ;; Skip over the backslash:
+ (setq s1 (1+ (point)))
+ ;; Skip over the sectioning command, incl. the *:
+ (setq e1 (goto-char (match-end 0)))
+ ;; Skip over the optional argument, if any:
+ (when (looking-at-p "[ \t]*\\[")
+ (forward-sexp))
+ ;; Skip over any chars until the mandatory argument:
+ (skip-chars-forward "^{")
+ ;; Remember the points for the mandatory argument:
+ (setq s2 (point))
+ (setq e2 (progn (forward-sexp)
+ (point)))
+ ;; Now pick the content: For one-line title, return it
+ ;; incl. the closing brace. For multi-line, return the first
+ ;; line of the mandatory argument incl. ellipsis and a brace;
+ (concat
+ (buffer-substring-no-properties s1 e1)
+ (buffer-substring-no-properties
+ (goto-char s2)
+ (min (line-end-position) e2))
+ (when (> e2 (line-end-position))
+ (concat "..." TeX-grcl)))))))
+
(provide 'tex)
;; Local Variables:
- [elpa] externals/auctex 3543e45 06/80: New styles for beamerarticle & beamerswitch triggering beamer, (continued)
- [elpa] externals/auctex 3543e45 06/80: New styles for beamerarticle & beamerswitch triggering beamer, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 78c0f09 07/80: Fix fontification of simple macros, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 083964b 02/80: Delete auctex-pkg.el which is not needed for ELPA releases, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex b82ab0c 08/80: Support up to 12 command arguments., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex cd39966 14/80: ; Fix typos, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 686a8ed 13/80: Elaborate LaTeX math insertion command, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 8a36595 12/80: Fix handling of function entries in `TeX-complete-list', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex fcaef6b 11/80: Improve fontification of \href macro, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 23b3405 23/80: ; Fix typos, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3b3c224 26/80: Remove compatibility code for xemacs, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 2a642a4 19/80: Add support for ChangeLog entries for LaTeX files,
Tassilo Horn <=
- [elpa] externals/auctex a8bbd1f 31/80: ; Fix document, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex ab57cb0 21/80: Add new function `LaTeX-extract-key-value-label', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 4776fd0 25/80: ; Remove compatibility code for older emacsen, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 92c090d 30/80: Fix treatment of class and package options, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex a30db7c 24/80: Allow the user to customize which TeX commands are available in each mode., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 4d0cf0f 10/80: ; Silence the compiler, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 7872796 15/80: * tex-info.el (TeX-texinfo-mode): Set `add-log-current-defun-function' locally., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 18a09f0 03/80: * auctex.el: Add requireds, keywords, and trailer, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex b141ded 27/80: Remove compatibility code for xemacs, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 4611580 32/80: * tex-jp.el (AUCTeX-jp): Add keyword :link to info node., Tassilo Horn, 2019/10/16