branch: externals/tex-parens
commit b427ee42af6e6b3cde594c7d73767b6446be53da
Author: Paul Nelson <[email protected]>
Commit: Paul Nelson <[email protected]>

    add some variant commands
    
    Add commands tex-parens-mark-inner, tex-parens-beginning-of-list,
    tex-parens-end-of-list.  Mention these and the "burp" commands in the
    README.
---
 README.org    |  3 ++-
 tex-parens.el | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index b6a741766c..b3a8e3cde5 100644
--- a/README.org
+++ b/README.org
@@ -79,4 +79,5 @@ The precise use-package declaration that I use may be found 
in [[https://github.
 
 Use =M-x customize-group tex-parens= to configure further.  If you tweak the 
customization variables concerning delimiters and modifiers, then you'll need 
to reload your tex file or =M-: (tex-parens-setup)= for the changes to take 
effect.
 
-
+* Variants
+This package contains the additional functions =tex-parens-burp-left=, 
=tex-parens-burp-right=, =tex-parens-mark-inner=, 
=tex-parens-beginning-of-list= and =tex-parens-end-of-list=, which are defined 
in terms of the sexp/list primitives; see the =C-h f= documentation for details.
diff --git a/tex-parens.el b/tex-parens.el
index af9583d5c4..6bc8134d25 100644
--- a/tex-parens.el
+++ b/tex-parens.el
@@ -981,5 +981,34 @@ Otherwise, call `self-insert-command'."
    (t
     (call-interactively #'self-insert-command))))
 
+;;; Miscellaneous
+
+(defun tex-parens-mark-inner ()
+  "Mark the innermost balanced group around point."
+  (interactive)
+  (tex-parens-backward-up-list)
+  (tex-parens-down-list)
+  (set-mark (point))
+  (tex-parens-up-list)
+  (tex-parens-backward-down-list))
+
+(defun tex-parens-beginning-of-list ()
+  "Move to the beginning of the current balanced group."
+  (interactive)
+  (let ((last (point)))
+    (tex-parens-backward-sexp)
+    (while (< (point) last)
+      (setq last (point))
+      (tex-parens-backward-sexp))))
+
+(defun tex-parens-end-of-list ()
+  "Move to the end of the current balanced group."
+  (interactive)
+  (let ((last (point)))
+    (tex-parens-forward-sexp)
+    (while (> (point) last)
+      (setq last (point))
+      (tex-parens-forward-sexp))))
+
 (provide 'tex-parens)
 ;;; tex-parens.el ends here

Reply via email to