auctex
[Top][All Lists]
Advanced

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

[AUCTeX] [solved] Insert counter in Emacs tex file


From: Rodolfo Medina
Subject: [AUCTeX] [solved] Insert counter in Emacs tex file
Date: Mon, 27 Aug 2018 14:56:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Rodolfo Medina <address@hidden> writes:

> (defun my-cancel-bar-numbers ()
>     (interactive)
> (replace-regexp "\\\\bar %[0-9]+" "\\\\bar" nil (if (use-region-p)
> (region-beginning)) (if (use-region-p) (region-end)) nil)
> )
>
> and
>
> (defun my-number-bars ()
>     (interactive)
> (replace-regexp "\\\\bar" (quote (replace-eval-replacement concat "\\\\bar %"
> (replace-quote (+ 2 replace-count)))) nil (if (use-region-p)
> (region-beginning)) (if (use-region-p) (region-end)) nil)
> )
>
> After all, I can use them separately, preceeded by `M-h'.  But do you think
> it's possible, in the second definition, to replace not only `\bar' but the
> whole line including it...?  That way, I could do without the first
> definition...  I mean, use `replace-regexp' with sort of jolly expressions:
> replace `\bar' and whatever comes after it in the line...


This, alone, seems to do what I want:

(defun my-reset-bar-numbers ()
    (interactive)
(replace-regexp "\\\\bar.*" (quote (replace-eval-replacement concat "\\\\bar %" 
(replace-quote (+ 2 replace-count)))) nil (if (use-region-p) 
(region-beginning)) (if (use-region-p) (region-end)) nil)
)

, possibly with `M-h' prefix...

Thanks, Joost and David...

Rodolfo




reply via email to

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