[Top][All Lists]

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

Re: [AUCTeX-devel] feature proposal kill an next item in a enumerate lik

From: Arash Esbati
Subject: Re: [AUCTeX-devel] feature proposal kill an next item in a enumerate like environment
Date: Fri, 10 Mar 2017 11:46:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2

Uwe Brauer <address@hidden> writes:

> First of all, thanks very very much, this is really sophisticated at
> least for me, then some clarification.

Hi Uwe,

you're welcome.  I can think of one situation where my suggestion

* move cursor to this line and run the function
\item First we do blabla 
  and so on
\item the we do

Here an improved version which also works for \bibitem's:

--8<---------------cut here---------------start------------->8---
(defun ub/delete-item ()
  (let* ((currenv (LaTeX-current-environment))
         (beg-pos (save-excursion
         (end-pos (save-excursion
         (item-regexp "^[ \t]*\\\\\\(bib\\)?item")
         (end-regexp (concat "^[ \t]*\\\\end{" currenv "}"))
         item-start item-end)
    (if (looking-at item-regexp)
        ;; We are in the same line as in \item
          (setq item-start (point))
          (setq item-end
                  (or (re-search-forward item-regexp end-pos t 2)
                      (re-search-forward end-regexp end-pos t))
                  (end-of-line 0)
      ;; We are somewhere within \item
      (setq item-end
              (or (re-search-forward item-regexp end-pos t)
                  (re-search-forward end-regexp end-pos t))
              (end-of-line 0)
      (setq item-start (re-search-backward item-regexp beg-pos t)))
    (if (and item-start item-end)
          (delete-region item-start item-end)
          (when (looking-at "^$")
      (message "No start of item found."))))
--8<---------------cut here---------------end--------------->8---

>     -  I suggest to include such a function or a similar in auctex core,
>        what do others think? Or maybe ae/mark-item as well? I mean
>        replacing

Yes, let's see what others think.

Best, Arash

reply via email to

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