[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa bb67e18 13/23: TikZ: Add 'Named Point' point type with compl
From: |
Tassilo Horn |
Subject: |
[elpa] elpa bb67e18 13/23: TikZ: Add 'Named Point' point type with completion. |
Date: |
Wed, 30 Mar 2016 19:08:03 +0000 |
branch: elpa
commit bb67e1818e4b6fc589363658b13631af137391df
Author: Matthew Leach <address@hidden>
Commit: Matthew Leach <address@hidden>
TikZ: Add 'Named Point' point type with completion.
* style/tikz.el (TeX-TikZ-point-name-regexp): New.
(TeX-TikZ-find-named-points): New.
(TeX-TikZ-arg-named-point): New.
(TeX-TikZ-point-function-map): Add 'Named Point' element that maps to
`TeX-TikZ-arg-named-point'.
---
style/tikz.el | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/style/tikz.el b/style/tikz.el
index d002811..abcb0bb 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -142,9 +142,41 @@ is finished."
;; Finish the macro.
(insert ";")))
+(defcustom TeX-TikZ-point-name-regexp
+ "(\\([A-Za-z0-9]+\\))"
+ "A regexp that matches TikZ names, i.e. alpha-numeric
+ characters enclosed in a ()."
+ :type 'regexp
+ :group 'auctex-tikz)
+
+(defun TeX-TikZ-find-named-points ()
+ "Find TiKZ named points in current enviroment.
+Begin by finding the span of the current TikZ enviroment and then
+searching within that span to find all named-points and return
+them as a list of strings, dropping the '()'."
+ (let* ((env-end (save-excursion
+ (LaTeX-find-matching-end)
+ (point)))
+ (matches ()))
+ ;; TODO: Handle cases where we are in a nested environment, \scope
+ ;; for example.
+ (save-excursion
+ (LaTeX-find-matching-begin)
+ (save-match-data
+ (while (re-search-forward TeX-TikZ-point-name-regexp env-end t)
+ (add-to-list 'matches (match-string 1)))))
+ matches))
+
+(defun TeX-TikZ-arg-named-point (_ignored)
+ "Prompt the user for the name of a previous named-point."
+ (let ((point-name (completing-read "Point name: "
+ (TeX-TikZ-find-named-points))))
+ (concat " (" point-name ") ")))
+
(defconst TeX-TikZ-point-function-map
'(("Rect Point" TeX-TikZ-arg-rect-point)
- ("Polar Point" TeX-TikZ-arg-polar-point))
+ ("Polar Point" TeX-TikZ-arg-polar-point)
+ ("Named Point" TeX-TikZ-arg-named-point))
"An alist of point specification types to their respective
functions.")
- [elpa] elpa 4a1728b 15/23: TikZ: Apply suggestions from checkdoc., (continued)
- [elpa] elpa 4a1728b 15/23: TikZ: Apply suggestions from checkdoc., Tassilo Horn, 2016/03/30
- [elpa] elpa cf4ce35 18/23: TikZ: Add more path connector types., Tassilo Horn, 2016/03/30
- [elpa] elpa f23fbd6 14/23: Fill environment content onley when auto-fill-mode is active, Tassilo Horn, 2016/03/30
- [elpa] elpa eddf3ff 20/23: Fix previous commit, Tassilo Horn, 2016/03/30
- [elpa] elpa 608e874 01/23: Add the beginnings of TikZ support., Tassilo Horn, 2016/03/30
- [elpa] elpa 201ed15 06/23: Fix a misplaced closing parenthesis, Tassilo Horn, 2016/03/30
- [elpa] elpa 1288609 07/23: Add fontification support, Tassilo Horn, 2016/03/30
- [elpa] elpa 00740ed 08/23: TikZ: split out the prompts to TeX-TikZ-arg-node & TeX-TikZ-macro-arg., Tassilo Horn, 2016/03/30
- [elpa] elpa c49b547 17/23: TikZ: Rename 'text' to 'label' to be consistent with TikZ terminology., Tassilo Horn, 2016/03/30
- [elpa] elpa 1cb2678 04/23: Delete redundant code, Tassilo Horn, 2016/03/30
- [elpa] elpa bb67e18 13/23: TikZ: Add 'Named Point' point type with completion.,
Tassilo Horn <=
- [elpa] elpa 0423aae 19/23: New function TeX-error-report-has-errors-p, Tassilo Horn, 2016/03/30
- [elpa] elpa df60ed5 05/23: Fix the name of argument in function body, Tassilo Horn, 2016/03/30
- [elpa] elpa 00430f2 21/23: Restore compatibility with XEmacs, Tassilo Horn, 2016/03/30
- [elpa] elpa b211827 10/23: TikZ: Extract the prompting of the next arg from TeX-TikZ-macro-arg., Tassilo Horn, 2016/03/30
- [elpa] elpa e8b5498 09/23: TikZ: allow arg type prompt to be specified., Tassilo Horn, 2016/03/30
- [elpa] elpa 0bb9765 11/23: TikZ: Add prompting for \coordinate macro., Tassilo Horn, 2016/03/30
- [elpa] elpa 4770a35 12/23: TikZ: Add prompting for TikZ's \node macro., Tassilo Horn, 2016/03/30
- [elpa] elpa 7573813 23/23: Release GNU AUCTeX 11.89.3, Tassilo Horn, 2016/03/30
- [elpa] elpa d120a27 22/23: Merge branch 'master' into elpa, Tassilo Horn, 2016/03/30